ping locking
[cor_2_6_31.git] / arch / blackfin / include / asm / bitops.h
blobdaffa71576d41149da64014fce99a4bbc542d88c
1 #ifndef _BLACKFIN_BITOPS_H
2 #define _BLACKFIN_BITOPS_H
4 #ifndef CONFIG_SMP
5 # include <asm-generic/bitops.h>
6 #else
8 #ifndef _LINUX_BITOPS_H
9 #error only <linux/bitops.h> can be included directly
10 #endif
12 #include <linux/compiler.h>
13 #include <asm/byteorder.h> /* swab32 */
15 #include <asm-generic/bitops/ffs.h>
16 #include <asm-generic/bitops/__ffs.h>
17 #include <asm-generic/bitops/sched.h>
18 #include <asm-generic/bitops/ffz.h>
20 #include <linux/linkage.h>
22 asmlinkage int __raw_bit_set_asm(volatile unsigned long *addr, int nr);
24 asmlinkage int __raw_bit_clear_asm(volatile unsigned long *addr, int nr);
26 asmlinkage int __raw_bit_toggle_asm(volatile unsigned long *addr, int nr);
28 asmlinkage int __raw_bit_test_set_asm(volatile unsigned long *addr, int nr);
30 asmlinkage int __raw_bit_test_clear_asm(volatile unsigned long *addr, int nr);
32 asmlinkage int __raw_bit_test_toggle_asm(volatile unsigned long *addr, int nr);
34 asmlinkage int __raw_bit_test_asm(const volatile unsigned long *addr, int nr);
36 static inline void set_bit(int nr, volatile unsigned long *addr)
38 volatile unsigned long *a = addr + (nr >> 5);
39 __raw_bit_set_asm(a, nr & 0x1f);
42 static inline void clear_bit(int nr, volatile unsigned long *addr)
44 volatile unsigned long *a = addr + (nr >> 5);
45 __raw_bit_clear_asm(a, nr & 0x1f);
48 static inline void change_bit(int nr, volatile unsigned long *addr)
50 volatile unsigned long *a = addr + (nr >> 5);
51 __raw_bit_toggle_asm(a, nr & 0x1f);
54 static inline int test_bit(int nr, const volatile unsigned long *addr)
56 volatile const unsigned long *a = addr + (nr >> 5);
57 return __raw_bit_test_asm(a, nr & 0x1f) != 0;
60 static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
62 volatile unsigned long *a = addr + (nr >> 5);
63 return __raw_bit_test_set_asm(a, nr & 0x1f);
66 static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
68 volatile unsigned long *a = addr + (nr >> 5);
69 return __raw_bit_test_clear_asm(a, nr & 0x1f);
72 static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
74 volatile unsigned long *a = addr + (nr >> 5);
75 return __raw_bit_test_toggle_asm(a, nr & 0x1f);
79 * clear_bit() doesn't provide any barrier for the compiler.
81 #define smp_mb__before_clear_bit() barrier()
82 #define smp_mb__after_clear_bit() barrier()
84 #include <asm-generic/bitops/non-atomic.h>
86 #include <asm-generic/bitops/find.h>
87 #include <asm-generic/bitops/hweight.h>
88 #include <asm-generic/bitops/lock.h>
90 #include <asm-generic/bitops/ext2-atomic.h>
91 #include <asm-generic/bitops/ext2-non-atomic.h>
93 #include <asm-generic/bitops/minix.h>
95 #include <asm-generic/bitops/fls.h>
96 #include <asm-generic/bitops/__fls.h>
97 #include <asm-generic/bitops/fls64.h>
99 #endif /* CONFIG_SMP */
101 #endif /* _BLACKFIN_BITOPS_H */