aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkinobu Mita <mita@miraclelinux.com>2006-03-26 04:39:24 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:57:12 -0500
commit1cc2b9943b7b3a8d526aa8be5450d3ec083c3de4 (patch)
tree302d864d0f11c9fb1ec747440b0fce7f9f3ca27e
parentf6e0213f7c253086e17844df8ba21075100b5ead (diff)
[PATCH] bitops: i386: use generic bitops
- remove generic_fls64() - remove sched_find_first_bit() - remove generic_hweight{32,16,8}() - remove ext2_{set,clear,test,find_first_zero,find_next_zero}_bit() - remove minix_{test,set,test_and_clear,test,find_first_zero}_bit() Signed-off-by: Akinobu Mita <mita@miraclelinux.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/i386/Kconfig4
-rw-r--r--include/asm-i386/bitops.h55
2 files changed, 12 insertions, 47 deletions
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index b008fb0cd7b7..f7db71d0b913 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -37,6 +37,10 @@ config GENERIC_IOMAP
37 bool 37 bool
38 default y 38 default y
39 39
40config GENERIC_HWEIGHT
41 bool
42 default y
43
40config ARCH_MAY_HAVE_PC_FDC 44config ARCH_MAY_HAVE_PC_FDC
41 bool 45 bool
42 default y 46 default y
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h
index 7d20b95edb3b..08deaeee6be9 100644
--- a/include/asm-i386/bitops.h
+++ b/include/asm-i386/bitops.h
@@ -362,28 +362,9 @@ static inline unsigned long ffz(unsigned long word)
362 return word; 362 return word;
363} 363}
364 364
365#define fls64(x) generic_fls64(x)
366
367#ifdef __KERNEL__ 365#ifdef __KERNEL__
368 366
369/* 367#include <asm-generic/bitops/sched.h>
370 * Every architecture must define this function. It's the fastest
371 * way of searching a 140-bit bitmap where the first 100 bits are
372 * unlikely to be set. It's guaranteed that at least one of the 140
373 * bits is cleared.
374 */
375static inline int sched_find_first_bit(const unsigned long *b)
376{
377 if (unlikely(b[0]))
378 return __ffs(b[0]);
379 if (unlikely(b[1]))
380 return __ffs(b[1]) + 32;
381 if (unlikely(b[2]))
382 return __ffs(b[2]) + 64;
383 if (b[3])
384 return __ffs(b[3]) + 96;
385 return __ffs(b[4]) + 128;
386}
387 368
388/** 369/**
389 * ffs - find first bit set 370 * ffs - find first bit set
@@ -421,42 +402,22 @@ static inline int fls(int x)
421 return r+1; 402 return r+1;
422} 403}
423 404
424/** 405#include <asm-generic/bitops/hweight.h>
425 * hweightN - returns the hamming weight of a N-bit word
426 * @x: the word to weigh
427 *
428 * The Hamming Weight of a number is the total number of bits set in it.
429 */
430
431#define hweight32(x) generic_hweight32(x)
432#define hweight16(x) generic_hweight16(x)
433#define hweight8(x) generic_hweight8(x)
434 406
435#endif /* __KERNEL__ */ 407#endif /* __KERNEL__ */
436 408
409#include <asm-generic/bitops/fls64.h>
410
437#ifdef __KERNEL__ 411#ifdef __KERNEL__
438 412
439#define ext2_set_bit(nr,addr) \ 413#include <asm-generic/bitops/ext2-non-atomic.h>
440 __test_and_set_bit((nr),(unsigned long*)addr) 414
441#define ext2_set_bit_atomic(lock,nr,addr) \ 415#define ext2_set_bit_atomic(lock,nr,addr) \
442 test_and_set_bit((nr),(unsigned long*)addr) 416 test_and_set_bit((nr),(unsigned long*)addr)
443#define ext2_clear_bit(nr, addr) \
444 __test_and_clear_bit((nr),(unsigned long*)addr)
445#define ext2_clear_bit_atomic(lock,nr, addr) \ 417#define ext2_clear_bit_atomic(lock,nr, addr) \
446 test_and_clear_bit((nr),(unsigned long*)addr) 418 test_and_clear_bit((nr),(unsigned long*)addr)
447#define ext2_test_bit(nr, addr) test_bit((nr),(unsigned long*)addr) 419
448#define ext2_find_first_zero_bit(addr, size) \ 420#include <asm-generic/bitops/minix.h>
449 find_first_zero_bit((unsigned long*)addr, size)
450#define ext2_find_next_zero_bit(addr, size, off) \
451 find_next_zero_bit((unsigned long*)addr, size, off)
452
453/* Bitmap functions for the minix filesystem. */
454#define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,(void*)addr)
455#define minix_set_bit(nr,addr) __set_bit(nr,(void*)addr)
456#define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,(void*)addr)
457#define minix_test_bit(nr,addr) test_bit(nr,(void*)addr)
458#define minix_find_first_zero_bit(addr,size) \
459 find_first_zero_bit((void*)addr,size)
460 421
461#endif /* __KERNEL__ */ 422#endif /* __KERNEL__ */
462 423