aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2011-05-26 19:26:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-26 20:12:38 -0400
commite0819410dba141338ebf6ab1057c1863be6247ab (patch)
treee8c744ce78d0c4333b976be5be8bafcdda88996c
parent275ac74629c4d8ec430d7edecb16d936f46a47c5 (diff)
m68knommu: fix build error due to the lack of find_next_bit_le()
m68knommu can't build ext4, udf, and ocfs2 due to the lack of find_next_bit_le(). This implements find_next_bit_le() on m68knommu by duplicating the generic find_next_bit_le() in lib/find_next_bit.c. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Acked-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/m68k/include/asm/bitops_no.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/arch/m68k/include/asm/bitops_no.h b/arch/m68k/include/asm/bitops_no.h
index 6b0e2d349f0e..b816299816ad 100644
--- a/arch/m68k/include/asm/bitops_no.h
+++ b/arch/m68k/include/asm/bitops_no.h
@@ -320,6 +320,50 @@ found_middle:
320 return result + ffz(__swab32(tmp)); 320 return result + ffz(__swab32(tmp));
321} 321}
322 322
323static inline unsigned long find_next_bit_le(const void *addr, unsigned
324 long size, unsigned long offset)
325{
326 const unsigned long *p = addr;
327 unsigned long result = offset & ~(BITS_PER_LONG - 1);
328 unsigned long tmp;
329
330 if (offset >= size)
331 return size;
332 p += offset / BITS_PER_LONG;
333 size -= result;
334 offset &= (BITS_PER_LONG - 1UL);
335 if (offset) {
336 tmp = __swab32(*(p++));
337 tmp &= (~0UL << offset);
338 if (size < BITS_PER_LONG)
339 goto found_first;
340 if (tmp)
341 goto found_middle;
342 size -= BITS_PER_LONG;
343 result += BITS_PER_LONG;
344 }
345
346 while (size & ~(BITS_PER_LONG - 1)) {
347 tmp = *(p++);
348 if (tmp)
349 goto found_middle_swap;
350 result += BITS_PER_LONG;
351 size -= BITS_PER_LONG;
352 }
353 if (!size)
354 return result;
355 tmp = __swab32(*p);
356found_first:
357 tmp &= (~0UL >> (BITS_PER_LONG - size));
358 if (tmp == 0UL) /* Are any bits set? */
359 return result + size; /* Nope. */
360found_middle:
361 return result + __ffs(tmp);
362
363found_middle_swap:
364 return result + __ffs(__swab32(tmp));
365}
366
323#endif /* __KERNEL__ */ 367#endif /* __KERNEL__ */
324 368
325#include <asm-generic/bitops/fls.h> 369#include <asm-generic/bitops/fls.h>