diff options
-rw-r--r-- | arch/powerpc/include/asm/bitops.h | 61 |
1 files changed, 38 insertions, 23 deletions
diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h index db567ed9212d..0c1046fbdd24 100644 --- a/arch/powerpc/include/asm/bitops.h +++ b/arch/powerpc/include/asm/bitops.h | |||
@@ -281,27 +281,42 @@ unsigned long __arch_hweight64(__u64 w); | |||
281 | 281 | ||
282 | /* Little-endian versions */ | 282 | /* Little-endian versions */ |
283 | 283 | ||
284 | static __inline__ int test_le_bit(unsigned long nr, | 284 | static __inline__ int test_bit_le(unsigned long nr, |
285 | __const__ unsigned long *addr) | 285 | __const__ void *addr) |
286 | { | 286 | { |
287 | __const__ unsigned char *tmp = (__const__ unsigned char *) addr; | 287 | __const__ unsigned char *tmp = (__const__ unsigned char *) addr; |
288 | return (tmp[nr >> 3] >> (nr & 7)) & 1; | 288 | return (tmp[nr >> 3] >> (nr & 7)) & 1; |
289 | } | 289 | } |
290 | 290 | ||
291 | #define __set_le_bit(nr, addr) \ | 291 | static inline void __set_bit_le(int nr, void *addr) |
292 | __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) | 292 | { |
293 | #define __clear_le_bit(nr, addr) \ | 293 | __set_bit(nr ^ BITOP_LE_SWIZZLE, addr); |
294 | __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) | 294 | } |
295 | |||
296 | static inline void __clear_bit_le(int nr, void *addr) | ||
297 | { | ||
298 | __clear_bit(nr ^ BITOP_LE_SWIZZLE, addr); | ||
299 | } | ||
295 | 300 | ||
296 | #define test_and_set_le_bit(nr, addr) \ | 301 | static inline int test_and_set_bit_le(int nr, void *addr) |
297 | test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) | 302 | { |
298 | #define test_and_clear_le_bit(nr, addr) \ | 303 | return test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr); |
299 | test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) | 304 | } |
300 | 305 | ||
301 | #define __test_and_set_le_bit(nr, addr) \ | 306 | static inline int test_and_clear_bit_le(int nr, void *addr) |
302 | __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) | 307 | { |
303 | #define __test_and_clear_le_bit(nr, addr) \ | 308 | return test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr); |
304 | __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr)) | 309 | } |
310 | |||
311 | static inline int __test_and_set_bit_le(int nr, void *addr) | ||
312 | { | ||
313 | return __test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr); | ||
314 | } | ||
315 | |||
316 | static inline int __test_and_clear_bit_le(int nr, void *addr) | ||
317 | { | ||
318 | return __test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr); | ||
319 | } | ||
305 | 320 | ||
306 | #define find_first_zero_bit_le(addr, size) \ | 321 | #define find_first_zero_bit_le(addr, size) \ |
307 | find_next_zero_bit_le((addr), (size), 0) | 322 | find_next_zero_bit_le((addr), (size), 0) |
@@ -313,16 +328,16 @@ unsigned long find_next_bit_le(const void *addr, | |||
313 | /* Bitmap functions for the ext2 filesystem */ | 328 | /* Bitmap functions for the ext2 filesystem */ |
314 | 329 | ||
315 | #define ext2_set_bit(nr,addr) \ | 330 | #define ext2_set_bit(nr,addr) \ |
316 | __test_and_set_le_bit((nr), (unsigned long*)addr) | 331 | __test_and_set_bit_le((nr), (unsigned long*)addr) |
317 | #define ext2_clear_bit(nr, addr) \ | 332 | #define ext2_clear_bit(nr, addr) \ |
318 | __test_and_clear_le_bit((nr), (unsigned long*)addr) | 333 | __test_and_clear_bit_le((nr), (unsigned long*)addr) |
319 | 334 | ||
320 | #define ext2_set_bit_atomic(lock, nr, addr) \ | 335 | #define ext2_set_bit_atomic(lock, nr, addr) \ |
321 | test_and_set_le_bit((nr), (unsigned long*)addr) | 336 | test_and_set_bit_le((nr), (unsigned long*)addr) |
322 | #define ext2_clear_bit_atomic(lock, nr, addr) \ | 337 | #define ext2_clear_bit_atomic(lock, nr, addr) \ |
323 | test_and_clear_le_bit((nr), (unsigned long*)addr) | 338 | test_and_clear_bit_le((nr), (unsigned long*)addr) |
324 | 339 | ||
325 | #define ext2_test_bit(nr, addr) test_le_bit((nr),(unsigned long*)addr) | 340 | #define ext2_test_bit(nr, addr) test_bit_le((nr),(unsigned long*)addr) |
326 | 341 | ||
327 | #define ext2_find_first_zero_bit(addr, size) \ | 342 | #define ext2_find_first_zero_bit(addr, size) \ |
328 | find_first_zero_bit_le((unsigned long*)addr, size) | 343 | find_first_zero_bit_le((unsigned long*)addr, size) |
@@ -334,13 +349,13 @@ unsigned long find_next_bit_le(const void *addr, | |||
334 | /* Bitmap functions for the minix filesystem. */ | 349 | /* Bitmap functions for the minix filesystem. */ |
335 | 350 | ||
336 | #define minix_test_and_set_bit(nr,addr) \ | 351 | #define minix_test_and_set_bit(nr,addr) \ |
337 | __test_and_set_le_bit(nr, (unsigned long *)addr) | 352 | __test_and_set_bit_le(nr, (unsigned long *)addr) |
338 | #define minix_set_bit(nr,addr) \ | 353 | #define minix_set_bit(nr,addr) \ |
339 | __set_le_bit(nr, (unsigned long *)addr) | 354 | __set_bit_le(nr, (unsigned long *)addr) |
340 | #define minix_test_and_clear_bit(nr,addr) \ | 355 | #define minix_test_and_clear_bit(nr,addr) \ |
341 | __test_and_clear_le_bit(nr, (unsigned long *)addr) | 356 | __test_and_clear_bit_le(nr, (unsigned long *)addr) |
342 | #define minix_test_bit(nr,addr) \ | 357 | #define minix_test_bit(nr,addr) \ |
343 | test_le_bit(nr, (unsigned long *)addr) | 358 | test_bit_le(nr, (unsigned long *)addr) |
344 | 359 | ||
345 | #define minix_find_first_zero_bit(addr,size) \ | 360 | #define minix_find_first_zero_bit(addr,size) \ |
346 | find_first_zero_bit_le((unsigned long *)addr, size) | 361 | find_first_zero_bit_le((unsigned long *)addr, size) |