Akinobu Mita | 930ae74 | 2006-03-26 01:39:15 -0800 | [diff] [blame] | 1 | #ifndef _ASM_GENERIC_BITOPS_LE_H_ |
| 2 | #define _ASM_GENERIC_BITOPS_LE_H_ |
| 3 | |
| 4 | #include <asm/types.h> |
| 5 | #include <asm/byteorder.h> |
| 6 | |
Akinobu Mita | 930ae74 | 2006-03-26 01:39:15 -0800 | [diff] [blame] | 7 | #if defined(__LITTLE_ENDIAN) |
| 8 | |
Akinobu Mita | 63ab595 | 2011-03-23 16:41:46 -0700 | [diff] [blame^] | 9 | #define BITOP_LE_SWIZZLE 0 |
Akinobu Mita | 930ae74 | 2006-03-26 01:39:15 -0800 | [diff] [blame] | 10 | |
Akinobu Mita | 63ab595 | 2011-03-23 16:41:46 -0700 | [diff] [blame^] | 11 | #define generic_find_next_zero_le_bit(addr, size, offset) \ |
| 12 | find_next_zero_bit(addr, size, offset) |
Aneesh Kumar K.V | aa02ad6 | 2008-01-28 23:58:27 -0500 | [diff] [blame] | 13 | #define generic_find_next_le_bit(addr, size, offset) \ |
Akinobu Mita | 63ab595 | 2011-03-23 16:41:46 -0700 | [diff] [blame^] | 14 | find_next_bit(addr, size, offset) |
| 15 | #define generic_find_first_zero_le_bit(addr, size) \ |
| 16 | find_first_zero_bit(addr, size) |
Akinobu Mita | 930ae74 | 2006-03-26 01:39:15 -0800 | [diff] [blame] | 17 | |
| 18 | #elif defined(__BIG_ENDIAN) |
| 19 | |
Akinobu Mita | 63ab595 | 2011-03-23 16:41:46 -0700 | [diff] [blame^] | 20 | #define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7) |
| 21 | |
| 22 | extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, |
| 23 | unsigned long size, unsigned long offset); |
| 24 | extern unsigned long generic_find_next_le_bit(const unsigned long *addr, |
| 25 | unsigned long size, unsigned long offset); |
| 26 | |
| 27 | #define generic_find_first_zero_le_bit(addr, size) \ |
| 28 | generic_find_next_zero_le_bit((addr), (size), 0) |
| 29 | |
| 30 | #else |
| 31 | #error "Please fix <asm/byteorder.h>" |
| 32 | #endif |
| 33 | |
Akinobu Mita | 930ae74 | 2006-03-26 01:39:15 -0800 | [diff] [blame] | 34 | #define generic_test_le_bit(nr, addr) \ |
| 35 | test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) |
| 36 | #define generic___set_le_bit(nr, addr) \ |
| 37 | __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) |
| 38 | #define generic___clear_le_bit(nr, addr) \ |
| 39 | __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) |
| 40 | |
| 41 | #define generic_test_and_set_le_bit(nr, addr) \ |
| 42 | test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) |
| 43 | #define generic_test_and_clear_le_bit(nr, addr) \ |
| 44 | test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) |
| 45 | |
| 46 | #define generic___test_and_set_le_bit(nr, addr) \ |
| 47 | __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) |
| 48 | #define generic___test_and_clear_le_bit(nr, addr) \ |
| 49 | __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) |
| 50 | |
Akinobu Mita | 930ae74 | 2006-03-26 01:39:15 -0800 | [diff] [blame] | 51 | #endif /* _ASM_GENERIC_BITOPS_LE_H_ */ |