diff options
| -rw-r--r-- | arch/m68k/include/asm/bitops_no.h | 46 |
1 files changed, 2 insertions, 44 deletions
diff --git a/arch/m68k/include/asm/bitops_no.h b/arch/m68k/include/asm/bitops_no.h index 52793ebc4471..72e85acdd7bd 100644 --- a/arch/m68k/include/asm/bitops_no.h +++ b/arch/m68k/include/asm/bitops_no.h | |||
| @@ -321,50 +321,8 @@ found_middle: | |||
| 321 | } | 321 | } |
| 322 | #define find_next_zero_bit_le find_next_zero_bit_le | 322 | #define find_next_zero_bit_le find_next_zero_bit_le |
| 323 | 323 | ||
| 324 | static inline unsigned long find_next_bit_le(const void *addr, unsigned | 324 | extern unsigned long find_next_bit_le(const void *addr, |
| 325 | long size, unsigned long offset) | 325 | unsigned long size, unsigned long offset); |
| 326 | { | ||
| 327 | const unsigned long *p = addr; | ||
| 328 | unsigned long result = offset & ~(BITS_PER_LONG - 1); | ||
| 329 | unsigned long tmp; | ||
| 330 | |||
| 331 | if (offset >= size) | ||
| 332 | return size; | ||
| 333 | p += offset / BITS_PER_LONG; | ||
| 334 | size -= result; | ||
| 335 | offset &= (BITS_PER_LONG - 1UL); | ||
| 336 | if (offset) { | ||
| 337 | tmp = __swab32(*(p++)); | ||
| 338 | tmp &= (~0UL << offset); | ||
| 339 | if (size < BITS_PER_LONG) | ||
| 340 | goto found_first; | ||
| 341 | if (tmp) | ||
| 342 | goto found_middle; | ||
| 343 | size -= BITS_PER_LONG; | ||
| 344 | result += BITS_PER_LONG; | ||
| 345 | } | ||
| 346 | |||
| 347 | while (size & ~(BITS_PER_LONG - 1)) { | ||
| 348 | tmp = *(p++); | ||
| 349 | if (tmp) | ||
| 350 | goto found_middle_swap; | ||
| 351 | result += BITS_PER_LONG; | ||
| 352 | size -= BITS_PER_LONG; | ||
| 353 | } | ||
| 354 | if (!size) | ||
| 355 | return result; | ||
| 356 | tmp = __swab32(*p); | ||
| 357 | found_first: | ||
| 358 | tmp &= (~0UL >> (BITS_PER_LONG - size)); | ||
| 359 | if (tmp == 0UL) /* Are any bits set? */ | ||
| 360 | return result + size; /* Nope. */ | ||
| 361 | found_middle: | ||
| 362 | return result + __ffs(tmp); | ||
| 363 | |||
| 364 | found_middle_swap: | ||
| 365 | return result + __ffs(__swab32(tmp)); | ||
| 366 | } | ||
| 367 | #define find_next_bit_le find_next_bit_le | ||
| 368 | 326 | ||
| 369 | #endif /* __KERNEL__ */ | 327 | #endif /* __KERNEL__ */ |
| 370 | 328 | ||
