RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / include / linux / spinlock_api_up.h
blobe949a775a9fa2ab60edb8c8ad421466617d1390d
1 #ifndef __LINUX_SPINLOCK_API_UP_H
2 #define __LINUX_SPINLOCK_API_UP_H
4 #ifndef __LINUX_SPINLOCK_H
5 # error "please don't include this file directly"
6 #endif
8 /*
9 * include/linux/spinlock_api_up.h
11 * spinlock API implementation on UP-nondebug (inlined implementation)
13 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
14 * Released under the General Public License (GPL).
17 #define in_lock_functions(ADDR) 0
19 #define assert_spin_locked(lock) do { (void)(lock); } while (0)
22 * In the UP-nondebug case there's no real locking going on, so the
23 * only thing we have to do is to keep the preempt counts and irq
24 * flags straight, to supress compiler warnings of unused lock
25 * variables, and to add the proper checker annotations:
27 #ifdef CONFIG_PREEMPT
28 #define __LOCK(lock) \
29 do { preempt_disable(); __acquire(lock); (void)(lock); } while (0)
30 #else /* CONFIG_PREEMPT */
31 #define __LOCK(lock) \
32 (void)(lock)
33 #endif
35 #define __LOCK_BH(lock) \
36 do { local_bh_disable(); __LOCK(lock); } while (0)
38 #define __LOCK_IRQ(lock) \
39 do { local_irq_disable(); __LOCK(lock); } while (0)
41 #define __LOCK_IRQSAVE(lock, flags) \
42 do { local_irq_save(flags); __LOCK(lock); } while (0)
44 #ifdef CONFIG_PREEMPT
45 #define __UNLOCK(lock) \
46 do { preempt_enable(); __release(lock); (void)(lock); } while (0)
47 #else
48 #define __UNLOCK(lock) \
49 do { } while(0)
50 #endif
52 #define __UNLOCK_BH(lock) \
53 do { preempt_enable_no_resched(); local_bh_enable(); __release(lock); (void)(lock); } while (0)
55 #define __UNLOCK_IRQ(lock) \
56 do { local_irq_enable(); __UNLOCK(lock); } while (0)
58 #define __UNLOCK_IRQRESTORE(lock, flags) \
59 do { local_irq_restore(flags); __UNLOCK(lock); } while (0)
61 #define _spin_lock(lock) __LOCK(lock)
62 #define _spin_lock_nested(lock, subclass) __LOCK(lock)
63 #define _read_lock(lock) __LOCK(lock)
64 #define _write_lock(lock) __LOCK(lock)
65 #define _spin_lock_bh(lock) __LOCK_BH(lock)
66 #define _read_lock_bh(lock) __LOCK_BH(lock)
67 #define _write_lock_bh(lock) __LOCK_BH(lock)
68 #define _spin_lock_irq(lock) __LOCK_IRQ(lock)
69 #define _read_lock_irq(lock) __LOCK_IRQ(lock)
70 #define _write_lock_irq(lock) __LOCK_IRQ(lock)
71 #define _spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
72 #define _read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
73 #define _write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
74 #define _spin_trylock(lock) ({ __LOCK(lock); 1; })
75 #define _read_trylock(lock) ({ __LOCK(lock); 1; })
76 #define _write_trylock(lock) ({ __LOCK(lock); 1; })
77 #define _spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; })
78 #define _spin_unlock(lock) __UNLOCK(lock)
79 #define _read_unlock(lock) __UNLOCK(lock)
80 #define _write_unlock(lock) __UNLOCK(lock)
81 #define _spin_unlock_bh(lock) __UNLOCK_BH(lock)
82 #define _write_unlock_bh(lock) __UNLOCK_BH(lock)
83 #define _read_unlock_bh(lock) __UNLOCK_BH(lock)
84 #define _spin_unlock_irq(lock) __UNLOCK_IRQ(lock)
85 #define _read_unlock_irq(lock) __UNLOCK_IRQ(lock)
86 #define _write_unlock_irq(lock) __UNLOCK_IRQ(lock)
87 #define _spin_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags)
88 #define _read_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags)
89 #define _write_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags)
91 #endif /* __LINUX_SPINLOCK_API_UP_H */