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

bitops: introduce little-endian bitops for most architectures

Introduce little-endian bit operations to the big-endian architectures
which do not have native little-endian bit operations and the
little-endian architectures.  (alpha, avr32, blackfin, cris, frv, h8300,
ia64, m32r, mips, mn10300, parisc, sh, sparc, tile, x86, xtensa)

These architectures can just include generic implementation
(asm-generic/bitops/le.h).
Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Mikael Starvik <starvik@axis.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Matthew Wilcox <willy@debian.org>
Cc: Grant Grundler <grundler@parisc-linux.org>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Chris Zankel <chris@zankel.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Acked-by: NHans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
Acked-by: N"H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 c1e6ca7a
...@@ -454,6 +454,7 @@ sched_find_first_bit(const unsigned long b[2]) ...@@ -454,6 +454,7 @@ sched_find_first_bit(const unsigned long b[2])
return __ffs(tmp) + ofs; return __ffs(tmp) + ofs;
} }
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a)
......
...@@ -299,6 +299,7 @@ static inline int ffs(unsigned long word) ...@@ -299,6 +299,7 @@ static inline int ffs(unsigned long word)
#include <asm-generic/bitops/hweight.h> #include <asm-generic/bitops/hweight.h>
#include <asm-generic/bitops/lock.h> #include <asm-generic/bitops/lock.h>
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#include <asm-generic/bitops/ext2-atomic.h> #include <asm-generic/bitops/ext2-atomic.h>
#include <asm-generic/bitops/minix-le.h> #include <asm-generic/bitops/minix-le.h>
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <asm-generic/bitops/const_hweight.h> #include <asm-generic/bitops/const_hweight.h>
#include <asm-generic/bitops/lock.h> #include <asm-generic/bitops/lock.h>
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#include <asm-generic/bitops/ext2-atomic.h> #include <asm-generic/bitops/ext2-atomic.h>
#include <asm-generic/bitops/minix.h> #include <asm-generic/bitops/minix.h>
......
...@@ -154,6 +154,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr) ...@@ -154,6 +154,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
#include <asm-generic/bitops/find.h> #include <asm-generic/bitops/find.h>
#include <asm-generic/bitops/lock.h> #include <asm-generic/bitops/lock.h>
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a)
......
...@@ -401,6 +401,7 @@ int __ilog2_u64(u64 n) ...@@ -401,6 +401,7 @@ int __ilog2_u64(u64 n)
#include <asm-generic/bitops/hweight.h> #include <asm-generic/bitops/hweight.h>
#include <asm-generic/bitops/lock.h> #include <asm-generic/bitops/lock.h>
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit ((nr) ^ 0x18, (addr)) #define ext2_set_bit_atomic(lock,nr,addr) test_and_set_bit ((nr) ^ 0x18, (addr))
......
...@@ -200,6 +200,7 @@ static __inline__ unsigned long __ffs(unsigned long word) ...@@ -200,6 +200,7 @@ static __inline__ unsigned long __ffs(unsigned long word)
#include <asm-generic/bitops/sched.h> #include <asm-generic/bitops/sched.h>
#include <asm-generic/bitops/hweight.h> #include <asm-generic/bitops/hweight.h>
#include <asm-generic/bitops/lock.h> #include <asm-generic/bitops/lock.h>
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#include <asm-generic/bitops/ext2-atomic.h> #include <asm-generic/bitops/ext2-atomic.h>
#include <asm-generic/bitops/minix.h> #include <asm-generic/bitops/minix.h>
......
...@@ -456,6 +456,7 @@ static __inline__ unsigned long __arch_hweight64(unsigned long x) ...@@ -456,6 +456,7 @@ static __inline__ unsigned long __arch_hweight64(unsigned long x)
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) #define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a)
......
...@@ -266,6 +266,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr) ...@@ -266,6 +266,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#include <asm-generic/bitops/ext2-atomic.h> #include <asm-generic/bitops/ext2-atomic.h>
#include <asm-generic/bitops/minix.h> #include <asm-generic/bitops/minix.h>
......
...@@ -676,6 +676,7 @@ static inline int ffs(int word) ...@@ -676,6 +676,7 @@ static inline int ffs(int word)
#include <asm/arch_hweight.h> #include <asm/arch_hweight.h>
#include <asm-generic/bitops/const_hweight.h> #include <asm-generic/bitops/const_hweight.h>
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#include <asm-generic/bitops/ext2-atomic.h> #include <asm-generic/bitops/ext2-atomic.h>
#include <asm-generic/bitops/minix.h> #include <asm-generic/bitops/minix.h>
......
...@@ -233,6 +233,7 @@ int ffs(int x) ...@@ -233,6 +233,7 @@ int ffs(int x)
#define ext2_clear_bit_atomic(lock, nr, addr) \ #define ext2_clear_bit_atomic(lock, nr, addr) \
test_and_clear_bit((nr), (addr)) test_and_clear_bit((nr), (addr))
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#include <asm-generic/bitops/minix-le.h> #include <asm-generic/bitops/minix-le.h>
......
...@@ -222,6 +222,7 @@ static __inline__ int fls(int x) ...@@ -222,6 +222,7 @@ static __inline__ int fls(int x)
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
/* '3' is bits per byte */ /* '3' is bits per byte */
......
...@@ -94,6 +94,7 @@ static inline unsigned long ffz(unsigned long word) ...@@ -94,6 +94,7 @@ static inline unsigned long ffz(unsigned long word)
#include <asm-generic/bitops/hweight.h> #include <asm-generic/bitops/hweight.h>
#include <asm-generic/bitops/lock.h> #include <asm-generic/bitops/lock.h>
#include <asm-generic/bitops/sched.h> #include <asm-generic/bitops/sched.h>
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#include <asm-generic/bitops/ext2-atomic.h> #include <asm-generic/bitops/ext2-atomic.h>
#include <asm-generic/bitops/minix.h> #include <asm-generic/bitops/minix.h>
......
...@@ -103,6 +103,7 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr) ...@@ -103,6 +103,7 @@ static inline void change_bit(unsigned long nr, 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>
#include <asm-generic/bitops/find.h> #include <asm-generic/bitops/find.h>
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#include <asm-generic/bitops/ext2-atomic.h> #include <asm-generic/bitops/ext2-atomic.h>
#include <asm-generic/bitops/minix.h> #include <asm-generic/bitops/minix.h>
......
...@@ -89,6 +89,7 @@ static inline unsigned int __arch_hweight8(unsigned int w) ...@@ -89,6 +89,7 @@ static inline unsigned int __arch_hweight8(unsigned int w)
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#define ext2_set_bit_atomic(lock,nr,addr) \ #define ext2_set_bit_atomic(lock,nr,addr) \
......
...@@ -122,6 +122,7 @@ static inline unsigned long __arch_hweight64(__u64 w) ...@@ -122,6 +122,7 @@ static inline unsigned long __arch_hweight64(__u64 w)
#include <asm-generic/bitops/lock.h> #include <asm-generic/bitops/lock.h>
#include <asm-generic/bitops/find.h> #include <asm-generic/bitops/find.h>
#include <asm-generic/bitops/sched.h> #include <asm-generic/bitops/sched.h>
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#include <asm-generic/bitops/minix.h> #include <asm-generic/bitops/minix.h>
......
...@@ -456,6 +456,7 @@ static inline int fls(int x) ...@@ -456,6 +456,7 @@ static inline int fls(int x)
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#define ext2_set_bit_atomic(lock, nr, addr) \ #define ext2_set_bit_atomic(lock, nr, addr) \
......
...@@ -106,6 +106,7 @@ static inline unsigned long __fls(unsigned long word) ...@@ -106,6 +106,7 @@ static inline unsigned long __fls(unsigned long word)
#include <asm-generic/bitops/fls64.h> #include <asm-generic/bitops/fls64.h>
#include <asm-generic/bitops/find.h> #include <asm-generic/bitops/find.h>
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#ifdef __XTENSA_EL__ #ifdef __XTENSA_EL__
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <asm-generic/bitops/atomic.h> #include <asm-generic/bitops/atomic.h>
#include <asm-generic/bitops/non-atomic.h> #include <asm-generic/bitops/non-atomic.h>
#include <asm-generic/bitops/le.h>
#include <asm-generic/bitops/ext2-non-atomic.h> #include <asm-generic/bitops/ext2-non-atomic.h>
#include <asm-generic/bitops/ext2-atomic.h> #include <asm-generic/bitops/ext2-atomic.h>
#include <asm-generic/bitops/minix.h> #include <asm-generic/bitops/minix.h>
......
#ifndef _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ #ifndef _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
#define _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ #define _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
#include <asm-generic/bitops/le.h>
#define ext2_set_bit(nr,addr) \ #define ext2_set_bit(nr,addr) \
__test_and_set_bit_le((nr), (unsigned long *)(addr)) __test_and_set_bit_le((nr), (unsigned long *)(addr))
#define ext2_clear_bit(nr,addr) \ #define ext2_clear_bit(nr,addr) \
......
#ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_ #ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_
#define _ASM_GENERIC_BITOPS_MINIX_LE_H_ #define _ASM_GENERIC_BITOPS_MINIX_LE_H_
#include <asm-generic/bitops/le.h>
#define minix_test_and_set_bit(nr,addr) \ #define minix_test_and_set_bit(nr,addr) \
__test_and_set_bit_le((nr), (unsigned long *)(addr)) __test_and_set_bit_le((nr), (unsigned long *)(addr))
#define minix_set_bit(nr,addr) \ #define minix_set_bit(nr,addr) \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册