aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/bitops.h
diff options
context:
space:
mode:
authorGlauber de Oliveira Costa <gcosta@redhat.com>2008-01-30 07:31:31 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:31:31 -0500
commit26996dd22b3cbc9dbe18cf908d2f844a116b6ec1 (patch)
tree5c85873869cd4e6f907b5f56da013742741bc434 /include/asm-x86/bitops.h
parentdbcb4660246c240a159b4037067fdedb563a63cb (diff)
x86: change bitwise operations to get a void parameter.
This patch changes the bitwise operations in bitops.h to get a void pointers as a parameter. Before this patch, a lot of warnings can be seen. They're gone after it. Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86/bitops.h')
-rw-r--r--include/asm-x86/bitops.h39
1 files changed, 20 insertions, 19 deletions
diff --git a/include/asm-x86/bitops.h b/include/asm-x86/bitops.h
index c6dd7e259b46..1a23ce1a5697 100644
--- a/include/asm-x86/bitops.h
+++ b/include/asm-x86/bitops.h
@@ -43,7 +43,7 @@
43 * Note that @nr may be almost arbitrarily large; this function is not 43 * Note that @nr may be almost arbitrarily large; this function is not
44 * restricted to acting on a single-word quantity. 44 * restricted to acting on a single-word quantity.
45 */ 45 */
46static inline void set_bit(int nr, volatile unsigned long *addr) 46static inline void set_bit(int nr, volatile void *addr)
47{ 47{
48 asm volatile(LOCK_PREFIX "bts %1,%0" 48 asm volatile(LOCK_PREFIX "bts %1,%0"
49 : ADDR 49 : ADDR
@@ -59,7 +59,7 @@ static inline void set_bit(int nr, volatile unsigned long *addr)
59 * If it's called on the same region of memory simultaneously, the effect 59 * If it's called on the same region of memory simultaneously, the effect
60 * may be that only one operation succeeds. 60 * may be that only one operation succeeds.
61 */ 61 */
62static inline void __set_bit(int nr, volatile unsigned long *addr) 62static inline void __set_bit(int nr, volatile void *addr)
63{ 63{
64 asm volatile("bts %1,%0" 64 asm volatile("bts %1,%0"
65 : ADDR 65 : ADDR
@@ -77,7 +77,7 @@ static inline void __set_bit(int nr, volatile unsigned long *addr)
77 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() 77 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
78 * in order to ensure changes are visible on other processors. 78 * in order to ensure changes are visible on other processors.
79 */ 79 */
80static inline void clear_bit(int nr, volatile unsigned long *addr) 80static inline void clear_bit(int nr, volatile void *addr)
81{ 81{
82 asm volatile(LOCK_PREFIX "btr %1,%0" 82 asm volatile(LOCK_PREFIX "btr %1,%0"
83 : ADDR 83 : ADDR
@@ -92,13 +92,13 @@ static inline void clear_bit(int nr, volatile unsigned long *addr)
92 * clear_bit() is atomic and implies release semantics before the memory 92 * clear_bit() is atomic and implies release semantics before the memory
93 * operation. It can be used for an unlock. 93 * operation. It can be used for an unlock.
94 */ 94 */
95static inline void clear_bit_unlock(unsigned nr, volatile unsigned long *addr) 95static inline void clear_bit_unlock(unsigned nr, volatile void *addr)
96{ 96{
97 barrier(); 97 barrier();
98 clear_bit(nr, addr); 98 clear_bit(nr, addr);
99} 99}
100 100
101static inline void __clear_bit(int nr, volatile unsigned long *addr) 101static inline void __clear_bit(int nr, volatile void *addr)
102{ 102{
103 asm volatile("btr %1,%0" : ADDR : "Ir" (nr)); 103 asm volatile("btr %1,%0" : ADDR : "Ir" (nr));
104} 104}
@@ -115,7 +115,7 @@ static inline void __clear_bit(int nr, volatile unsigned long *addr)
115 * No memory barrier is required here, because x86 cannot reorder stores past 115 * No memory barrier is required here, because x86 cannot reorder stores past
116 * older loads. Same principle as spin_unlock. 116 * older loads. Same principle as spin_unlock.
117 */ 117 */
118static inline void __clear_bit_unlock(unsigned nr, volatile unsigned long *addr) 118static inline void __clear_bit_unlock(unsigned nr, volatile void *addr)
119{ 119{
120 barrier(); 120 barrier();
121 __clear_bit(nr, addr); 121 __clear_bit(nr, addr);
@@ -133,7 +133,7 @@ static inline void __clear_bit_unlock(unsigned nr, volatile unsigned long *addr)
133 * If it's called on the same region of memory simultaneously, the effect 133 * If it's called on the same region of memory simultaneously, the effect
134 * may be that only one operation succeeds. 134 * may be that only one operation succeeds.
135 */ 135 */
136static inline void __change_bit(int nr, volatile unsigned long *addr) 136static inline void __change_bit(int nr, volatile void *addr)
137{ 137{
138 asm volatile("btc %1,%0" : ADDR : "Ir" (nr)); 138 asm volatile("btc %1,%0" : ADDR : "Ir" (nr));
139} 139}
@@ -147,7 +147,7 @@ static inline void __change_bit(int nr, volatile unsigned long *addr)
147 * Note that @nr may be almost arbitrarily large; this function is not 147 * Note that @nr may be almost arbitrarily large; this function is not
148 * restricted to acting on a single-word quantity. 148 * restricted to acting on a single-word quantity.
149 */ 149 */
150static inline void change_bit(int nr, volatile unsigned long *addr) 150static inline void change_bit(int nr, volatile void *addr)
151{ 151{
152 asm volatile(LOCK_PREFIX "btc %1,%0" 152 asm volatile(LOCK_PREFIX "btc %1,%0"
153 : ADDR : "Ir" (nr)); 153 : ADDR : "Ir" (nr));
@@ -161,7 +161,7 @@ static inline void change_bit(int nr, volatile unsigned long *addr)
161 * This operation is atomic and cannot be reordered. 161 * This operation is atomic and cannot be reordered.
162 * It also implies a memory barrier. 162 * It also implies a memory barrier.
163 */ 163 */
164static inline int test_and_set_bit(int nr, volatile unsigned long *addr) 164static inline int test_and_set_bit(int nr, volatile void *addr)
165{ 165{
166 int oldbit; 166 int oldbit;
167 167
@@ -180,7 +180,7 @@ static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
180 * 180 *
181 * This is the same as test_and_set_bit on x86. 181 * This is the same as test_and_set_bit on x86.
182 */ 182 */
183static inline int test_and_set_bit_lock(int nr, volatile unsigned long *addr) 183static inline int test_and_set_bit_lock(int nr, volatile void *addr)
184{ 184{
185 return test_and_set_bit(nr, addr); 185 return test_and_set_bit(nr, addr);
186} 186}
@@ -194,7 +194,7 @@ static inline int test_and_set_bit_lock(int nr, volatile unsigned long *addr)
194 * If two examples of this operation race, one can appear to succeed 194 * If two examples of this operation race, one can appear to succeed
195 * but actually fail. You must protect multiple accesses with a lock. 195 * but actually fail. You must protect multiple accesses with a lock.
196 */ 196 */
197static inline int __test_and_set_bit(int nr, volatile unsigned long *addr) 197static inline int __test_and_set_bit(int nr, volatile void *addr)
198{ 198{
199 int oldbit; 199 int oldbit;
200 200
@@ -213,7 +213,7 @@ static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
213 * This operation is atomic and cannot be reordered. 213 * This operation is atomic and cannot be reordered.
214 * It also implies a memory barrier. 214 * It also implies a memory barrier.
215 */ 215 */
216static inline int test_and_clear_bit(int nr, volatile unsigned long *addr) 216static inline int test_and_clear_bit(int nr, volatile void *addr)
217{ 217{
218 int oldbit; 218 int oldbit;
219 219
@@ -234,7 +234,7 @@ static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
234 * If two examples of this operation race, one can appear to succeed 234 * If two examples of this operation race, one can appear to succeed
235 * but actually fail. You must protect multiple accesses with a lock. 235 * but actually fail. You must protect multiple accesses with a lock.
236 */ 236 */
237static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr) 237static inline int __test_and_clear_bit(int nr, volatile void *addr)
238{ 238{
239 int oldbit; 239 int oldbit;
240 240
@@ -246,7 +246,7 @@ static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
246} 246}
247 247
248/* WARNING: non atomic and it can be reordered! */ 248/* WARNING: non atomic and it can be reordered! */
249static inline int __test_and_change_bit(int nr, volatile unsigned long *addr) 249static inline int __test_and_change_bit(int nr, volatile void *addr)
250{ 250{
251 int oldbit; 251 int oldbit;
252 252
@@ -266,7 +266,7 @@ static inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
266 * This operation is atomic and cannot be reordered. 266 * This operation is atomic and cannot be reordered.
267 * It also implies a memory barrier. 267 * It also implies a memory barrier.
268 */ 268 */
269static inline int test_and_change_bit(int nr, volatile unsigned long *addr) 269static inline int test_and_change_bit(int nr, volatile void *addr)
270{ 270{
271 int oldbit; 271 int oldbit;
272 272
@@ -278,19 +278,20 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
278 return oldbit; 278 return oldbit;
279} 279}
280 280
281static inline int constant_test_bit(int nr, const volatile unsigned long *addr) 281static inline int constant_test_bit(int nr, const volatile void *addr)
282{ 282{
283 return ((1UL << (nr % BITS_PER_LONG)) & (addr[nr / BITS_PER_LONG])) != 0; 283 return ((1UL << (nr % BITS_PER_LONG)) &
284 (((unsigned long *)addr)[nr / BITS_PER_LONG])) != 0;
284} 285}
285 286
286static inline int variable_test_bit(int nr, volatile const unsigned long *addr) 287static inline int variable_test_bit(int nr, volatile const void *addr)
287{ 288{
288 int oldbit; 289 int oldbit;
289 290
290 asm volatile("bt %2,%1\n\t" 291 asm volatile("bt %2,%1\n\t"
291 "sbb %0,%0" 292 "sbb %0,%0"
292 : "=r" (oldbit) 293 : "=r" (oldbit)
293 : "m" (*addr), "Ir" (nr)); 294 : "m" (*(unsigned long *)addr), "Ir" (nr));
294 295
295 return oldbit; 296 return oldbit;
296} 297}