1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_GENERIC_BITOPS_LE_H_
3 #define _ASM_GENERIC_BITOPS_LE_H_
6 #include <asm/byteorder.h>
8 #if defined(__LITTLE_ENDIAN)
10 #define BITOP_LE_SWIZZLE 0
12 #elif defined(__BIG_ENDIAN)
14 #define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
19 static inline int test_bit_le(int nr
, const void *addr
)
21 return test_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
24 static inline void set_bit_le(int nr
, void *addr
)
26 set_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
29 static inline void clear_bit_le(int nr
, void *addr
)
31 clear_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
34 static inline void __set_bit_le(int nr
, void *addr
)
36 __set_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
39 static inline void __clear_bit_le(int nr
, void *addr
)
41 __clear_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
44 static inline int test_and_set_bit_le(int nr
, void *addr
)
46 return test_and_set_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
49 static inline int test_and_clear_bit_le(int nr
, void *addr
)
51 return test_and_clear_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
54 static inline int __test_and_set_bit_le(int nr
, void *addr
)
56 return __test_and_set_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
59 static inline int __test_and_clear_bit_le(int nr
, void *addr
)
61 return __test_and_clear_bit(nr
^ BITOP_LE_SWIZZLE
, addr
);
64 #endif /* _ASM_GENERIC_BITOPS_LE_H_ */