aboutsummaryrefslogtreecommitdiff
path: root/arch/m68k
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2011-05-26 16:26:05 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-26 17:12:38 -0700
commite0819410dba141338ebf6ab1057c1863be6247ab (patch)
treee8c744ce78d0c4333b976be5be8bafcdda88996c /arch/m68k
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>
Diffstat (limited to 'arch/m68k')
-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 6b0e2d349f0..b816299816a 100644
--- a/arch/m68k/include/asm/bitops_no.h
+++ b/arch/m68k/include/asm/bitops_no.h
@@ -320,6 +320,50 @@ found_middle:
return result + ffz(__swab32(tmp));
}
+static inline unsigned long find_next_bit_le(const void *addr, unsigned
+ long size, unsigned long offset)
+{
+ const unsigned long *p = addr;
+ unsigned long result = offset & ~(BITS_PER_LONG - 1);
+ unsigned long tmp;
+
+ if (offset >= size)
+ return size;
+ p += offset / BITS_PER_LONG;
+ size -= result;
+ offset &= (BITS_PER_LONG - 1UL);
+ if (offset) {
+ tmp = __swab32(*(p++));
+ tmp &= (~0UL << offset);
+ if (size < BITS_PER_LONG)
+ goto found_first;
+ if (tmp)
+ goto found_middle;
+ size -= BITS_PER_LONG;
+ result += BITS_PER_LONG;
+ }
+
+ while (size & ~(BITS_PER_LONG - 1)) {
+ tmp = *(p++);
+ if (tmp)
+ goto found_middle_swap;
+ result += BITS_PER_LONG;
+ size -= BITS_PER_LONG;
+ }
+ if (!size)
+ return result;
+ tmp = __swab32(*p);
+found_first:
+ tmp &= (~0UL >> (BITS_PER_LONG - size));
+ if (tmp == 0UL) /* Are any bits set? */
+ return result + size; /* Nope. */
+found_middle:
+ return result + __ffs(tmp);
+
+found_middle_swap:
+ return result + __ffs(__swab32(tmp));
+}
+
#endif /* __KERNEL__ */
#include <asm-generic/bitops/fls.h>