Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Akinobu Mita and committed by
Linus Torvalds
f33e2fba a58259cd

+9 -35
+4
arch/x86_64/Kconfig
··· 45 45 config RWSEM_XCHGADD_ALGORITHM 46 46 bool 47 47 48 + config GENERIC_HWEIGHT 49 + bool 50 + default y 51 + 48 52 config GENERIC_CALIBRATE_DELAY 49 53 bool 50 54 default y
+5 -35
include/asm-x86_64/bitops.h
··· 356 356 357 357 #ifdef __KERNEL__ 358 358 359 - static inline int sched_find_first_bit(const unsigned long *b) 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 - } 359 + #include <asm-generic/bitops/sched.h> 367 360 368 361 /** 369 362 * ffs - find first bit set ··· 405 412 return r+1; 406 413 } 407 414 408 - /** 409 - * hweightN - returns the hamming weight of a N-bit word 410 - * @x: the word to weigh 411 - * 412 - * The Hamming Weight of a number is the total number of bits set in it. 413 - */ 414 - 415 - #define hweight64(x) generic_hweight64(x) 416 - #define hweight32(x) generic_hweight32(x) 417 - #define hweight16(x) generic_hweight16(x) 418 - #define hweight8(x) generic_hweight8(x) 415 + #include <asm-generic/bitops/hweight.h> 419 416 420 417 #endif /* __KERNEL__ */ 421 418 422 419 #ifdef __KERNEL__ 423 420 424 - #define ext2_set_bit(nr,addr) \ 425 - __test_and_set_bit((nr),(unsigned long*)addr) 421 + #include <asm-generic/bitops/ext2-non-atomic.h> 422 + 426 423 #define ext2_set_bit_atomic(lock,nr,addr) \ 427 424 test_and_set_bit((nr),(unsigned long*)addr) 428 - #define ext2_clear_bit(nr, addr) \ 429 - __test_and_clear_bit((nr),(unsigned long*)addr) 430 425 #define ext2_clear_bit_atomic(lock,nr,addr) \ 431 426 test_and_clear_bit((nr),(unsigned long*)addr) 432 - #define ext2_test_bit(nr, addr) test_bit((nr),(unsigned long*)addr) 433 - #define ext2_find_first_zero_bit(addr, size) \ 434 - find_first_zero_bit((unsigned long*)addr, size) 435 - #define ext2_find_next_zero_bit(addr, size, off) \ 436 - find_next_zero_bit((unsigned long*)addr, size, off) 437 427 438 - /* Bitmap functions for the minix filesystem. */ 439 - #define minix_test_and_set_bit(nr,addr) __test_and_set_bit(nr,(void*)addr) 440 - #define minix_set_bit(nr,addr) __set_bit(nr,(void*)addr) 441 - #define minix_test_and_clear_bit(nr,addr) __test_and_clear_bit(nr,(void*)addr) 442 - #define minix_test_bit(nr,addr) test_bit(nr,(void*)addr) 443 - #define minix_find_first_zero_bit(addr,size) \ 444 - find_first_zero_bit((void*)addr,size) 428 + #include <asm-generic/bitops/minix.h> 445 429 446 430 #endif /* __KERNEL__ */ 447 431