bitops: make asm-generic/bitops/find.h more generic

asm-generic/bitops/find.h has the extern declarations of find_next_bit()
and find_next_zero_bit() and the macro definitions of find_first_bit()
and find_first_zero_bit(). It is only usable by the architectures which
enables CONFIG_GENERIC_FIND_NEXT_BIT and disables
CONFIG_GENERIC_FIND_FIRST_BIT.

x86 and tile enable both CONFIG_GENERIC_FIND_NEXT_BIT and
CONFIG_GENERIC_FIND_FIRST_BIT. These architectures cannot include
asm-generic/bitops/find.h in their asm/bitops.h. So ifdefed extern
declarations of find_first_bit and find_first_zero_bit() are put in
linux/bitops.h.

This makes asm-generic/bitops/find.h usable by these architectures
and use it. Also this change is needed for the forthcoming duplicated
extern declarations cleanup.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Chris Metcalf <cmetcalf@tilera.com>

authored by Akinobu Mita and committed by Arnd Bergmann 708ff2a0 c24cef0b

+28 -22
+1
arch/tile/include/asm/bitops.h
··· 120 121 #include <asm-generic/bitops/const_hweight.h> 122 #include <asm-generic/bitops/lock.h> 123 #include <asm-generic/bitops/sched.h> 124 #include <asm-generic/bitops/ext2-non-atomic.h> 125 #include <asm-generic/bitops/minix.h>
··· 120 121 #include <asm-generic/bitops/const_hweight.h> 122 #include <asm-generic/bitops/lock.h> 123 + #include <asm-generic/bitops/find.h> 124 #include <asm-generic/bitops/sched.h> 125 #include <asm-generic/bitops/ext2-non-atomic.h> 126 #include <asm-generic/bitops/minix.h>
+2
arch/x86/include/asm/bitops.h
··· 440 441 #ifdef __KERNEL__ 442 443 #include <asm-generic/bitops/sched.h> 444 445 #define ARCH_HAS_FAST_MULTIPLIER 1
··· 440 441 #ifdef __KERNEL__ 442 443 + #include <asm-generic/bitops/find.h> 444 + 445 #include <asm-generic/bitops/sched.h> 446 447 #define ARCH_HAS_FAST_MULTIPLIER 1
+25
include/asm-generic/bitops/find.h
··· 9 long size, unsigned long offset); 10 #endif 11 12 #define find_first_bit(addr, size) find_next_bit((addr), (size), 0) 13 #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) 14 15 #endif /*_ASM_GENERIC_BITOPS_FIND_H_ */
··· 9 long size, unsigned long offset); 10 #endif 11 12 + #ifdef CONFIG_GENERIC_FIND_FIRST_BIT 13 + 14 + /** 15 + * find_first_bit - find the first set bit in a memory region 16 + * @addr: The address to start the search at 17 + * @size: The maximum size to search 18 + * 19 + * Returns the bit number of the first set bit. 20 + */ 21 + extern unsigned long find_first_bit(const unsigned long *addr, 22 + unsigned long size); 23 + 24 + /** 25 + * find_first_zero_bit - find the first cleared bit in a memory region 26 + * @addr: The address to start the search at 27 + * @size: The maximum size to search 28 + * 29 + * Returns the bit number of the first cleared bit. 30 + */ 31 + extern unsigned long find_first_zero_bit(const unsigned long *addr, 32 + unsigned long size); 33 + #else /* CONFIG_GENERIC_FIND_FIRST_BIT */ 34 + 35 #define find_first_bit(addr, size) find_next_bit((addr), (size), 0) 36 #define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) 37 + 38 + #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ 39 40 #endif /*_ASM_GENERIC_BITOPS_FIND_H_ */
-22
include/linux/bitops.h
··· 136 } 137 138 #ifdef __KERNEL__ 139 - #ifdef CONFIG_GENERIC_FIND_FIRST_BIT 140 - 141 - /** 142 - * find_first_bit - find the first set bit in a memory region 143 - * @addr: The address to start the search at 144 - * @size: The maximum size to search 145 - * 146 - * Returns the bit number of the first set bit. 147 - */ 148 - extern unsigned long find_first_bit(const unsigned long *addr, 149 - unsigned long size); 150 - 151 - /** 152 - * find_first_zero_bit - find the first cleared bit in a memory region 153 - * @addr: The address to start the search at 154 - * @size: The maximum size to search 155 - * 156 - * Returns the bit number of the first cleared bit. 157 - */ 158 - extern unsigned long find_first_zero_bit(const unsigned long *addr, 159 - unsigned long size); 160 - #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ 161 162 #ifdef CONFIG_GENERIC_FIND_LAST_BIT 163 /**
··· 136 } 137 138 #ifdef __KERNEL__ 139 140 #ifdef CONFIG_GENERIC_FIND_LAST_BIT 141 /**