0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _SPARC_BITOPS_H
0011 #define _SPARC_BITOPS_H
0012
0013 #include <linux/compiler.h>
0014 #include <asm/byteorder.h>
0015
0016 #ifdef __KERNEL__
0017
0018 #ifndef _LINUX_BITOPS_H
0019 #error only <linux/bitops.h> can be included directly
0020 #endif
0021
0022 unsigned long sp32___set_bit(unsigned long *addr, unsigned long mask);
0023 unsigned long sp32___clear_bit(unsigned long *addr, unsigned long mask);
0024 unsigned long sp32___change_bit(unsigned long *addr, unsigned long mask);
0025
0026
0027
0028
0029
0030
0031
0032 static inline int test_and_set_bit(unsigned long nr, volatile unsigned long *addr)
0033 {
0034 unsigned long *ADDR, mask;
0035
0036 ADDR = ((unsigned long *) addr) + (nr >> 5);
0037 mask = 1 << (nr & 31);
0038
0039 return sp32___set_bit(ADDR, mask) != 0;
0040 }
0041
0042 static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
0043 {
0044 unsigned long *ADDR, mask;
0045
0046 ADDR = ((unsigned long *) addr) + (nr >> 5);
0047 mask = 1 << (nr & 31);
0048
0049 (void) sp32___set_bit(ADDR, mask);
0050 }
0051
0052 static inline int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
0053 {
0054 unsigned long *ADDR, mask;
0055
0056 ADDR = ((unsigned long *) addr) + (nr >> 5);
0057 mask = 1 << (nr & 31);
0058
0059 return sp32___clear_bit(ADDR, mask) != 0;
0060 }
0061
0062 static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
0063 {
0064 unsigned long *ADDR, mask;
0065
0066 ADDR = ((unsigned long *) addr) + (nr >> 5);
0067 mask = 1 << (nr & 31);
0068
0069 (void) sp32___clear_bit(ADDR, mask);
0070 }
0071
0072 static inline int test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
0073 {
0074 unsigned long *ADDR, mask;
0075
0076 ADDR = ((unsigned long *) addr) + (nr >> 5);
0077 mask = 1 << (nr & 31);
0078
0079 return sp32___change_bit(ADDR, mask) != 0;
0080 }
0081
0082 static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
0083 {
0084 unsigned long *ADDR, mask;
0085
0086 ADDR = ((unsigned long *) addr) + (nr >> 5);
0087 mask = 1 << (nr & 31);
0088
0089 (void) sp32___change_bit(ADDR, mask);
0090 }
0091
0092 #include <asm-generic/bitops/non-atomic.h>
0093
0094 #include <asm-generic/bitops/ffz.h>
0095 #include <asm-generic/bitops/__ffs.h>
0096 #include <asm-generic/bitops/sched.h>
0097 #include <asm-generic/bitops/ffs.h>
0098 #include <asm-generic/bitops/fls.h>
0099 #include <asm-generic/bitops/__fls.h>
0100 #include <asm-generic/bitops/fls64.h>
0101 #include <asm-generic/bitops/hweight.h>
0102 #include <asm-generic/bitops/lock.h>
0103 #include <asm-generic/bitops/le.h>
0104 #include <asm-generic/bitops/ext2-atomic.h>
0105
0106 #endif
0107
0108 #endif