diff options
-rw-r--r-- | include/asm-generic/bitops/find.h | 4 | ||||
-rw-r--r-- | include/asm-generic/bitops/le.h | 7 | ||||
-rw-r--r-- | include/linux/bitops.h | 2 | ||||
-rw-r--r-- | lib/find_last_bit.c | 4 | ||||
-rw-r--r-- | lib/find_next_bit.c | 12 |
5 files changed, 29 insertions, 0 deletions
diff --git a/include/asm-generic/bitops/find.h b/include/asm-generic/bitops/find.h index 110fa700f853..71c778033f57 100644 --- a/include/asm-generic/bitops/find.h +++ b/include/asm-generic/bitops/find.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _ASM_GENERIC_BITOPS_FIND_H_ | 1 | #ifndef _ASM_GENERIC_BITOPS_FIND_H_ |
2 | #define _ASM_GENERIC_BITOPS_FIND_H_ | 2 | #define _ASM_GENERIC_BITOPS_FIND_H_ |
3 | 3 | ||
4 | #ifndef find_next_bit | ||
4 | /** | 5 | /** |
5 | * find_next_bit - find the next set bit in a memory region | 6 | * find_next_bit - find the next set bit in a memory region |
6 | * @addr: The address to base the search on | 7 | * @addr: The address to base the search on |
@@ -9,7 +10,9 @@ | |||
9 | */ | 10 | */ |
10 | extern unsigned long find_next_bit(const unsigned long *addr, unsigned long | 11 | extern unsigned long find_next_bit(const unsigned long *addr, unsigned long |
11 | size, unsigned long offset); | 12 | size, unsigned long offset); |
13 | #endif | ||
12 | 14 | ||
15 | #ifndef find_next_zero_bit | ||
13 | /** | 16 | /** |
14 | * find_next_zero_bit - find the next cleared bit in a memory region | 17 | * find_next_zero_bit - find the next cleared bit in a memory region |
15 | * @addr: The address to base the search on | 18 | * @addr: The address to base the search on |
@@ -18,6 +21,7 @@ extern unsigned long find_next_bit(const unsigned long *addr, unsigned long | |||
18 | */ | 21 | */ |
19 | extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned | 22 | extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned |
20 | long size, unsigned long offset); | 23 | long size, unsigned long offset); |
24 | #endif | ||
21 | 25 | ||
22 | #ifdef CONFIG_GENERIC_FIND_FIRST_BIT | 26 | #ifdef CONFIG_GENERIC_FIND_FIRST_BIT |
23 | 27 | ||
diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h index 946a21b1b5dc..f95c663a6a41 100644 --- a/include/asm-generic/bitops/le.h +++ b/include/asm-generic/bitops/le.h | |||
@@ -30,13 +30,20 @@ static inline unsigned long find_first_zero_bit_le(const void *addr, | |||
30 | 30 | ||
31 | #define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7) | 31 | #define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7) |
32 | 32 | ||
33 | #ifndef find_next_zero_bit_le | ||
33 | extern unsigned long find_next_zero_bit_le(const void *addr, | 34 | extern unsigned long find_next_zero_bit_le(const void *addr, |
34 | unsigned long size, unsigned long offset); | 35 | unsigned long size, unsigned long offset); |
36 | #endif | ||
37 | |||
38 | #ifndef find_next_bit_le | ||
35 | extern unsigned long find_next_bit_le(const void *addr, | 39 | extern unsigned long find_next_bit_le(const void *addr, |
36 | unsigned long size, unsigned long offset); | 40 | unsigned long size, unsigned long offset); |
41 | #endif | ||
37 | 42 | ||
43 | #ifndef find_first_zero_bit_le | ||
38 | #define find_first_zero_bit_le(addr, size) \ | 44 | #define find_first_zero_bit_le(addr, size) \ |
39 | find_next_zero_bit_le((addr), (size), 0) | 45 | find_next_zero_bit_le((addr), (size), 0) |
46 | #endif | ||
40 | 47 | ||
41 | #else | 48 | #else |
42 | #error "Please fix <asm/byteorder.h>" | 49 | #error "Please fix <asm/byteorder.h>" |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 2184c6b97aeb..4829252d7cfa 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -149,6 +149,7 @@ static inline unsigned long __ffs64(u64 word) | |||
149 | #ifdef __KERNEL__ | 149 | #ifdef __KERNEL__ |
150 | 150 | ||
151 | #ifdef CONFIG_GENERIC_FIND_LAST_BIT | 151 | #ifdef CONFIG_GENERIC_FIND_LAST_BIT |
152 | #ifndef find_last_bit | ||
152 | /** | 153 | /** |
153 | * find_last_bit - find the last set bit in a memory region | 154 | * find_last_bit - find the last set bit in a memory region |
154 | * @addr: The address to start the search at | 155 | * @addr: The address to start the search at |
@@ -158,6 +159,7 @@ static inline unsigned long __ffs64(u64 word) | |||
158 | */ | 159 | */ |
159 | extern unsigned long find_last_bit(const unsigned long *addr, | 160 | extern unsigned long find_last_bit(const unsigned long *addr, |
160 | unsigned long size); | 161 | unsigned long size); |
162 | #endif | ||
161 | #endif /* CONFIG_GENERIC_FIND_LAST_BIT */ | 163 | #endif /* CONFIG_GENERIC_FIND_LAST_BIT */ |
162 | 164 | ||
163 | #endif /* __KERNEL__ */ | 165 | #endif /* __KERNEL__ */ |
diff --git a/lib/find_last_bit.c b/lib/find_last_bit.c index 5d202e36bdd8..d903959ad695 100644 --- a/lib/find_last_bit.c +++ b/lib/find_last_bit.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <asm/types.h> | 15 | #include <asm/types.h> |
16 | #include <asm/byteorder.h> | 16 | #include <asm/byteorder.h> |
17 | 17 | ||
18 | #ifndef find_last_bit | ||
19 | |||
18 | unsigned long find_last_bit(const unsigned long *addr, unsigned long size) | 20 | unsigned long find_last_bit(const unsigned long *addr, unsigned long size) |
19 | { | 21 | { |
20 | unsigned long words; | 22 | unsigned long words; |
@@ -43,3 +45,5 @@ found: | |||
43 | return size; | 45 | return size; |
44 | } | 46 | } |
45 | EXPORT_SYMBOL(find_last_bit); | 47 | EXPORT_SYMBOL(find_last_bit); |
48 | |||
49 | #endif | ||
diff --git a/lib/find_next_bit.c b/lib/find_next_bit.c index b0a8767282bf..c02d09f37d58 100644 --- a/lib/find_next_bit.c +++ b/lib/find_next_bit.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) | 17 | #define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) |
18 | 18 | ||
19 | #ifdef CONFIG_GENERIC_FIND_NEXT_BIT | 19 | #ifdef CONFIG_GENERIC_FIND_NEXT_BIT |
20 | #ifndef find_next_bit | ||
20 | /* | 21 | /* |
21 | * Find the next set bit in a memory region. | 22 | * Find the next set bit in a memory region. |
22 | */ | 23 | */ |
@@ -59,7 +60,9 @@ found_middle: | |||
59 | return result + __ffs(tmp); | 60 | return result + __ffs(tmp); |
60 | } | 61 | } |
61 | EXPORT_SYMBOL(find_next_bit); | 62 | EXPORT_SYMBOL(find_next_bit); |
63 | #endif | ||
62 | 64 | ||
65 | #ifndef find_next_zero_bit | ||
63 | /* | 66 | /* |
64 | * This implementation of find_{first,next}_zero_bit was stolen from | 67 | * This implementation of find_{first,next}_zero_bit was stolen from |
65 | * Linus' asm-alpha/bitops.h. | 68 | * Linus' asm-alpha/bitops.h. |
@@ -103,9 +106,11 @@ found_middle: | |||
103 | return result + ffz(tmp); | 106 | return result + ffz(tmp); |
104 | } | 107 | } |
105 | EXPORT_SYMBOL(find_next_zero_bit); | 108 | EXPORT_SYMBOL(find_next_zero_bit); |
109 | #endif | ||
106 | #endif /* CONFIG_GENERIC_FIND_NEXT_BIT */ | 110 | #endif /* CONFIG_GENERIC_FIND_NEXT_BIT */ |
107 | 111 | ||
108 | #ifdef CONFIG_GENERIC_FIND_FIRST_BIT | 112 | #ifdef CONFIG_GENERIC_FIND_FIRST_BIT |
113 | #ifndef find_first_bit | ||
109 | /* | 114 | /* |
110 | * Find the first set bit in a memory region. | 115 | * Find the first set bit in a memory region. |
111 | */ | 116 | */ |
@@ -131,7 +136,9 @@ found: | |||
131 | return result + __ffs(tmp); | 136 | return result + __ffs(tmp); |
132 | } | 137 | } |
133 | EXPORT_SYMBOL(find_first_bit); | 138 | EXPORT_SYMBOL(find_first_bit); |
139 | #endif | ||
134 | 140 | ||
141 | #ifndef find_first_zero_bit | ||
135 | /* | 142 | /* |
136 | * Find the first cleared bit in a memory region. | 143 | * Find the first cleared bit in a memory region. |
137 | */ | 144 | */ |
@@ -157,6 +164,7 @@ found: | |||
157 | return result + ffz(tmp); | 164 | return result + ffz(tmp); |
158 | } | 165 | } |
159 | EXPORT_SYMBOL(find_first_zero_bit); | 166 | EXPORT_SYMBOL(find_first_zero_bit); |
167 | #endif | ||
160 | #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ | 168 | #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ |
161 | 169 | ||
162 | #ifdef __BIG_ENDIAN | 170 | #ifdef __BIG_ENDIAN |
@@ -186,6 +194,7 @@ static inline unsigned long ext2_swab(const unsigned long y) | |||
186 | #endif | 194 | #endif |
187 | } | 195 | } |
188 | 196 | ||
197 | #ifndef find_next_zero_bit_le | ||
189 | unsigned long find_next_zero_bit_le(const void *addr, unsigned | 198 | unsigned long find_next_zero_bit_le(const void *addr, unsigned |
190 | long size, unsigned long offset) | 199 | long size, unsigned long offset) |
191 | { | 200 | { |
@@ -229,7 +238,9 @@ found_middle_swap: | |||
229 | return result + ffz(ext2_swab(tmp)); | 238 | return result + ffz(ext2_swab(tmp)); |
230 | } | 239 | } |
231 | EXPORT_SYMBOL(find_next_zero_bit_le); | 240 | EXPORT_SYMBOL(find_next_zero_bit_le); |
241 | #endif | ||
232 | 242 | ||
243 | #ifndef find_next_bit_le | ||
233 | unsigned long find_next_bit_le(const void *addr, unsigned | 244 | unsigned long find_next_bit_le(const void *addr, unsigned |
234 | long size, unsigned long offset) | 245 | long size, unsigned long offset) |
235 | { | 246 | { |
@@ -274,6 +285,7 @@ found_middle_swap: | |||
274 | return result + __ffs(ext2_swab(tmp)); | 285 | return result + __ffs(ext2_swab(tmp)); |
275 | } | 286 | } |
276 | EXPORT_SYMBOL(find_next_bit_le); | 287 | EXPORT_SYMBOL(find_next_bit_le); |
288 | #endif | ||
277 | 289 | ||
278 | #endif /* CONFIG_GENERIC_FIND_BIT_LE */ | 290 | #endif /* CONFIG_GENERIC_FIND_BIT_LE */ |
279 | #endif /* __BIG_ENDIAN */ | 291 | #endif /* __BIG_ENDIAN */ |