aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2011-03-23 19:42:00 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-23 22:46:14 -0400
commitc1e6ca7a501f0139e5ec2a01f8420eeb21c97a52 (patch)
tree538f5424eedda1039dec6d6cc5f81cbee16e2e1b /arch
parent0664996b7c2fdb1b7f90954469cc242274abd7db (diff)
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: Akinobu Mita <akinobu.mita@gmail.com> Acked-by: Greg 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/m68k/include/asm/bitops_no.h37
-rw-r--r--arch/m68knommu/Kconfig4
2 files changed, 27 insertions, 14 deletions
diff --git a/arch/m68k/include/asm/bitops_no.h b/arch/m68k/include/asm/bitops_no.h
index 58c67aaf91e2..74b3f81f2e21 100644
--- a/arch/m68k/include/asm/bitops_no.h
+++ b/arch/m68k/include/asm/bitops_no.h
@@ -196,7 +196,19 @@ static __inline__ int __test_bit(int nr, const volatile unsigned long * addr)
196#include <asm-generic/bitops/hweight.h> 196#include <asm-generic/bitops/hweight.h>
197#include <asm-generic/bitops/lock.h> 197#include <asm-generic/bitops/lock.h>
198 198
199static __inline__ int ext2_set_bit(int nr, volatile void * addr) 199#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
200
201static inline void __set_bit_le(int nr, void *addr)
202{
203 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
204}
205
206static inline void __clear_bit_le(int nr, void *addr)
207{
208 __clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
209}
210
211static inline int __test_and_set_bit_le(int nr, volatile void *addr)
200{ 212{
201 char retval; 213 char retval;
202 214
@@ -215,7 +227,7 @@ static __inline__ int ext2_set_bit(int nr, volatile void * addr)
215 return retval; 227 return retval;
216} 228}
217 229
218static __inline__ int ext2_clear_bit(int nr, volatile void * addr) 230static inline int __test_and_clear_bit_le(int nr, volatile void *addr)
219{ 231{
220 char retval; 232 char retval;
221 233
@@ -238,7 +250,7 @@ static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
238 ({ \ 250 ({ \
239 int ret; \ 251 int ret; \
240 spin_lock(lock); \ 252 spin_lock(lock); \
241 ret = ext2_set_bit((nr), (addr)); \ 253 ret = __test_and_set_bit_le((nr), (addr)); \
242 spin_unlock(lock); \ 254 spin_unlock(lock); \
243 ret; \ 255 ret; \
244 }) 256 })
@@ -247,12 +259,12 @@ static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
247 ({ \ 259 ({ \
248 int ret; \ 260 int ret; \
249 spin_lock(lock); \ 261 spin_lock(lock); \
250 ret = ext2_clear_bit((nr), (addr)); \ 262 ret = __test_and_clear_bit_le((nr), (addr)); \
251 spin_unlock(lock); \ 263 spin_unlock(lock); \
252 ret; \ 264 ret; \
253 }) 265 })
254 266
255static __inline__ int ext2_test_bit(int nr, const volatile void * addr) 267static inline int test_bit_le(int nr, const volatile void *addr)
256{ 268{
257 char retval; 269 char retval;
258 270
@@ -271,10 +283,10 @@ static __inline__ int ext2_test_bit(int nr, const volatile void * addr)
271 return retval; 283 return retval;
272} 284}
273 285
274#define ext2_find_first_zero_bit(addr, size) \ 286#define find_first_zero_bit_le(addr, size) \
275 ext2_find_next_zero_bit((addr), (size), 0) 287 find_next_zero_bit_le((addr), (size), 0)
276 288
277static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset) 289static inline unsigned long find_next_zero_bit_le(void *addr, unsigned long size, unsigned long offset)
278{ 290{
279 unsigned long *p = ((unsigned long *) addr) + (offset >> 5); 291 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
280 unsigned long result = offset & ~31UL; 292 unsigned long result = offset & ~31UL;
@@ -324,8 +336,13 @@ found_middle:
324 return result + ffz(__swab32(tmp)); 336 return result + ffz(__swab32(tmp));
325} 337}
326 338
327#define ext2_find_next_bit(addr, size, off) \ 339#define ext2_set_bit __test_and_set_bit_le
328 find_next_bit_le((unsigned long *)(addr), (size), (off)) 340#define ext2_clear_bit __test_and_clear_bit_le
341#define ext2_test_bit test_bit_le
342#define ext2_find_first_zero_bit find_first_zero_bit_le
343#define ext2_find_next_zero_bit find_next_zero_bit_le
344#define ext2_find_next_bit find_next_bit_le
345
329#include <asm-generic/bitops/minix.h> 346#include <asm-generic/bitops/minix.h>
330 347
331#endif /* __KERNEL__ */ 348#endif /* __KERNEL__ */
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index 5795f58728ca..b5424cf948e6 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -42,10 +42,6 @@ config GENERIC_FIND_NEXT_BIT
42 bool 42 bool
43 default y 43 default y
44 44
45config GENERIC_FIND_BIT_LE
46 bool
47 default y
48
49config GENERIC_GPIO 45config GENERIC_GPIO
50 bool 46 bool
51 default n 47 default n