diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2006-11-29 20:14:50 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-11-29 20:14:50 -0500 |
commit | 4ffd8b3838f22c34b21a25b7612795ca45d14db6 (patch) | |
tree | 7a5660bd7fc07e54e4540ed864b9631005390994 /include/asm-mips | |
parent | e303e088f25dc7d8bafc0d1942314214a3a57b44 (diff) |
[MIPS] Remove userspace proofing from <asm/bitops.h>.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'include/asm-mips')
-rw-r--r-- | include/asm-mips/bitops.h | 63 |
1 files changed, 21 insertions, 42 deletions
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h index 1bb89c5a10ee..8cd61c197052 100644 --- a/include/asm-mips/bitops.h +++ b/include/asm-mips/bitops.h | |||
@@ -10,10 +10,13 @@ | |||
10 | #define _ASM_BITOPS_H | 10 | #define _ASM_BITOPS_H |
11 | 11 | ||
12 | #include <linux/compiler.h> | 12 | #include <linux/compiler.h> |
13 | #include <linux/irqflags.h> | ||
13 | #include <linux/types.h> | 14 | #include <linux/types.h> |
14 | #include <asm/bug.h> | 15 | #include <asm/bug.h> |
15 | #include <asm/byteorder.h> /* sigh ... */ | 16 | #include <asm/byteorder.h> /* sigh ... */ |
16 | #include <asm/cpu-features.h> | 17 | #include <asm/cpu-features.h> |
18 | #include <asm/sgidefs.h> | ||
19 | #include <asm/war.h> | ||
17 | 20 | ||
18 | #if (_MIPS_SZLONG == 32) | 21 | #if (_MIPS_SZLONG == 32) |
19 | #define SZLONG_LOG 5 | 22 | #define SZLONG_LOG 5 |
@@ -29,12 +32,6 @@ | |||
29 | #define cpu_to_lelongp(x) cpu_to_le64p((__u64 *) (x)) | 32 | #define cpu_to_lelongp(x) cpu_to_le64p((__u64 *) (x)) |
30 | #endif | 33 | #endif |
31 | 34 | ||
32 | #ifdef __KERNEL__ | ||
33 | |||
34 | #include <linux/irqflags.h> | ||
35 | #include <asm/sgidefs.h> | ||
36 | #include <asm/war.h> | ||
37 | |||
38 | /* | 35 | /* |
39 | * clear_bit() doesn't provide any barrier for the compiler. | 36 | * clear_bit() doesn't provide any barrier for the compiler. |
40 | */ | 37 | */ |
@@ -42,20 +39,6 @@ | |||
42 | #define smp_mb__after_clear_bit() smp_mb() | 39 | #define smp_mb__after_clear_bit() smp_mb() |
43 | 40 | ||
44 | /* | 41 | /* |
45 | * Only disable interrupt for kernel mode stuff to keep usermode stuff | ||
46 | * that dares to use kernel include files alive. | ||
47 | */ | ||
48 | |||
49 | #define __bi_flags unsigned long flags | ||
50 | #define __bi_local_irq_save(x) local_irq_save(x) | ||
51 | #define __bi_local_irq_restore(x) local_irq_restore(x) | ||
52 | #else | ||
53 | #define __bi_flags | ||
54 | #define __bi_local_irq_save(x) | ||
55 | #define __bi_local_irq_restore(x) | ||
56 | #endif /* __KERNEL__ */ | ||
57 | |||
58 | /* | ||
59 | * set_bit - Atomically set a bit in memory | 42 | * set_bit - Atomically set a bit in memory |
60 | * @nr: the bit to set | 43 | * @nr: the bit to set |
61 | * @addr: the address to start counting from | 44 | * @addr: the address to start counting from |
@@ -93,13 +76,13 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr) | |||
93 | } else { | 76 | } else { |
94 | volatile unsigned long *a = addr; | 77 | volatile unsigned long *a = addr; |
95 | unsigned long mask; | 78 | unsigned long mask; |
96 | __bi_flags; | 79 | unsigned long flags; |
97 | 80 | ||
98 | a += nr >> SZLONG_LOG; | 81 | a += nr >> SZLONG_LOG; |
99 | mask = 1UL << (nr & SZLONG_MASK); | 82 | mask = 1UL << (nr & SZLONG_MASK); |
100 | __bi_local_irq_save(flags); | 83 | local_irq_save(flags); |
101 | *a |= mask; | 84 | *a |= mask; |
102 | __bi_local_irq_restore(flags); | 85 | local_irq_restore(flags); |
103 | } | 86 | } |
104 | } | 87 | } |
105 | 88 | ||
@@ -141,13 +124,13 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) | |||
141 | } else { | 124 | } else { |
142 | volatile unsigned long *a = addr; | 125 | volatile unsigned long *a = addr; |
143 | unsigned long mask; | 126 | unsigned long mask; |
144 | __bi_flags; | 127 | unsigned long flags; |
145 | 128 | ||
146 | a += nr >> SZLONG_LOG; | 129 | a += nr >> SZLONG_LOG; |
147 | mask = 1UL << (nr & SZLONG_MASK); | 130 | mask = 1UL << (nr & SZLONG_MASK); |
148 | __bi_local_irq_save(flags); | 131 | local_irq_save(flags); |
149 | *a &= ~mask; | 132 | *a &= ~mask; |
150 | __bi_local_irq_restore(flags); | 133 | local_irq_restore(flags); |
151 | } | 134 | } |
152 | } | 135 | } |
153 | 136 | ||
@@ -191,13 +174,13 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr) | |||
191 | } else { | 174 | } else { |
192 | volatile unsigned long *a = addr; | 175 | volatile unsigned long *a = addr; |
193 | unsigned long mask; | 176 | unsigned long mask; |
194 | __bi_flags; | 177 | unsigned long flags; |
195 | 178 | ||
196 | a += nr >> SZLONG_LOG; | 179 | a += nr >> SZLONG_LOG; |
197 | mask = 1UL << (nr & SZLONG_MASK); | 180 | mask = 1UL << (nr & SZLONG_MASK); |
198 | __bi_local_irq_save(flags); | 181 | local_irq_save(flags); |
199 | *a ^= mask; | 182 | *a ^= mask; |
200 | __bi_local_irq_restore(flags); | 183 | local_irq_restore(flags); |
201 | } | 184 | } |
202 | } | 185 | } |
203 | 186 | ||
@@ -258,14 +241,14 @@ static inline int test_and_set_bit(unsigned long nr, | |||
258 | volatile unsigned long *a = addr; | 241 | volatile unsigned long *a = addr; |
259 | unsigned long mask; | 242 | unsigned long mask; |
260 | int retval; | 243 | int retval; |
261 | __bi_flags; | 244 | unsigned long flags; |
262 | 245 | ||
263 | a += nr >> SZLONG_LOG; | 246 | a += nr >> SZLONG_LOG; |
264 | mask = 1UL << (nr & SZLONG_MASK); | 247 | mask = 1UL << (nr & SZLONG_MASK); |
265 | __bi_local_irq_save(flags); | 248 | local_irq_save(flags); |
266 | retval = (mask & *a) != 0; | 249 | retval = (mask & *a) != 0; |
267 | *a |= mask; | 250 | *a |= mask; |
268 | __bi_local_irq_restore(flags); | 251 | local_irq_restore(flags); |
269 | 252 | ||
270 | return retval; | 253 | return retval; |
271 | } | 254 | } |
@@ -330,14 +313,14 @@ static inline int test_and_clear_bit(unsigned long nr, | |||
330 | volatile unsigned long *a = addr; | 313 | volatile unsigned long *a = addr; |
331 | unsigned long mask; | 314 | unsigned long mask; |
332 | int retval; | 315 | int retval; |
333 | __bi_flags; | 316 | unsigned long flags; |
334 | 317 | ||
335 | a += nr >> SZLONG_LOG; | 318 | a += nr >> SZLONG_LOG; |
336 | mask = 1UL << (nr & SZLONG_MASK); | 319 | mask = 1UL << (nr & SZLONG_MASK); |
337 | __bi_local_irq_save(flags); | 320 | local_irq_save(flags); |
338 | retval = (mask & *a) != 0; | 321 | retval = (mask & *a) != 0; |
339 | *a &= ~mask; | 322 | *a &= ~mask; |
340 | __bi_local_irq_restore(flags); | 323 | local_irq_restore(flags); |
341 | 324 | ||
342 | return retval; | 325 | return retval; |
343 | } | 326 | } |
@@ -399,23 +382,19 @@ static inline int test_and_change_bit(unsigned long nr, | |||
399 | } else { | 382 | } else { |
400 | volatile unsigned long *a = addr; | 383 | volatile unsigned long *a = addr; |
401 | unsigned long mask, retval; | 384 | unsigned long mask, retval; |
402 | __bi_flags; | 385 | unsigned long flags; |
403 | 386 | ||
404 | a += nr >> SZLONG_LOG; | 387 | a += nr >> SZLONG_LOG; |
405 | mask = 1UL << (nr & SZLONG_MASK); | 388 | mask = 1UL << (nr & SZLONG_MASK); |
406 | __bi_local_irq_save(flags); | 389 | local_irq_save(flags); |
407 | retval = (mask & *a) != 0; | 390 | retval = (mask & *a) != 0; |
408 | *a ^= mask; | 391 | *a ^= mask; |
409 | __bi_local_irq_restore(flags); | 392 | local_irq_restore(flags); |
410 | 393 | ||
411 | return retval; | 394 | return retval; |
412 | } | 395 | } |
413 | } | 396 | } |
414 | 397 | ||
415 | #undef __bi_flags | ||
416 | #undef __bi_local_irq_save | ||
417 | #undef __bi_local_irq_restore | ||
418 | |||
419 | #include <asm-generic/bitops/non-atomic.h> | 398 | #include <asm-generic/bitops/non-atomic.h> |
420 | 399 | ||
421 | /* | 400 | /* |