diff options
author | Akinobu Mita <mita@miraclelinux.com> | 2006-03-26 04:39:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-26 11:57:14 -0500 |
commit | f33e2fbacce8008984db99c45120db31081577c5 (patch) | |
tree | 762b2bdbbc10e36cca280ed06710d7a4964fba88 | |
parent | a58259cddf9f824af27abf8960ed604bee53f7c1 (diff) |
[PATCH] bitops: x86_64: use generic bitops
- remove sched_find_first_bit()
- remove generic_hweight{64,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>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/x86_64/Kconfig | 4 | ||||
-rw-r--r-- | include/asm-x86_64/bitops.h | 42 |
2 files changed, 10 insertions, 36 deletions
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index 6420baeb8c1f..45efe0ca88f8 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig | |||
@@ -45,6 +45,10 @@ config RWSEM_GENERIC_SPINLOCK | |||
45 | config RWSEM_XCHGADD_ALGORITHM | 45 | config RWSEM_XCHGADD_ALGORITHM |
46 | bool | 46 | bool |
47 | 47 | ||
48 | config GENERIC_HWEIGHT | ||
49 | bool | ||
50 | default y | ||
51 | |||
48 | config GENERIC_CALIBRATE_DELAY | 52 | config GENERIC_CALIBRATE_DELAY |
49 | bool | 53 | bool |
50 | default y | 54 | default y |
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h index eb4df23e1e41..79212128d0f7 100644 --- a/include/asm-x86_64/bitops.h +++ b/include/asm-x86_64/bitops.h | |||
@@ -356,14 +356,7 @@ static __inline__ unsigned long __fls(unsigned long word) | |||
356 | 356 | ||
357 | #ifdef __KERNEL__ | 357 | #ifdef __KERNEL__ |
358 | 358 | ||
359 | static inline int sched_find_first_bit(const unsigned long *b) | 359 | #include <asm-generic/bitops/sched.h> |
360 | { | ||
361 | if (b[0]) | ||
362 | return __ffs(b[0]); | ||
363 | if (b[1]) | ||
364 | return __ffs(b[1]) + 64; | ||
365 | return __ffs(b[2]) + 128; | ||
366 | } | ||
367 | 360 | ||
368 | /** | 361 | /** |
369 | * ffs - find first bit set | 362 | * ffs - find first bit set |
@@ -412,43 +405,20 @@ static __inline__ int fls(int x) | |||
412 | return r+1; | 405 | return r+1; |
413 | } | 406 | } |
414 | 407 | ||
415 | /** | 408 | #include <asm-generic/bitops/hweight.h> |
416 | * hweightN - returns the hamming weight of a N-bit word | ||
417 | * @x: the word to weigh | ||
418 | * | ||
419 | * The Hamming Weight of a number is the total number of bits set in it. | ||
420 | */ | ||
421 | |||
422 | #define hweight64(x) generic_hweight64(x) | ||
423 | #define hweight32(x) generic_hweight32(x) | ||
424 | #define hweight16(x) generic_hweight16(x) | ||
425 | #define hweight8(x) generic_hweight8(x) | ||
426 | 409 | ||
427 | #endif /* __KERNEL__ */ | 410 | #endif /* __KERNEL__ */ |
428 | 411 | ||
429 | #ifdef __KERNEL__ | 412 | #ifdef __KERNEL__ |
430 | 413 | ||
431 | #define ext2_set_bit(nr,addr) \ | 414 | #include <asm-generic/bitops/ext2-non-atomic.h> |
432 | __test_and_set_bit((nr),(unsigned long*)addr) | 415 | |
433 | #define ext2_set_bit_atomic(lock,nr,addr) \ | 416 | #define ext2_set_bit_atomic(lock,nr,addr) \ |
434 | test_and_set_bit((nr),(unsigned long*)addr) | 417 | test_and_set_bit((nr),(unsigned long*)addr) |
435 | #define ext2_clear_bit(nr, addr) \ | ||
436 | __test_and_clear_bit((nr),(unsigned long*)addr) | ||
437 | #define ext2_clear_bit_atomic(lock,nr,addr) \ | 418 | #define ext2_clear_bit_atomic(lock,nr,addr) \ |
438 | test_and_clear_bit((nr),(unsigned long*)addr) | 419 | test_and_clear_bit((nr),(unsigned long*)addr) |
439 | #define ext2_test_bit(nr, addr) test_bit((nr),(unsigned long*)addr) | 420 | |
440 | #define ext2_find_first_zero_bit(addr, size) \ | 421 | #include <asm-generic/bitops/minix.h> |
441 | find_first_zero_bit((unsigned long*)addr, size) | ||
442 | #define ext2_find_next_zero_bit(addr, size, off) \ | ||
443 | find_next_zero_bit((unsigned long*)addr, size, off) | ||
444 | |||
445 | /* Bitmap functions for the minix filesystem. */ | ||
446 | #define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,(void*)addr) | ||
447 | #define minix_set_bit(nr,addr) __set_bit(nr,(void*)addr) | ||
448 | #define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,(void*)addr) | ||
449 | #define minix_test_bit(nr,addr) test_bit(nr,(void*)addr) | ||
450 | #define minix_find_first_zero_bit(addr,size) \ | ||
451 | find_first_zero_bit((void*)addr,size) | ||
452 | 422 | ||
453 | #endif /* __KERNEL__ */ | 423 | #endif /* __KERNEL__ */ |
454 | 424 | ||