[PATCH 21/22] m68k: convert minix bitops to use little endian bitops

Akinobu Mita
2010-10-15T09:46:20Z

The inode and block bitmap for minix filesystem is little endian
byte order on m68k. This converts them to use little endian bit
operations.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
---
arch/m68k/include/asm/bitops_mm.h | 38 ++++++++----------------------------
1 files changed, 9 insertions(+), 29 deletions(-)

diff --git a/arch/m68k/include/asm/bitops_mm.h b/arch/m68k/include/asm/bitops_mm.h
index e2cc3be..2451f7f 100644
--- a/arch/m68k/include/asm/bitops_mm.h
+++ b/arch/m68k/include/asm/bitops_mm.h
@@ -327,37 +327,17 @@ static inline int __fls(int x)

/* Bitmap functions for the minix filesystem */

-static inline int minix_find_first_zero_bit(const void *vaddr, unsigned size)
-{
- const unsigned short *p = vaddr, *addr = vaddr;
- int res;
- unsigned short num;
-
- if (!size)
- return 0;
-
- size = (size >> 4) + ((size & 15) > 0);
- while (*p++ == 0xffff)
- {
- if (--size == 0)
- return (p - addr) << 4;
- }
+#define minix_find_first_zero_bit(vaddr, size) \
+ find_first_zero_le_bit(vaddr, (size))

- num = ~*--p;
- __asm__ __volatile__ ("bfffo %1{#16,#16},%0"
- : "=d" (res) : "d" (num & -num));
- return ((p - addr) << 4) + (res ^ 31);
-}
+#define minix_test_and_set_bit(nr, addr) \
+ __test_and_set_le_bit((nr), (unsigned long *)(addr))
+#define minix_set_bit(nr, addr) \
+ __set_le_bit((nr), (unsigned long *)(addr))
+#define minix_test_and_clear_bit(nr, addr) \
+ __test_and_clear_le_bit((nr), (unsigned long *)(addr))

-#define minix_test_and_set_bit(nr, addr) __test_and_set_bit((nr) ^ 16, (unsigned long *)(addr))
-#define minix_set_bit(nr,addr) __set_bit((nr) ^ 16, (unsigned long *)(addr))
-#define minix_test_and_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 16, (unsigned long *)(addr))
-
-static inline int minix_test_bit(int nr, const void *vaddr)
-{
- const unsigned short *p = vaddr;
- return (p[nr >> 4] & (1U << (nr & 15))) != 0;
-}
+#define minix_test_bit(nr, addr) test_le_bit(nr, addr)

/* Bitmap functions for little endian. */

--
1.7.1.231.gd0b16