drm/nouveau/tegra: Fix error handling
[linux/fpc-iii.git] / include / asm-generic / bitops / le.h
blob61731543c00ea381fb8954c69b834b976260c0db
1 #ifndef _ASM_GENERIC_BITOPS_LE_H_
2 #define _ASM_GENERIC_BITOPS_LE_H_
4 #include <asm/types.h>
5 #include <asm/byteorder.h>
7 #if defined(__LITTLE_ENDIAN)
9 #define BITOP_LE_SWIZZLE 0
11 static inline unsigned long find_next_zero_bit_le(const void *addr,
12 unsigned long size, unsigned long offset)
14 return find_next_zero_bit(addr, size, offset);
17 static inline unsigned long find_next_bit_le(const void *addr,
18 unsigned long size, unsigned long offset)
20 return find_next_bit(addr, size, offset);
23 static inline unsigned long find_first_zero_bit_le(const void *addr,
24 unsigned long size)
26 return find_first_zero_bit(addr, size);
29 #elif defined(__BIG_ENDIAN)
31 #define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
33 #ifndef find_next_zero_bit_le
34 extern unsigned long find_next_zero_bit_le(const void *addr,
35 unsigned long size, unsigned long offset);
36 #endif
38 #ifndef find_next_bit_le
39 extern unsigned long find_next_bit_le(const void *addr,
40 unsigned long size, unsigned long offset);
41 #endif
43 #ifndef find_first_zero_bit_le
44 #define find_first_zero_bit_le(addr, size) \
45 find_next_zero_bit_le((addr), (size), 0)
46 #endif
48 #else
49 #error "Please fix <asm/byteorder.h>"
50 #endif
52 static inline int test_bit_le(int nr, const void *addr)
54 return test_bit(nr ^ BITOP_LE_SWIZZLE, addr);
57 static inline void set_bit_le(int nr, void *addr)
59 set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
62 static inline void clear_bit_le(int nr, void *addr)
64 clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
67 static inline void __set_bit_le(int nr, void *addr)
69 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
72 static inline void __clear_bit_le(int nr, void *addr)
74 __clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
77 static inline int test_and_set_bit_le(int nr, void *addr)
79 return test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
82 static inline int test_and_clear_bit_le(int nr, void *addr)
84 return test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
87 static inline int __test_and_set_bit_le(int nr, void *addr)
89 return __test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
92 static inline int __test_and_clear_bit_le(int nr, void *addr)
94 return __test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
97 #endif /* _ASM_GENERIC_BITOPS_LE_H_ */