writeback: safer lock nesting
[linux/fpc-iii.git] / include / asm-generic / bitops / le.h
blob188d3eba3ace85f8c5c21127403e70a7d355fb1d
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_GENERIC_BITOPS_LE_H_
3 #define _ASM_GENERIC_BITOPS_LE_H_
5 #include <asm/types.h>
6 #include <asm/byteorder.h>
8 #if defined(__LITTLE_ENDIAN)
10 #define BITOP_LE_SWIZZLE 0
12 static inline unsigned long find_next_zero_bit_le(const void *addr,
13 unsigned long size, unsigned long offset)
15 return find_next_zero_bit(addr, size, offset);
18 static inline unsigned long find_next_bit_le(const void *addr,
19 unsigned long size, unsigned long offset)
21 return find_next_bit(addr, size, offset);
24 static inline unsigned long find_first_zero_bit_le(const void *addr,
25 unsigned long size)
27 return find_first_zero_bit(addr, size);
30 #elif defined(__BIG_ENDIAN)
32 #define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
34 #ifndef find_next_zero_bit_le
35 extern unsigned long find_next_zero_bit_le(const void *addr,
36 unsigned long size, unsigned long offset);
37 #endif
39 #ifndef find_next_bit_le
40 extern unsigned long find_next_bit_le(const void *addr,
41 unsigned long size, unsigned long offset);
42 #endif
44 #ifndef find_first_zero_bit_le
45 #define find_first_zero_bit_le(addr, size) \
46 find_next_zero_bit_le((addr), (size), 0)
47 #endif
49 #else
50 #error "Please fix <asm/byteorder.h>"
51 #endif
53 static inline int test_bit_le(int nr, const void *addr)
55 return test_bit(nr ^ BITOP_LE_SWIZZLE, addr);
58 static inline void set_bit_le(int nr, void *addr)
60 set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
63 static inline void clear_bit_le(int nr, void *addr)
65 clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
68 static inline void __set_bit_le(int nr, void *addr)
70 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
73 static inline void __clear_bit_le(int nr, void *addr)
75 __clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
78 static inline int test_and_set_bit_le(int nr, void *addr)
80 return test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
83 static inline int test_and_clear_bit_le(int nr, void *addr)
85 return test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
88 static inline int __test_and_set_bit_le(int nr, void *addr)
90 return __test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
93 static inline int __test_and_clear_bit_le(int nr, void *addr)
95 return __test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
98 #endif /* _ASM_GENERIC_BITOPS_LE_H_ */