blob: 9085429ff3ca51faa7763fc355964db0ebdba8c2 [file] [log] [blame]
Akinobu Mita930ae742006-03-26 01:39:15 -08001#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 Mita930ae742006-03-26 01:39:15 -08007#if defined(__LITTLE_ENDIAN)
8
Akinobu Mita63ab5952011-03-23 16:41:46 -07009#define BITOP_LE_SWIZZLE 0
Akinobu Mita930ae742006-03-26 01:39:15 -080010
Akinobu Mita63ab5952011-03-23 16:41:46 -070011#define generic_find_next_zero_le_bit(addr, size, offset) \
12 find_next_zero_bit(addr, size, offset)
Aneesh Kumar K.Vaa02ad62008-01-28 23:58:27 -050013#define generic_find_next_le_bit(addr, size, offset) \
Akinobu Mita63ab5952011-03-23 16:41:46 -070014 find_next_bit(addr, size, offset)
15#define generic_find_first_zero_le_bit(addr, size) \
16 find_first_zero_bit(addr, size)
Akinobu Mita930ae742006-03-26 01:39:15 -080017
18#elif defined(__BIG_ENDIAN)
19
Akinobu Mita63ab5952011-03-23 16:41:46 -070020#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
21
22extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr,
23 unsigned long size, unsigned long offset);
24extern 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 Mita930ae742006-03-26 01:39:15 -080034#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 Mita930ae742006-03-26 01:39:15 -080051#endif /* _ASM_GENERIC_BITOPS_LE_H_ */