Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 1995, Russell King. |
| 3 | * Various bits and pieces copyrights include: |
| 4 | * Linus Torvalds (test_bit). |
| 5 | * Big endian support: Copyright 2001, Nicolas Pitre |
| 6 | * reworked by rmk. |
| 7 | * |
| 8 | * bit 0 is the LSB of an "unsigned long" quantity. |
| 9 | * |
| 10 | * Please note that the code in this file should never be included |
| 11 | * from user space. Many of these are not implemented in assembler |
| 12 | * since they would be too costly. Also, they require privileged |
| 13 | * instructions (which are not available from user mode) to ensure |
| 14 | * that they are atomic. |
| 15 | */ |
| 16 | |
| 17 | #ifndef __ASM_ARM_BITOPS_H |
| 18 | #define __ASM_ARM_BITOPS_H |
| 19 | |
| 20 | #ifdef __KERNEL__ |
| 21 | |
Jiri Slaby | 0624517 | 2007-10-18 23:40:26 -0700 | [diff] [blame] | 22 | #ifndef _LINUX_BITOPS_H |
| 23 | #error only <linux/bitops.h> can be included directly |
| 24 | #endif |
| 25 | |
Russell King | 8dc39b8 | 2005-11-16 17:23:57 +0000 | [diff] [blame] | 26 | #include <linux/compiler.h> |
David Howells | 9f97da7 | 2012-03-28 18:30:01 +0100 | [diff] [blame] | 27 | #include <linux/irqflags.h> |
Peter Zijlstra | 030d017 | 2014-03-12 17:11:00 +0100 | [diff] [blame] | 28 | #include <asm/barrier.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
| 30 | /* |
| 31 | * These functions are the basis of our bit ops. |
| 32 | * |
| 33 | * First, the atomic bitops. These use native endian. |
| 34 | */ |
| 35 | static inline void ____atomic_set_bit(unsigned int bit, volatile unsigned long *p) |
| 36 | { |
| 37 | unsigned long flags; |
Masahiro Yamada | 8901925 | 2015-08-17 03:59:52 +0100 | [diff] [blame] | 38 | unsigned long mask = BIT_MASK(bit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
Masahiro Yamada | 8901925 | 2015-08-17 03:59:52 +0100 | [diff] [blame] | 40 | p += BIT_WORD(bit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | |
Lennert Buytenhek | e7cc2c5 | 2006-09-21 03:35:20 +0100 | [diff] [blame] | 42 | raw_local_irq_save(flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | *p |= mask; |
Lennert Buytenhek | e7cc2c5 | 2006-09-21 03:35:20 +0100 | [diff] [blame] | 44 | raw_local_irq_restore(flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | static inline void ____atomic_clear_bit(unsigned int bit, volatile unsigned long *p) |
| 48 | { |
| 49 | unsigned long flags; |
Masahiro Yamada | 8901925 | 2015-08-17 03:59:52 +0100 | [diff] [blame] | 50 | unsigned long mask = BIT_MASK(bit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
Masahiro Yamada | 8901925 | 2015-08-17 03:59:52 +0100 | [diff] [blame] | 52 | p += BIT_WORD(bit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
Lennert Buytenhek | e7cc2c5 | 2006-09-21 03:35:20 +0100 | [diff] [blame] | 54 | raw_local_irq_save(flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | *p &= ~mask; |
Lennert Buytenhek | e7cc2c5 | 2006-09-21 03:35:20 +0100 | [diff] [blame] | 56 | raw_local_irq_restore(flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | static inline void ____atomic_change_bit(unsigned int bit, volatile unsigned long *p) |
| 60 | { |
| 61 | unsigned long flags; |
Masahiro Yamada | 8901925 | 2015-08-17 03:59:52 +0100 | [diff] [blame] | 62 | unsigned long mask = BIT_MASK(bit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | |
Masahiro Yamada | 8901925 | 2015-08-17 03:59:52 +0100 | [diff] [blame] | 64 | p += BIT_WORD(bit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | |
Lennert Buytenhek | e7cc2c5 | 2006-09-21 03:35:20 +0100 | [diff] [blame] | 66 | raw_local_irq_save(flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | *p ^= mask; |
Lennert Buytenhek | e7cc2c5 | 2006-09-21 03:35:20 +0100 | [diff] [blame] | 68 | raw_local_irq_restore(flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | static inline int |
| 72 | ____atomic_test_and_set_bit(unsigned int bit, volatile unsigned long *p) |
| 73 | { |
| 74 | unsigned long flags; |
| 75 | unsigned int res; |
Masahiro Yamada | 8901925 | 2015-08-17 03:59:52 +0100 | [diff] [blame] | 76 | unsigned long mask = BIT_MASK(bit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | |
Masahiro Yamada | 8901925 | 2015-08-17 03:59:52 +0100 | [diff] [blame] | 78 | p += BIT_WORD(bit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | |
Lennert Buytenhek | e7cc2c5 | 2006-09-21 03:35:20 +0100 | [diff] [blame] | 80 | raw_local_irq_save(flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | res = *p; |
| 82 | *p = res | mask; |
Lennert Buytenhek | e7cc2c5 | 2006-09-21 03:35:20 +0100 | [diff] [blame] | 83 | raw_local_irq_restore(flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | |
Johannes Weiner | e9ac829 | 2009-07-21 17:08:28 +0200 | [diff] [blame] | 85 | return (res & mask) != 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | static inline int |
| 89 | ____atomic_test_and_clear_bit(unsigned int bit, volatile unsigned long *p) |
| 90 | { |
| 91 | unsigned long flags; |
| 92 | unsigned int res; |
Masahiro Yamada | 8901925 | 2015-08-17 03:59:52 +0100 | [diff] [blame] | 93 | unsigned long mask = BIT_MASK(bit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | |
Masahiro Yamada | 8901925 | 2015-08-17 03:59:52 +0100 | [diff] [blame] | 95 | p += BIT_WORD(bit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | |
Lennert Buytenhek | e7cc2c5 | 2006-09-21 03:35:20 +0100 | [diff] [blame] | 97 | raw_local_irq_save(flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | res = *p; |
| 99 | *p = res & ~mask; |
Lennert Buytenhek | e7cc2c5 | 2006-09-21 03:35:20 +0100 | [diff] [blame] | 100 | raw_local_irq_restore(flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | |
Johannes Weiner | e9ac829 | 2009-07-21 17:08:28 +0200 | [diff] [blame] | 102 | return (res & mask) != 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | static inline int |
| 106 | ____atomic_test_and_change_bit(unsigned int bit, volatile unsigned long *p) |
| 107 | { |
| 108 | unsigned long flags; |
| 109 | unsigned int res; |
Masahiro Yamada | 8901925 | 2015-08-17 03:59:52 +0100 | [diff] [blame] | 110 | unsigned long mask = BIT_MASK(bit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | |
Masahiro Yamada | 8901925 | 2015-08-17 03:59:52 +0100 | [diff] [blame] | 112 | p += BIT_WORD(bit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | |
Lennert Buytenhek | e7cc2c5 | 2006-09-21 03:35:20 +0100 | [diff] [blame] | 114 | raw_local_irq_save(flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | res = *p; |
| 116 | *p = res ^ mask; |
Lennert Buytenhek | e7cc2c5 | 2006-09-21 03:35:20 +0100 | [diff] [blame] | 117 | raw_local_irq_restore(flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | |
Johannes Weiner | e9ac829 | 2009-07-21 17:08:28 +0200 | [diff] [blame] | 119 | return (res & mask) != 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | } |
| 121 | |
Akinobu Mita | b89c3b1 | 2006-03-26 01:39:19 -0800 | [diff] [blame] | 122 | #include <asm-generic/bitops/non-atomic.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | |
| 124 | /* |
| 125 | * A note about Endian-ness. |
| 126 | * ------------------------- |
| 127 | * |
| 128 | * When the ARM is put into big endian mode via CR15, the processor |
| 129 | * merely swaps the order of bytes within words, thus: |
| 130 | * |
| 131 | * ------------ physical data bus bits ----------- |
| 132 | * D31 ... D24 D23 ... D16 D15 ... D8 D7 ... D0 |
| 133 | * little byte 3 byte 2 byte 1 byte 0 |
| 134 | * big byte 0 byte 1 byte 2 byte 3 |
| 135 | * |
| 136 | * This means that reading a 32-bit word at address 0 returns the same |
| 137 | * value irrespective of the endian mode bit. |
| 138 | * |
| 139 | * Peripheral devices should be connected with the data bus reversed in |
| 140 | * "Big Endian" mode. ARM Application Note 61 is applicable, and is |
| 141 | * available from http://www.arm.com/. |
| 142 | * |
| 143 | * The following assumes that the data bus connectivity for big endian |
| 144 | * mode has been followed. |
| 145 | * |
| 146 | * Note that bit 0 is defined to be 32-bit word bit 0, not byte 0 bit 0. |
| 147 | */ |
| 148 | |
| 149 | /* |
Russell King | 6323f0c | 2011-01-16 18:02:17 +0000 | [diff] [blame] | 150 | * Native endian assembly bitops. nr = 0 -> word 0 bit 0. |
| 151 | */ |
| 152 | extern void _set_bit(int nr, volatile unsigned long * p); |
| 153 | extern void _clear_bit(int nr, volatile unsigned long * p); |
| 154 | extern void _change_bit(int nr, volatile unsigned long * p); |
| 155 | extern int _test_and_set_bit(int nr, volatile unsigned long * p); |
| 156 | extern int _test_and_clear_bit(int nr, volatile unsigned long * p); |
| 157 | extern int _test_and_change_bit(int nr, volatile unsigned long * p); |
| 158 | |
| 159 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. |
| 161 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | extern int _find_first_zero_bit_le(const void * p, unsigned size); |
| 163 | extern int _find_next_zero_bit_le(const void * p, int size, int offset); |
| 164 | extern int _find_first_bit_le(const unsigned long *p, unsigned size); |
| 165 | extern int _find_next_bit_le(const unsigned long *p, int size, int offset); |
| 166 | |
| 167 | /* |
| 168 | * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. |
| 169 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | extern int _find_first_zero_bit_be(const void * p, unsigned size); |
| 171 | extern int _find_next_zero_bit_be(const void * p, int size, int offset); |
| 172 | extern int _find_first_bit_be(const unsigned long *p, unsigned size); |
| 173 | extern int _find_next_bit_be(const unsigned long *p, int size, int offset); |
| 174 | |
Russell King | e7ec029 | 2005-07-28 20:36:26 +0100 | [diff] [blame] | 175 | #ifndef CONFIG_SMP |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | /* |
| 177 | * The __* form of bitops are non-atomic and may be reordered. |
| 178 | */ |
Russell King | 6323f0c | 2011-01-16 18:02:17 +0000 | [diff] [blame] | 179 | #define ATOMIC_BITOP(name,nr,p) \ |
| 180 | (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p)) |
Russell King | e7ec029 | 2005-07-28 20:36:26 +0100 | [diff] [blame] | 181 | #else |
Russell King | 6323f0c | 2011-01-16 18:02:17 +0000 | [diff] [blame] | 182 | #define ATOMIC_BITOP(name,nr,p) _##name(nr,p) |
Russell King | e7ec029 | 2005-07-28 20:36:26 +0100 | [diff] [blame] | 183 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | |
Russell King | 6323f0c | 2011-01-16 18:02:17 +0000 | [diff] [blame] | 185 | /* |
| 186 | * Native endian atomic definitions. |
| 187 | */ |
| 188 | #define set_bit(nr,p) ATOMIC_BITOP(set_bit,nr,p) |
| 189 | #define clear_bit(nr,p) ATOMIC_BITOP(clear_bit,nr,p) |
| 190 | #define change_bit(nr,p) ATOMIC_BITOP(change_bit,nr,p) |
| 191 | #define test_and_set_bit(nr,p) ATOMIC_BITOP(test_and_set_bit,nr,p) |
| 192 | #define test_and_clear_bit(nr,p) ATOMIC_BITOP(test_and_clear_bit,nr,p) |
| 193 | #define test_and_change_bit(nr,p) ATOMIC_BITOP(test_and_change_bit,nr,p) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | |
| 195 | #ifndef __ARMEB__ |
| 196 | /* |
| 197 | * These are the little endian, atomic definitions. |
| 198 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 199 | #define find_first_zero_bit(p,sz) _find_first_zero_bit_le(p,sz) |
| 200 | #define find_next_zero_bit(p,sz,off) _find_next_zero_bit_le(p,sz,off) |
| 201 | #define find_first_bit(p,sz) _find_first_bit_le(p,sz) |
| 202 | #define find_next_bit(p,sz,off) _find_next_bit_le(p,sz,off) |
| 203 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | #else |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | /* |
| 206 | * These are the big endian, atomic definitions. |
| 207 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | #define find_first_zero_bit(p,sz) _find_first_zero_bit_be(p,sz) |
| 209 | #define find_next_zero_bit(p,sz,off) _find_next_zero_bit_be(p,sz,off) |
| 210 | #define find_first_bit(p,sz) _find_first_bit_be(p,sz) |
| 211 | #define find_next_bit(p,sz,off) _find_next_bit_be(p,sz,off) |
| 212 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | #endif |
| 214 | |
| 215 | #if __LINUX_ARM_ARCH__ < 5 |
| 216 | |
Akinobu Mita | b89c3b1 | 2006-03-26 01:39:19 -0800 | [diff] [blame] | 217 | #include <asm-generic/bitops/ffz.h> |
Nicolas Pitre | 94fc733 | 2008-12-04 03:59:41 +0100 | [diff] [blame] | 218 | #include <asm-generic/bitops/__fls.h> |
Akinobu Mita | b89c3b1 | 2006-03-26 01:39:19 -0800 | [diff] [blame] | 219 | #include <asm-generic/bitops/__ffs.h> |
| 220 | #include <asm-generic/bitops/fls.h> |
| 221 | #include <asm-generic/bitops/ffs.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | |
| 223 | #else |
| 224 | |
Akinobu Mita | 936351336 | 2006-03-26 01:38:59 -0800 | [diff] [blame] | 225 | static inline int constant_fls(int x) |
| 226 | { |
| 227 | int r = 32; |
| 228 | |
| 229 | if (!x) |
| 230 | return 0; |
| 231 | if (!(x & 0xffff0000u)) { |
| 232 | x <<= 16; |
| 233 | r -= 16; |
| 234 | } |
| 235 | if (!(x & 0xff000000u)) { |
| 236 | x <<= 8; |
| 237 | r -= 8; |
| 238 | } |
| 239 | if (!(x & 0xf0000000u)) { |
| 240 | x <<= 4; |
| 241 | r -= 4; |
| 242 | } |
| 243 | if (!(x & 0xc0000000u)) { |
| 244 | x <<= 2; |
| 245 | r -= 2; |
| 246 | } |
| 247 | if (!(x & 0x80000000u)) { |
| 248 | x <<= 1; |
| 249 | r -= 1; |
| 250 | } |
| 251 | return r; |
| 252 | } |
| 253 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | /* |
Russell King | 23f6620 | 2014-01-13 23:34:56 +0000 | [diff] [blame] | 255 | * On ARMv5 and above those functions can be implemented around the |
| 256 | * clz instruction for much better code efficiency. __clz returns |
| 257 | * the number of leading zeros, zero input will return 32, and |
| 258 | * 0x80000000 will return 0. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | */ |
Russell King | 23f6620 | 2014-01-13 23:34:56 +0000 | [diff] [blame] | 260 | static inline unsigned int __clz(unsigned int x) |
Andrew Morton | 0c65f45 | 2008-07-23 15:35:22 -0700 | [diff] [blame] | 261 | { |
Russell King | 23f6620 | 2014-01-13 23:34:56 +0000 | [diff] [blame] | 262 | unsigned int ret; |
Nicolas Pitre | 94fc733 | 2008-12-04 03:59:41 +0100 | [diff] [blame] | 263 | |
Rabin Vincent | e163d52 | 2011-01-12 14:38:52 +0100 | [diff] [blame] | 264 | asm("clz\t%0, %1" : "=r" (ret) : "r" (x)); |
Russell King | 23f6620 | 2014-01-13 23:34:56 +0000 | [diff] [blame] | 265 | |
Nicolas Pitre | 94fc733 | 2008-12-04 03:59:41 +0100 | [diff] [blame] | 266 | return ret; |
Andrew Morton | 0c65f45 | 2008-07-23 15:35:22 -0700 | [diff] [blame] | 267 | } |
| 268 | |
Russell King | 23f6620 | 2014-01-13 23:34:56 +0000 | [diff] [blame] | 269 | /* |
| 270 | * fls() returns zero if the input is zero, otherwise returns the bit |
| 271 | * position of the last set bit, where the LSB is 1 and MSB is 32. |
| 272 | */ |
| 273 | static inline int fls(int x) |
| 274 | { |
| 275 | if (__builtin_constant_p(x)) |
| 276 | return constant_fls(x); |
| 277 | |
| 278 | return 32 - __clz(x); |
| 279 | } |
| 280 | |
| 281 | /* |
| 282 | * __fls() returns the bit position of the last bit set, where the |
| 283 | * LSB is 0 and MSB is 31. Zero input is undefined. |
| 284 | */ |
| 285 | static inline unsigned long __fls(unsigned long x) |
| 286 | { |
| 287 | return fls(x) - 1; |
| 288 | } |
| 289 | |
| 290 | /* |
| 291 | * ffs() returns zero if the input was zero, otherwise returns the bit |
| 292 | * position of the first set bit, where the LSB is 1 and MSB is 32. |
| 293 | */ |
| 294 | static inline int ffs(int x) |
| 295 | { |
| 296 | return fls(x & -x); |
| 297 | } |
| 298 | |
| 299 | /* |
| 300 | * __ffs() returns the bit position of the first bit set, where the |
| 301 | * LSB is 0 and MSB is 31. Zero input is undefined. |
| 302 | */ |
| 303 | static inline unsigned long __ffs(unsigned long x) |
| 304 | { |
| 305 | return ffs(x) - 1; |
| 306 | } |
| 307 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | #define ffz(x) __ffs( ~(x) ) |
| 309 | |
| 310 | #endif |
| 311 | |
Akinobu Mita | b89c3b1 | 2006-03-26 01:39:19 -0800 | [diff] [blame] | 312 | #include <asm-generic/bitops/fls64.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | |
Akinobu Mita | b89c3b1 | 2006-03-26 01:39:19 -0800 | [diff] [blame] | 314 | #include <asm-generic/bitops/sched.h> |
| 315 | #include <asm-generic/bitops/hweight.h> |
Nick Piggin | 2633357 | 2007-10-18 03:06:39 -0700 | [diff] [blame] | 316 | #include <asm-generic/bitops/lock.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | |
Akinobu Mita | 04b18ff | 2011-05-26 16:26:11 -0700 | [diff] [blame] | 318 | #ifdef __ARMEB__ |
Akinobu Mita | f6b57e3 | 2011-03-23 16:41:57 -0700 | [diff] [blame] | 319 | |
| 320 | static inline int find_first_zero_bit_le(const void *p, unsigned size) |
| 321 | { |
| 322 | return _find_first_zero_bit_le(p, size); |
| 323 | } |
Akinobu Mita | a2812e1 | 2011-05-26 16:26:06 -0700 | [diff] [blame] | 324 | #define find_first_zero_bit_le find_first_zero_bit_le |
Akinobu Mita | f6b57e3 | 2011-03-23 16:41:57 -0700 | [diff] [blame] | 325 | |
| 326 | static inline int find_next_zero_bit_le(const void *p, int size, int offset) |
| 327 | { |
| 328 | return _find_next_zero_bit_le(p, size, offset); |
| 329 | } |
Akinobu Mita | a2812e1 | 2011-05-26 16:26:06 -0700 | [diff] [blame] | 330 | #define find_next_zero_bit_le find_next_zero_bit_le |
Akinobu Mita | f6b57e3 | 2011-03-23 16:41:57 -0700 | [diff] [blame] | 331 | |
| 332 | static inline int find_next_bit_le(const void *p, int size, int offset) |
| 333 | { |
| 334 | return _find_next_bit_le(p, size, offset); |
| 335 | } |
Akinobu Mita | a2812e1 | 2011-05-26 16:26:06 -0700 | [diff] [blame] | 336 | #define find_next_bit_le find_next_bit_le |
Akinobu Mita | f6b57e3 | 2011-03-23 16:41:57 -0700 | [diff] [blame] | 337 | |
Akinobu Mita | 04b18ff | 2011-05-26 16:26:11 -0700 | [diff] [blame] | 338 | #endif |
| 339 | |
| 340 | #include <asm-generic/bitops/le.h> |
| 341 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | /* |
| 343 | * Ext2 is defined to use little-endian byte ordering. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 344 | */ |
Akinobu Mita | 148817b | 2011-07-26 16:09:04 -0700 | [diff] [blame] | 345 | #include <asm-generic/bitops/ext2-atomic-setbit.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | #endif /* __KERNEL__ */ |
| 348 | |
| 349 | #endif /* _ARM_BITOPS_H */ |