aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include/asm/bitops.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/include/asm/bitops.h')
-rw-r--r--arch/s390/include/asm/bitops.h65
1 files changed, 46 insertions, 19 deletions
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index 2e05972c5085..e1c8f3a49884 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,10 +854,14 @@ 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}
836 859
837#include <asm-generic/bitops/minix.h> 860#define ext2_set_bit_atomic(lock, nr, addr) \
861 test_and_set_bit_le(nr, addr)
862#define ext2_clear_bit_atomic(lock, nr, addr) \
863 test_and_clear_bit_le(nr, addr)
864
838 865
839#endif /* __KERNEL__ */ 866#endif /* __KERNEL__ */
840 867