[POWERPC] spufs: fix possible memory corruption is spufs_mem_write
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / spinlock_api_up.h
blob67faa044c5f5574042e72c28fa18f7f38e1fe51f
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 #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, flags) \
37 do { local_irq_save(flags); __LOCK(lock); } while (0)
39 #define __UNLOCK(lock) \
40 do { preempt_enable(); __release(lock); (void)(lock); } while (0)
42 #define __UNLOCK_BH(lock) \
43 do { preempt_enable_no_resched(); local_bh_enable(); __release(lock); (void)(lock); } while (0)
45 #define __UNLOCK_IRQ(lock) \
46 do { local_irq_enable(); __UNLOCK(lock); } while (0)
48 #define __UNLOCK_IRQRESTORE(lock, flags) \
49 do { local_irq_restore(flags); __UNLOCK(lock); } while (0)
51 #define _spin_lock(lock) __LOCK(lock)
52 #define _spin_lock_nested(lock, subclass) __LOCK(lock)
53 #define _read_lock(lock) __LOCK(lock)
54 #define _write_lock(lock) __LOCK(lock)
55 #define _spin_lock_bh(lock) __LOCK_BH(lock)
56 #define _read_lock_bh(lock) __LOCK_BH(lock)
57 #define _write_lock_bh(lock) __LOCK_BH(lock)
58 #define _spin_lock_irq(lock) __LOCK_IRQ(lock)
59 #define _read_lock_irq(lock) __LOCK_IRQ(lock)
60 #define _write_lock_irq(lock) __LOCK_IRQ(lock)
61 #define _spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
62 #define _read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
63 #define _write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
64 #define _spin_trylock(lock) ({ __LOCK(lock); 1; })
65 #define _read_trylock(lock) ({ __LOCK(lock); 1; })
66 #define _write_trylock(lock) ({ __LOCK(lock); 1; })
67 #define _spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; })
68 #define _spin_unlock(lock) __UNLOCK(lock)
69 #define _read_unlock(lock) __UNLOCK(lock)
70 #define _write_unlock(lock) __UNLOCK(lock)
71 #define _spin_unlock_bh(lock) __UNLOCK_BH(lock)
72 #define _write_unlock_bh(lock) __UNLOCK_BH(lock)
73 #define _read_unlock_bh(lock) __UNLOCK_BH(lock)
74 #define _spin_unlock_irq(lock) __UNLOCK_IRQ(lock)
75 #define _read_unlock_irq(lock) __UNLOCK_IRQ(lock)
76 #define _write_unlock_irq(lock) __UNLOCK_IRQ(lock)
77 #define _spin_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags)
78 #define _read_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags)
79 #define _write_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags)
81 #endif /* __LINUX_SPINLOCK_API_UP_H */