diff options
author | Nick Piggin <npiggin@suse.de> | 2007-10-18 06:06:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-18 17:37:29 -0400 |
commit | 87371e4fa4901d84ce83356b909b83f31f40758f (patch) | |
tree | e80ec52481501392a8c6cf9b9d4ba937c48db0cb /include/asm-ia64/bitops.h | |
parent | 44086d5286c57c86622dee37684decf32355aa7c (diff) |
ia64: lock bitops
Convert ia64 to new bitops.
Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: "Luck, Tony" <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-ia64/bitops.h')
-rw-r--r-- | include/asm-ia64/bitops.h | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h index 569dd62fe192..2144f1a8ed6f 100644 --- a/include/asm-ia64/bitops.h +++ b/include/asm-ia64/bitops.h | |||
@@ -94,6 +94,38 @@ clear_bit (int nr, volatile void *addr) | |||
94 | } | 94 | } |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * clear_bit_unlock - Clears a bit in memory with release | ||
98 | * @nr: Bit to clear | ||
99 | * @addr: Address to start counting from | ||
100 | * | ||
101 | * clear_bit_unlock() is atomic and may not be reordered. It does | ||
102 | * contain a memory barrier suitable for unlock type operations. | ||
103 | */ | ||
104 | static __inline__ void | ||
105 | clear_bit_unlock (int nr, volatile void *addr) | ||
106 | { | ||
107 | __u32 mask, old, new; | ||
108 | volatile __u32 *m; | ||
109 | CMPXCHG_BUGCHECK_DECL | ||
110 | |||
111 | m = (volatile __u32 *) addr + (nr >> 5); | ||
112 | mask = ~(1 << (nr & 31)); | ||
113 | do { | ||
114 | CMPXCHG_BUGCHECK(m); | ||
115 | old = *m; | ||
116 | new = old & mask; | ||
117 | } while (cmpxchg_rel(m, old, new) != old); | ||
118 | } | ||
119 | |||
120 | /** | ||
121 | * __clear_bit_unlock - Non-atomically clear a bit with release | ||
122 | * | ||
123 | * This is like clear_bit_unlock, but the implementation may use a non-atomic | ||
124 | * store (this one uses an atomic, however). | ||
125 | */ | ||
126 | #define __clear_bit_unlock clear_bit_unlock | ||
127 | |||
128 | /** | ||
97 | * __clear_bit - Clears a bit in memory (non-atomic version) | 129 | * __clear_bit - Clears a bit in memory (non-atomic version) |
98 | */ | 130 | */ |
99 | static __inline__ void | 131 | static __inline__ void |
@@ -170,6 +202,15 @@ test_and_set_bit (int nr, volatile void *addr) | |||
170 | } | 202 | } |
171 | 203 | ||
172 | /** | 204 | /** |
205 | * test_and_set_bit_lock - Set a bit and return its old value for lock | ||
206 | * @nr: Bit to set | ||
207 | * @addr: Address to count from | ||
208 | * | ||
209 | * This is the same as test_and_set_bit on ia64 | ||
210 | */ | ||
211 | #define test_and_set_bit_lock test_and_set_bit | ||
212 | |||
213 | /** | ||
173 | * __test_and_set_bit - Set a bit and return its old value | 214 | * __test_and_set_bit - Set a bit and return its old value |
174 | * @nr: Bit to set | 215 | * @nr: Bit to set |
175 | * @addr: Address to count from | 216 | * @addr: Address to count from |
@@ -371,8 +412,6 @@ hweight64 (unsigned long x) | |||
371 | #define hweight16(x) (unsigned int) hweight64((x) & 0xfffful) | 412 | #define hweight16(x) (unsigned int) hweight64((x) & 0xfffful) |
372 | #define hweight8(x) (unsigned int) hweight64((x) & 0xfful) | 413 | #define hweight8(x) (unsigned int) hweight64((x) & 0xfful) |
373 | 414 | ||
374 | #include <asm-generic/bitops/lock.h> | ||
375 | |||
376 | #endif /* __KERNEL__ */ | 415 | #endif /* __KERNEL__ */ |
377 | 416 | ||
378 | #include <asm-generic/bitops/find.h> | 417 | #include <asm-generic/bitops/find.h> |