提交 f6b57e32 编写于 作者: A Akinobu Mita 提交者: Linus Torvalds

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: NAkinobu Mita <akinobu.mita@gmail.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 50b9b475
......@@ -287,41 +287,80 @@ static inline int fls(int x)
#include <asm-generic/bitops/hweight.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.
* These do not need to be atomic.
*/
#define ext2_set_bit(nr,p) \
__test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
#define ext2_set_bit_atomic(lock,nr,p) \
test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
#define ext2_clear_bit(nr,p) \
__test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
#define ext2_clear_bit_atomic(lock,nr,p) \
test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
#define ext2_test_bit(nr,p) \
test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
#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)
#define ext2_set_bit __test_and_set_bit_le
#define ext2_set_bit_atomic(lock, nr, p) \
test_and_set_bit_le(nr, p)
#define ext2_clear_bit __test_and_clear_bit_le
#define ext2_clear_bit_atomic(lock, nr, p) \
test_and_clear_bit_le(nr, p)
#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
/*
* Minix is defined to use little-endian byte ordering.
* These do not need to be atomic.
*/
#define minix_set_bit(nr,p) \
__set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
#define minix_test_bit(nr,p) \
test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
#define minix_test_and_set_bit(nr,p) \
__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)
#define minix_set_bit __set_bit_le
#define minix_test_bit test_bit_le
#define minix_test_and_set_bit __test_and_set_bit_le
#define minix_test_and_clear_bit __test_and_clear_bit_le
#define minix_find_first_zero_bit find_first_zero_bit_le
#endif /* __KERNEL__ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册