Commit c1e6ca7a authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds

m68knommu: introduce little-endian bitops

Introduce little-endian bit operations by renaming native ext2 bit
operations.  The ext2 bit operations are kept as wrapper macros using
little-endian bit operations to maintain bisectability until the
conversions are finished.
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Acked-by: default avatarGreg Ungerer <gerg@uclinux.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Andreas Schwab <schwab@linux-m68k.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0664996b
...@@ -196,7 +196,19 @@ static __inline__ int __test_bit(int nr, const volatile unsigned long * addr) ...@@ -196,7 +196,19 @@ static __inline__ int __test_bit(int nr, const volatile unsigned long * addr)
#include <asm-generic/bitops/hweight.h> #include <asm-generic/bitops/hweight.h>
#include <asm-generic/bitops/lock.h> #include <asm-generic/bitops/lock.h>
static __inline__ int ext2_set_bit(int nr, volatile void * addr) #define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
static inline void __set_bit_le(int nr, void *addr)
{
__set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
}
static inline void __clear_bit_le(int nr, void *addr)
{
__clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
}
static inline int __test_and_set_bit_le(int nr, volatile void *addr)
{ {
char retval; char retval;
...@@ -215,7 +227,7 @@ static __inline__ int ext2_set_bit(int nr, volatile void * addr) ...@@ -215,7 +227,7 @@ static __inline__ int ext2_set_bit(int nr, volatile void * addr)
return retval; return retval;
} }
static __inline__ int ext2_clear_bit(int nr, volatile void * addr) static inline int __test_and_clear_bit_le(int nr, volatile void *addr)
{ {
char retval; char retval;
...@@ -238,7 +250,7 @@ static __inline__ int ext2_clear_bit(int nr, volatile void * addr) ...@@ -238,7 +250,7 @@ static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
({ \ ({ \
int ret; \ int ret; \
spin_lock(lock); \ spin_lock(lock); \
ret = ext2_set_bit((nr), (addr)); \ ret = __test_and_set_bit_le((nr), (addr)); \
spin_unlock(lock); \ spin_unlock(lock); \
ret; \ ret; \
}) })
...@@ -247,12 +259,12 @@ static __inline__ int ext2_clear_bit(int nr, volatile void * addr) ...@@ -247,12 +259,12 @@ static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
({ \ ({ \
int ret; \ int ret; \
spin_lock(lock); \ spin_lock(lock); \
ret = ext2_clear_bit((nr), (addr)); \ ret = __test_and_clear_bit_le((nr), (addr)); \
spin_unlock(lock); \ spin_unlock(lock); \
ret; \ ret; \
}) })
static __inline__ int ext2_test_bit(int nr, const volatile void * addr) static inline int test_bit_le(int nr, const volatile void *addr)
{ {
char retval; char retval;
...@@ -271,10 +283,10 @@ static __inline__ int ext2_test_bit(int nr, const volatile void * addr) ...@@ -271,10 +283,10 @@ static __inline__ int ext2_test_bit(int nr, const volatile void * addr)
return retval; return retval;
} }
#define ext2_find_first_zero_bit(addr, size) \ #define find_first_zero_bit_le(addr, size) \
ext2_find_next_zero_bit((addr), (size), 0) find_next_zero_bit_le((addr), (size), 0)
static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset) static inline unsigned long find_next_zero_bit_le(void *addr, unsigned long size, unsigned long offset)
{ {
unsigned long *p = ((unsigned long *) addr) + (offset >> 5); unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
unsigned long result = offset & ~31UL; unsigned long result = offset & ~31UL;
...@@ -324,8 +336,13 @@ static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned lon ...@@ -324,8 +336,13 @@ static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned lon
return result + ffz(__swab32(tmp)); return result + ffz(__swab32(tmp));
} }
#define ext2_find_next_bit(addr, size, off) \ #define ext2_set_bit __test_and_set_bit_le
find_next_bit_le((unsigned long *)(addr), (size), (off)) #define ext2_clear_bit __test_and_clear_bit_le
#define ext2_test_bit test_bit_le
#define ext2_find_first_zero_bit find_first_zero_bit_le
#define ext2_find_next_zero_bit find_next_zero_bit_le
#define ext2_find_next_bit find_next_bit_le
#include <asm-generic/bitops/minix.h> #include <asm-generic/bitops/minix.h>
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
...@@ -42,10 +42,6 @@ config GENERIC_FIND_NEXT_BIT ...@@ -42,10 +42,6 @@ config GENERIC_FIND_NEXT_BIT
bool bool
default y default y
config GENERIC_FIND_BIT_LE
bool
default y
config GENERIC_GPIO config GENERIC_GPIO
bool bool
default n default n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment