arm: introduce little-endian bitops
Introduce little-endian bit operations by renaming native ext2 bit operations. The ext2 and minix 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> Cc: Russell King <rmk+kernel@arm.linux.org.uk> 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>
This commit is contained in:
parent
50b9b475c5
commit
f6b57e322f
@ -287,41 +287,80 @@ static inline int fls(int x)
|
|||||||
#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 void __set_bit_le(int nr, void *addr)
|
||||||
|
{
|
||||||
|
__set_bit(WORD_BITOFF_TO_LE(nr), addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __clear_bit_le(int nr, void *addr)
|
||||||
|
{
|
||||||
|
__clear_bit(WORD_BITOFF_TO_LE(nr), addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int __test_and_set_bit_le(int nr, void *addr)
|
||||||
|
{
|
||||||
|
return __test_and_set_bit(WORD_BITOFF_TO_LE(nr), addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int test_and_set_bit_le(int nr, void *addr)
|
||||||
|
{
|
||||||
|
return test_and_set_bit(WORD_BITOFF_TO_LE(nr), addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int __test_and_clear_bit_le(int nr, void *addr)
|
||||||
|
{
|
||||||
|
return __test_and_clear_bit(WORD_BITOFF_TO_LE(nr), addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int test_and_clear_bit_le(int nr, void *addr)
|
||||||
|
{
|
||||||
|
return test_and_clear_bit(WORD_BITOFF_TO_LE(nr), addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int test_bit_le(int nr, const void *addr)
|
||||||
|
{
|
||||||
|
return test_bit(WORD_BITOFF_TO_LE(nr), addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int find_first_zero_bit_le(const void *p, unsigned size)
|
||||||
|
{
|
||||||
|
return _find_first_zero_bit_le(p, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int find_next_zero_bit_le(const void *p, int size, int offset)
|
||||||
|
{
|
||||||
|
return _find_next_zero_bit_le(p, size, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int find_next_bit_le(const void *p, int size, int offset)
|
||||||
|
{
|
||||||
|
return _find_next_bit_le(p, size, offset);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ext2 is defined to use little-endian byte ordering.
|
* Ext2 is defined to use little-endian byte ordering.
|
||||||
* These do not need to be atomic.
|
* These do not need to be atomic.
|
||||||
*/
|
*/
|
||||||
#define ext2_set_bit(nr,p) \
|
#define ext2_set_bit __test_and_set_bit_le
|
||||||
__test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
|
#define ext2_set_bit_atomic(lock, nr, p) \
|
||||||
#define ext2_set_bit_atomic(lock,nr,p) \
|
test_and_set_bit_le(nr, p)
|
||||||
test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
|
#define ext2_clear_bit __test_and_clear_bit_le
|
||||||
#define ext2_clear_bit(nr,p) \
|
#define ext2_clear_bit_atomic(lock, nr, p) \
|
||||||
__test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
|
test_and_clear_bit_le(nr, p)
|
||||||
#define ext2_clear_bit_atomic(lock,nr,p) \
|
#define ext2_test_bit test_bit_le
|
||||||
test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
|
#define ext2_find_first_zero_bit find_first_zero_bit_le
|
||||||
#define ext2_test_bit(nr,p) \
|
#define ext2_find_next_zero_bit find_next_zero_bit_le
|
||||||
test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
|
#define ext2_find_next_bit find_next_bit_le
|
||||||
#define ext2_find_first_zero_bit(p,sz) \
|
|
||||||
_find_first_zero_bit_le(p,sz)
|
|
||||||
#define ext2_find_next_zero_bit(p,sz,off) \
|
|
||||||
_find_next_zero_bit_le(p,sz,off)
|
|
||||||
#define ext2_find_next_bit(p, sz, off) \
|
|
||||||
_find_next_bit_le(p, sz, off)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Minix is defined to use little-endian byte ordering.
|
* Minix is defined to use little-endian byte ordering.
|
||||||
* These do not need to be atomic.
|
* These do not need to be atomic.
|
||||||
*/
|
*/
|
||||||
#define minix_set_bit(nr,p) \
|
#define minix_set_bit __set_bit_le
|
||||||
__set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
|
#define minix_test_bit test_bit_le
|
||||||
#define minix_test_bit(nr,p) \
|
#define minix_test_and_set_bit __test_and_set_bit_le
|
||||||
test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
|
#define minix_test_and_clear_bit __test_and_clear_bit_le
|
||||||
#define minix_test_and_set_bit(nr,p) \
|
#define minix_find_first_zero_bit find_first_zero_bit_le
|
||||||
__test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
|
|
||||||
#define minix_test_and_clear_bit(nr,p) \
|
|
||||||
__test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
|
|
||||||
#define minix_find_first_zero_bit(p,sz) \
|
|
||||||
_find_first_zero_bit_le(p,sz)
|
|
||||||
|
|
||||||
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user