aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2011-03-23 19:41:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-23 22:46:12 -0400
commit50b9b475c5b3e6649c22e1d39ab3ced3dbf21758 (patch)
tree4072a30d4a95585e72377b99da3e86ceb62ac6e5
parentf57d7ff1b8798eccbc778552df34ed9f154ecebb (diff)
s390: 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> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> 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>
-rw-r--r--arch/s390/include/asm/bitops.h73
1 files changed, 54 insertions, 19 deletions
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index 2e05972c5085..f48f9644e4b5 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -742,18 +742,42 @@ static inline int sched_find_first_bit(unsigned long *b)
742 * 23 22 21 20 19 18 17 16 31 30 29 28 27 26 25 24 742 * 23 22 21 20 19 18 17 16 31 30 29 28 27 26 25 24
743 */ 743 */
744 744
745#define ext2_set_bit(nr, addr) \ 745static inline void __set_bit_le(unsigned long nr, void *addr)
746 __test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 746{
747#define ext2_set_bit_atomic(lock, nr, addr) \ 747 __set_bit(nr ^ (__BITOPS_WORDSIZE - 8), addr);
748 test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 748}
749#define ext2_clear_bit(nr, addr) \ 749
750 __test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 750static inline void __clear_bit_le(unsigned long nr, void *addr)
751#define ext2_clear_bit_atomic(lock, nr, addr) \ 751{
752 test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 752 __clear_bit(nr ^ (__BITOPS_WORDSIZE - 8), addr);
753#define ext2_test_bit(nr, addr) \ 753}
754 test_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr) 754
755 755static inline int __test_and_set_bit_le(unsigned long nr, void *addr)
756static inline int ext2_find_first_zero_bit(void *vaddr, unsigned int size) 756{
757 return __test_and_set_bit(nr ^ (__BITOPS_WORDSIZE - 8), addr);
758}
759
760static inline int test_and_set_bit_le(unsigned long nr, void *addr)
761{
762 return test_and_set_bit(nr ^ (__BITOPS_WORDSIZE - 8), addr);
763}
764
765static inline int __test_and_clear_bit_le(unsigned long nr, void *addr)
766{
767 return __test_and_clear_bit(nr ^ (__BITOPS_WORDSIZE - 8), addr);
768}
769
770static inline int test_and_clear_bit_le(unsigned long nr, void *addr)
771{
772 return test_and_clear_bit(nr ^ (__BITOPS_WORDSIZE - 8), addr);
773}
774
775static inline int test_bit_le(unsigned long nr, const void *addr)
776{
777 return test_bit(nr ^ (__BITOPS_WORDSIZE - 8), addr);
778}
779
780static inline int find_first_zero_bit_le(void *vaddr, unsigned int size)
757{ 781{
758 unsigned long bytes, bits; 782 unsigned long bytes, bits;
759 783
@@ -764,7 +788,7 @@ static inline int ext2_find_first_zero_bit(void *vaddr, unsigned int size)
764 return (bits < size) ? bits : size; 788 return (bits < size) ? bits : size;
765} 789}
766 790
767static inline int ext2_find_next_zero_bit(void *vaddr, unsigned long size, 791static inline int find_next_zero_bit_le(void *vaddr, unsigned long size,
768 unsigned long offset) 792 unsigned long offset)
769{ 793{
770 unsigned long *addr = vaddr, *p; 794 unsigned long *addr = vaddr, *p;
@@ -790,11 +814,10 @@ static inline int ext2_find_next_zero_bit(void *vaddr, unsigned long size,
790 size -= __BITOPS_WORDSIZE; 814 size -= __BITOPS_WORDSIZE;
791 p++; 815 p++;
792 } 816 }
793 return offset + ext2_find_first_zero_bit(p, size); 817 return offset + find_first_zero_bit_le(p, size);
794} 818}
795 819
796static inline unsigned long ext2_find_first_bit(void *vaddr, 820static inline unsigned long find_first_bit_le(void *vaddr, unsigned long size)
797 unsigned long size)
798{ 821{
799 unsigned long bytes, bits; 822 unsigned long bytes, bits;
800 823
@@ -805,7 +828,7 @@ static inline unsigned long ext2_find_first_bit(void *vaddr,
805 return (bits < size) ? bits : size; 828 return (bits < size) ? bits : size;
806} 829}
807 830
808static inline int ext2_find_next_bit(void *vaddr, unsigned long size, 831static inline int find_next_bit_le(void *vaddr, unsigned long size,
809 unsigned long offset) 832 unsigned long offset)
810{ 833{
811 unsigned long *addr = vaddr, *p; 834 unsigned long *addr = vaddr, *p;
@@ -831,8 +854,20 @@ static inline int ext2_find_next_bit(void *vaddr, unsigned long size,
831 size -= __BITOPS_WORDSIZE; 854 size -= __BITOPS_WORDSIZE;
832 p++; 855 p++;
833 } 856 }
834 return offset + ext2_find_first_bit(p, size); 857 return offset + find_first_bit_le(p, size);
835} 858}
859
860#define ext2_set_bit __test_and_set_bit_le
861#define ext2_set_bit_atomic(lock, nr, addr) \
862 test_and_set_bit_le(nr, addr)
863#define ext2_clear_bit __test_and_clear_bit_le
864#define ext2_clear_bit_atomic(lock, nr, addr) \
865 test_and_clear_bit_le(nr, addr)
866#define ext2_test_bit test_bit_le
867#define ext2_find_first_zero_bit find_first_zero_bit_le
868#define ext2_find_next_zero_bit find_next_zero_bit_le
869#define ext2_find_first_bit find_first_bit_le
870#define ext2_find_next_bit find_next_bit_le
836 871
837#include <asm-generic/bitops/minix.h> 872#include <asm-generic/bitops/minix.h>
838 873