@@ -9,6 +9,8 @@
#if defined(__LITTLE_ENDIAN)
+#define generic_le_bit_offset(nr) (nr)
+
#define generic_test_le_bit(nr, addr) test_bit(nr, addr)
#define generic___set_le_bit(nr, addr) __set_bit(nr, addr)
#define generic___clear_le_bit(nr, addr) __clear_bit(nr, addr)
@@ -25,22 +27,24 @@
#elif defined(__BIG_ENDIAN)
+#define generic_le_bit_offset(nr) ((nr) ^ BITOP_LE_SWIZZLE)
+
#define generic_test_le_bit(nr, addr) \
- test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+ test_bit(generic_le_bit_offset(nr), (addr))
#define generic___set_le_bit(nr, addr) \
- __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+ __set_bit(generic_le_bit_offset(nr), (addr))
#define generic___clear_le_bit(nr, addr) \
- __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+ __clear_bit(generic_le_bit_offset(nr), (addr))
#define generic_test_and_set_le_bit(nr, addr) \
- test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+ test_and_set_bit(generic_le_bit_offset(nr), (addr))
#define generic_test_and_clear_le_bit(nr, addr) \
- test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+ test_and_clear_bit(generic_le_bit_offset(nr), (addr))
#define generic___test_and_set_le_bit(nr, addr) \
- __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+ __test_and_set_bit(generic_le_bit_offset(nr), (addr))
#define generic___test_and_clear_le_bit(nr, addr) \
- __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
+ __test_and_clear_bit(generic_le_bit_offset(nr), (addr))
extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
unsigned long size, unsigned long offset);