diff options
Diffstat (limited to 'lib/find_next_bit.c')
-rw-r--r-- | lib/find_next_bit.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/find_next_bit.c b/lib/find_next_bit.c index 24c59ded47a0..b0a8767282bf 100644 --- a/lib/find_next_bit.c +++ b/lib/find_next_bit.c | |||
@@ -160,6 +160,7 @@ EXPORT_SYMBOL(find_first_zero_bit); | |||
160 | #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ | 160 | #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ |
161 | 161 | ||
162 | #ifdef __BIG_ENDIAN | 162 | #ifdef __BIG_ENDIAN |
163 | #ifdef CONFIG_GENERIC_FIND_BIT_LE | ||
163 | 164 | ||
164 | /* include/linux/byteorder does not support "unsigned long" type */ | 165 | /* include/linux/byteorder does not support "unsigned long" type */ |
165 | static inline unsigned long ext2_swabp(const unsigned long * x) | 166 | static inline unsigned long ext2_swabp(const unsigned long * x) |
@@ -185,15 +186,16 @@ static inline unsigned long ext2_swab(const unsigned long y) | |||
185 | #endif | 186 | #endif |
186 | } | 187 | } |
187 | 188 | ||
188 | unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, unsigned | 189 | unsigned long find_next_zero_bit_le(const void *addr, unsigned |
189 | long size, unsigned long offset) | 190 | long size, unsigned long offset) |
190 | { | 191 | { |
191 | const unsigned long *p = addr + BITOP_WORD(offset); | 192 | const unsigned long *p = addr; |
192 | unsigned long result = offset & ~(BITS_PER_LONG - 1); | 193 | unsigned long result = offset & ~(BITS_PER_LONG - 1); |
193 | unsigned long tmp; | 194 | unsigned long tmp; |
194 | 195 | ||
195 | if (offset >= size) | 196 | if (offset >= size) |
196 | return size; | 197 | return size; |
198 | p += BITOP_WORD(offset); | ||
197 | size -= result; | 199 | size -= result; |
198 | offset &= (BITS_PER_LONG - 1UL); | 200 | offset &= (BITS_PER_LONG - 1UL); |
199 | if (offset) { | 201 | if (offset) { |
@@ -226,18 +228,18 @@ found_middle: | |||
226 | found_middle_swap: | 228 | found_middle_swap: |
227 | return result + ffz(ext2_swab(tmp)); | 229 | return result + ffz(ext2_swab(tmp)); |
228 | } | 230 | } |
231 | EXPORT_SYMBOL(find_next_zero_bit_le); | ||
229 | 232 | ||
230 | EXPORT_SYMBOL(generic_find_next_zero_le_bit); | 233 | unsigned long find_next_bit_le(const void *addr, unsigned |
231 | |||
232 | unsigned long generic_find_next_le_bit(const unsigned long *addr, unsigned | ||
233 | long size, unsigned long offset) | 234 | long size, unsigned long offset) |
234 | { | 235 | { |
235 | const unsigned long *p = addr + BITOP_WORD(offset); | 236 | const unsigned long *p = addr; |
236 | unsigned long result = offset & ~(BITS_PER_LONG - 1); | 237 | unsigned long result = offset & ~(BITS_PER_LONG - 1); |
237 | unsigned long tmp; | 238 | unsigned long tmp; |
238 | 239 | ||
239 | if (offset >= size) | 240 | if (offset >= size) |
240 | return size; | 241 | return size; |
242 | p += BITOP_WORD(offset); | ||
241 | size -= result; | 243 | size -= result; |
242 | offset &= (BITS_PER_LONG - 1UL); | 244 | offset &= (BITS_PER_LONG - 1UL); |
243 | if (offset) { | 245 | if (offset) { |
@@ -271,5 +273,7 @@ found_middle: | |||
271 | found_middle_swap: | 273 | found_middle_swap: |
272 | return result + __ffs(ext2_swab(tmp)); | 274 | return result + __ffs(ext2_swab(tmp)); |
273 | } | 275 | } |
274 | EXPORT_SYMBOL(generic_find_next_le_bit); | 276 | EXPORT_SYMBOL(find_next_bit_le); |
277 | |||
278 | #endif /* CONFIG_GENERIC_FIND_BIT_LE */ | ||
275 | #endif /* __BIG_ENDIAN */ | 279 | #endif /* __BIG_ENDIAN */ |