aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic/bitops/le.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-generic/bitops/le.h')
-rw-r--r--include/asm-generic/bitops/le.h89
1 files changed, 56 insertions, 33 deletions
diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h
index 80e3bf13b2b9..946a21b1b5dc 100644
--- a/include/asm-generic/bitops/le.h
+++ b/include/asm-generic/bitops/le.h
@@ -4,54 +4,77 @@
4#include <asm/types.h> 4#include <asm/types.h>
5#include <asm/byteorder.h> 5#include <asm/byteorder.h>
6 6
7#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
8#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
9
10#if defined(__LITTLE_ENDIAN) 7#if defined(__LITTLE_ENDIAN)
11 8
12#define generic_test_le_bit(nr, addr) test_bit(nr, addr) 9#define BITOP_LE_SWIZZLE 0
13#define generic___set_le_bit(nr, addr) __set_bit(nr, addr)
14#define generic___clear_le_bit(nr, addr) __clear_bit(nr, addr)
15 10
16#define generic_test_and_set_le_bit(nr, addr) test_and_set_bit(nr, addr) 11static inline unsigned long find_next_zero_bit_le(const void *addr,
17#define generic_test_and_clear_le_bit(nr, addr) test_and_clear_bit(nr, addr) 12 unsigned long size, unsigned long offset)
13{
14 return find_next_zero_bit(addr, size, offset);
15}
18 16
19#define generic___test_and_set_le_bit(nr, addr) __test_and_set_bit(nr, addr) 17static inline unsigned long find_next_bit_le(const void *addr,
20#define generic___test_and_clear_le_bit(nr, addr) __test_and_clear_bit(nr, addr) 18 unsigned long size, unsigned long offset)
19{
20 return find_next_bit(addr, size, offset);
21}
21 22
22#define generic_find_next_zero_le_bit(addr, size, offset) find_next_zero_bit(addr, size, offset) 23static inline unsigned long find_first_zero_bit_le(const void *addr,
23#define generic_find_next_le_bit(addr, size, offset) \ 24 unsigned long size)
24 find_next_bit(addr, size, offset) 25{
26 return find_first_zero_bit(addr, size);
27}
25 28
26#elif defined(__BIG_ENDIAN) 29#elif defined(__BIG_ENDIAN)
27 30
28#define generic_test_le_bit(nr, addr) \ 31#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
29 test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
30#define generic___set_le_bit(nr, addr) \
31 __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
32#define generic___clear_le_bit(nr, addr) \
33 __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
34
35#define generic_test_and_set_le_bit(nr, addr) \
36 test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
37#define generic_test_and_clear_le_bit(nr, addr) \
38 test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
39
40#define generic___test_and_set_le_bit(nr, addr) \
41 __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
42#define generic___test_and_clear_le_bit(nr, addr) \
43 __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
44 32
45extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, 33extern unsigned long find_next_zero_bit_le(const void *addr,
46 unsigned long size, unsigned long offset); 34 unsigned long size, unsigned long offset);
47extern unsigned long generic_find_next_le_bit(const unsigned long *addr, 35extern unsigned long find_next_bit_le(const void *addr,
48 unsigned long size, unsigned long offset); 36 unsigned long size, unsigned long offset);
49 37
38#define find_first_zero_bit_le(addr, size) \
39 find_next_zero_bit_le((addr), (size), 0)
40
50#else 41#else
51#error "Please fix <asm/byteorder.h>" 42#error "Please fix <asm/byteorder.h>"
52#endif 43#endif
53 44
54#define generic_find_first_zero_le_bit(addr, size) \ 45static inline int test_bit_le(int nr, const void *addr)
55 generic_find_next_zero_le_bit((addr), (size), 0) 46{
47 return test_bit(nr ^ BITOP_LE_SWIZZLE, addr);
48}
49
50static inline void __set_bit_le(int nr, void *addr)
51{
52 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
53}
54
55static inline void __clear_bit_le(int nr, void *addr)
56{
57 __clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
58}
59
60static inline int test_and_set_bit_le(int nr, void *addr)
61{
62 return test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
63}
64
65static inline int test_and_clear_bit_le(int nr, void *addr)
66{
67 return test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
68}
69
70static inline int __test_and_set_bit_le(int nr, void *addr)
71{
72 return __test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
73}
74
75static inline int __test_and_clear_bit_le(int nr, void *addr)
76{
77 return __test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
78}
56 79
57#endif /* _ASM_GENERIC_BITOPS_LE_H_ */ 80#endif /* _ASM_GENERIC_BITOPS_LE_H_ */