aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2005-07-24 22:35:28 -0400
committerDavid S. Miller <davem@davemloft.net>2005-07-24 22:35:28 -0400
commit6593eaed814d50214d6056c683d52ac63153730e (patch)
treeb5e803f1217dd26484a15816e84402d8d3ce8a84 /include
parent4b502421aac89c8d4e61ecc89a70065a33305a0b (diff)
[SPARC64]: Non-atomic bitops do not need volatile operations
Noticed this while comparing sparc64's bitops.h to ppc64's. We can cast the volatile memory argument to be non-volatile. While we're here, __inline__ --> inline. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/asm-sparc64/bitops.h56
1 files changed, 28 insertions, 28 deletions
diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h
index 9d722dc8cca3..9c5e71970287 100644
--- a/include/asm-sparc64/bitops.h
+++ b/include/asm-sparc64/bitops.h
@@ -20,52 +20,52 @@ extern void change_bit(unsigned long nr, volatile unsigned long *addr);
20 20
21/* "non-atomic" versions... */ 21/* "non-atomic" versions... */
22 22
23static __inline__ void __set_bit(int nr, volatile unsigned long *addr) 23static inline void __set_bit(int nr, volatile unsigned long *addr)
24{ 24{
25 volatile unsigned long *m = addr + (nr >> 6); 25 unsigned long *m = ((unsigned long *)addr) + (nr >> 6);
26 26
27 *m |= (1UL << (nr & 63)); 27 *m |= (1UL << (nr & 63));
28} 28}
29 29
30static __inline__ void __clear_bit(int nr, volatile unsigned long *addr) 30static inline void __clear_bit(int nr, volatile unsigned long *addr)
31{ 31{
32 volatile unsigned long *m = addr + (nr >> 6); 32 unsigned long *m = ((unsigned long *)addr) + (nr >> 6);
33 33
34 *m &= ~(1UL << (nr & 63)); 34 *m &= ~(1UL << (nr & 63));
35} 35}
36 36
37static __inline__ void __change_bit(int nr, volatile unsigned long *addr) 37static inline void __change_bit(int nr, volatile unsigned long *addr)
38{ 38{
39 volatile unsigned long *m = addr + (nr >> 6); 39 unsigned long *m = ((unsigned long *)addr) + (nr >> 6);
40 40
41 *m ^= (1UL << (nr & 63)); 41 *m ^= (1UL << (nr & 63));
42} 42}
43 43
44static __inline__ int __test_and_set_bit(int nr, volatile unsigned long *addr) 44static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
45{ 45{
46 volatile unsigned long *m = addr + (nr >> 6); 46 unsigned long *m = ((unsigned long *)addr) + (nr >> 6);
47 long old = *m; 47 unsigned long old = *m;
48 long mask = (1UL << (nr & 63)); 48 unsigned long mask = (1UL << (nr & 63));
49 49
50 *m = (old | mask); 50 *m = (old | mask);
51 return ((old & mask) != 0); 51 return ((old & mask) != 0);
52} 52}
53 53
54static __inline__ int __test_and_clear_bit(int nr, volatile unsigned long *addr) 54static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
55{ 55{
56 volatile unsigned long *m = addr + (nr >> 6); 56 unsigned long *m = ((unsigned long *)addr) + (nr >> 6);
57 long old = *m; 57 unsigned long old = *m;
58 long mask = (1UL << (nr & 63)); 58 unsigned long mask = (1UL << (nr & 63));
59 59
60 *m = (old & ~mask); 60 *m = (old & ~mask);
61 return ((old & mask) != 0); 61 return ((old & mask) != 0);
62} 62}
63 63
64static __inline__ int __test_and_change_bit(int nr, volatile unsigned long *addr) 64static inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
65{ 65{
66 volatile unsigned long *m = addr + (nr >> 6); 66 unsigned long *m = ((unsigned long *)addr) + (nr >> 6);
67 long old = *m; 67 unsigned long old = *m;
68 long mask = (1UL << (nr & 63)); 68 unsigned long mask = (1UL << (nr & 63));
69 69
70 *m = (old ^ mask); 70 *m = (old ^ mask);
71 return ((old & mask) != 0); 71 return ((old & mask) != 0);
@@ -79,13 +79,13 @@ static __inline__ int __test_and_change_bit(int nr, volatile unsigned long *addr
79#define smp_mb__after_clear_bit() barrier() 79#define smp_mb__after_clear_bit() barrier()
80#endif 80#endif
81 81
82static __inline__ int test_bit(int nr, __const__ volatile unsigned long *addr) 82static inline int test_bit(int nr, __const__ volatile unsigned long *addr)
83{ 83{
84 return (1UL & ((addr)[nr >> 6] >> (nr & 63))) != 0UL; 84 return (1UL & (addr[nr >> 6] >> (nr & 63))) != 0UL;
85} 85}
86 86
87/* The easy/cheese version for now. */ 87/* The easy/cheese version for now. */
88static __inline__ unsigned long ffz(unsigned long word) 88static inline unsigned long ffz(unsigned long word)
89{ 89{
90 unsigned long result; 90 unsigned long result;
91 91
@@ -103,7 +103,7 @@ static __inline__ unsigned long ffz(unsigned long word)
103 * 103 *
104 * Undefined if no bit exists, so code should check against 0 first. 104 * Undefined if no bit exists, so code should check against 0 first.
105 */ 105 */
106static __inline__ unsigned long __ffs(unsigned long word) 106static inline unsigned long __ffs(unsigned long word)
107{ 107{
108 unsigned long result = 0; 108 unsigned long result = 0;
109 109
@@ -144,7 +144,7 @@ static inline int sched_find_first_bit(unsigned long *b)
144 * the libc and compiler builtin ffs routines, therefore 144 * the libc and compiler builtin ffs routines, therefore
145 * differs in spirit from the above ffz (man ffs). 145 * differs in spirit from the above ffz (man ffs).
146 */ 146 */
147static __inline__ int ffs(int x) 147static inline int ffs(int x)
148{ 148{
149 if (!x) 149 if (!x)
150 return 0; 150 return 0;
@@ -158,7 +158,7 @@ static __inline__ int ffs(int x)
158 158
159#ifdef ULTRA_HAS_POPULATION_COUNT 159#ifdef ULTRA_HAS_POPULATION_COUNT
160 160
161static __inline__ unsigned int hweight64(unsigned long w) 161static inline unsigned int hweight64(unsigned long w)
162{ 162{
163 unsigned int res; 163 unsigned int res;
164 164
@@ -166,7 +166,7 @@ static __inline__ unsigned int hweight64(unsigned long w)
166 return res; 166 return res;
167} 167}
168 168
169static __inline__ unsigned int hweight32(unsigned int w) 169static inline unsigned int hweight32(unsigned int w)
170{ 170{
171 unsigned int res; 171 unsigned int res;
172 172
@@ -174,7 +174,7 @@ static __inline__ unsigned int hweight32(unsigned int w)
174 return res; 174 return res;
175} 175}
176 176
177static __inline__ unsigned int hweight16(unsigned int w) 177static inline unsigned int hweight16(unsigned int w)
178{ 178{
179 unsigned int res; 179 unsigned int res;
180 180
@@ -182,7 +182,7 @@ static __inline__ unsigned int hweight16(unsigned int w)
182 return res; 182 return res;
183} 183}
184 184
185static __inline__ unsigned int hweight8(unsigned int w) 185static inline unsigned int hweight8(unsigned int w)
186{ 186{
187 unsigned int res; 187 unsigned int res;
188 188
@@ -236,7 +236,7 @@ extern unsigned long find_next_zero_bit(const unsigned long *,
236#define test_and_clear_le_bit(nr,addr) \ 236#define test_and_clear_le_bit(nr,addr) \
237 test_and_clear_bit((nr) ^ 0x38, (addr)) 237 test_and_clear_bit((nr) ^ 0x38, (addr))
238 238
239static __inline__ int test_le_bit(int nr, __const__ unsigned long * addr) 239static inline int test_le_bit(int nr, __const__ unsigned long * addr)
240{ 240{
241 int mask; 241 int mask;
242 __const__ unsigned char *ADDR = (__const__ unsigned char *) addr; 242 __const__ unsigned char *ADDR = (__const__ unsigned char *) addr;