added 2.6.29.6 aldebaran kernel
[nao-ulib.git] / kernel / 2.6.29.6-aldebaran-rt / include / linux / spinlock_api_up.h
blob1672f3c8b9d2d37bc3f0d667671e8c6c346bd05f
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 suppress compiler warnings of unused lock
25 * variables, and to add the proper checker annotations:
27 #define __LOCK(lock) \
28 do { preempt_disable(); __acquire(lock); (void)(lock); } while (0)
30 #define __LOCK_BH(lock) \
31 do { local_bh_disable(); __LOCK(lock); } while (0)
33 #define __LOCK_IRQ(lock) \
34 do { local_irq_disable(); __LOCK(lock); } while (0)
36 #define __LOCK_IRQSAVE(lock) \
37 ({ unsigned long __flags; local_irq_save(__flags); __LOCK(lock); __flags; })
39 #define __TRYLOCK_IRQSAVE(lock, flags) \
40 ({ local_irq_save(*(flags)); __LOCK(lock); 1; })
42 #define __spin_trylock_irqsave(lock, flags) __TRYLOCK_IRQSAVE(lock, flags)
44 #define __write_trylock_irqsave(lock, flags) __TRYLOCK_IRQSAVE(lock, flags)
46 #define __UNLOCK(lock) \
47 do { preempt_enable(); __release(lock); (void)(lock); } while (0)
49 #define __UNLOCK_NO_RESCHED(lock) \
50 do { __preempt_enable_no_resched(); __release(lock); (void)(lock); } while (0)
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) __LOCK_IRQSAVE(lock)
72 #define __read_lock_irqsave(lock) __LOCK_IRQSAVE(lock)
73 #define __write_lock_irqsave(lock) __LOCK_IRQSAVE(lock)
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_trylock_irq(lock) ({ __LOCK_IRQ(lock); 1; })
79 #define __spin_unlock(lock) __UNLOCK(lock)
80 #define __spin_unlock_no_resched(lock) __UNLOCK_NO_RESCHED(lock)
81 #define __read_unlock(lock) __UNLOCK(lock)
82 #define __write_unlock(lock) __UNLOCK(lock)
83 #define __spin_unlock_bh(lock) __UNLOCK_BH(lock)
84 #define __write_unlock_bh(lock) __UNLOCK_BH(lock)
85 #define __read_unlock_bh(lock) __UNLOCK_BH(lock)
86 #define __spin_unlock_irq(lock) __UNLOCK_IRQ(lock)
87 #define __read_unlock_irq(lock) __UNLOCK_IRQ(lock)
88 #define __write_unlock_irq(lock) __UNLOCK_IRQ(lock)
89 #define __spin_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags)
90 #define __read_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags)
91 #define __write_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags)
93 #endif /* __LINUX_SPINLOCK_API_UP_H */