aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ia64/bitops.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-ia64/bitops.h')
-rw-r--r--include/asm-ia64/bitops.h51
1 files changed, 34 insertions, 17 deletions
diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h
index a977affaebec..953d3df9dd22 100644
--- a/include/asm-ia64/bitops.h
+++ b/include/asm-ia64/bitops.h
@@ -122,27 +122,40 @@ clear_bit_unlock (int nr, volatile void *addr)
122} 122}
123 123
124/** 124/**
125 * __clear_bit_unlock - Non-atomically clear a bit with release 125 * __clear_bit_unlock - Non-atomically clears a bit in memory with release
126 * @nr: Bit to clear
127 * @addr: Address to start counting from
126 * 128 *
127 * This is like clear_bit_unlock, but the implementation may use a non-atomic 129 * Similarly to clear_bit_unlock, the implementation uses a store
128 * store (this one uses an atomic, however). 130 * with release semantics. See also __raw_spin_unlock().
129 */ 131 */
130#define __clear_bit_unlock clear_bit_unlock 132static __inline__ void
133__clear_bit_unlock(int nr, void *addr)
134{
135 __u32 * const m = (__u32 *) addr + (nr >> 5);
136 __u32 const new = *m & ~(1 << (nr & 31));
137
138 ia64_st4_rel_nta(m, new);
139}
131 140
132/** 141/**
133 * __clear_bit - Clears a bit in memory (non-atomic version) 142 * __clear_bit - Clears a bit in memory (non-atomic version)
143 * @nr: the bit to clear
144 * @addr: the address to start counting from
145 *
146 * Unlike clear_bit(), this function is non-atomic and may be reordered.
147 * If it's called on the same region of memory simultaneously, the effect
148 * may be that only one operation succeeds.
134 */ 149 */
135static __inline__ void 150static __inline__ void
136__clear_bit (int nr, volatile void *addr) 151__clear_bit (int nr, volatile void *addr)
137{ 152{
138 volatile __u32 *p = (__u32 *) addr + (nr >> 5); 153 *((__u32 *) addr + (nr >> 5)) &= ~(1 << (nr & 31));
139 __u32 m = 1 << (nr & 31);
140 *p &= ~m;
141} 154}
142 155
143/** 156/**
144 * change_bit - Toggle a bit in memory 157 * change_bit - Toggle a bit in memory
145 * @nr: Bit to clear 158 * @nr: Bit to toggle
146 * @addr: Address to start counting from 159 * @addr: Address to start counting from
147 * 160 *
148 * change_bit() is atomic and may not be reordered. 161 * change_bit() is atomic and may not be reordered.
@@ -167,7 +180,7 @@ change_bit (int nr, volatile void *addr)
167 180
168/** 181/**
169 * __change_bit - Toggle a bit in memory 182 * __change_bit - Toggle a bit in memory
170 * @nr: the bit to set 183 * @nr: the bit to toggle
171 * @addr: the address to start counting from 184 * @addr: the address to start counting from
172 * 185 *
173 * Unlike change_bit(), this function is non-atomic and may be reordered. 186 * Unlike change_bit(), this function is non-atomic and may be reordered.
@@ -186,7 +199,7 @@ __change_bit (int nr, volatile void *addr)
186 * @addr: Address to count from 199 * @addr: Address to count from
187 * 200 *
188 * This operation is atomic and cannot be reordered. 201 * This operation is atomic and cannot be reordered.
189 * It also implies a memory barrier. 202 * It also implies the acquisition side of the memory barrier.
190 */ 203 */
191static __inline__ int 204static __inline__ int
192test_and_set_bit (int nr, volatile void *addr) 205test_and_set_bit (int nr, volatile void *addr)
@@ -236,11 +249,11 @@ __test_and_set_bit (int nr, volatile void *addr)
236 249
237/** 250/**
238 * test_and_clear_bit - Clear a bit and return its old value 251 * test_and_clear_bit - Clear a bit and return its old value
239 * @nr: Bit to set 252 * @nr: Bit to clear
240 * @addr: Address to count from 253 * @addr: Address to count from
241 * 254 *
242 * This operation is atomic and cannot be reordered. 255 * This operation is atomic and cannot be reordered.
243 * It also implies a memory barrier. 256 * It also implies the acquisition side of the memory barrier.
244 */ 257 */
245static __inline__ int 258static __inline__ int
246test_and_clear_bit (int nr, volatile void *addr) 259test_and_clear_bit (int nr, volatile void *addr)
@@ -261,7 +274,7 @@ test_and_clear_bit (int nr, volatile void *addr)
261 274
262/** 275/**
263 * __test_and_clear_bit - Clear a bit and return its old value 276 * __test_and_clear_bit - Clear a bit and return its old value
264 * @nr: Bit to set 277 * @nr: Bit to clear
265 * @addr: Address to count from 278 * @addr: Address to count from
266 * 279 *
267 * This operation is non-atomic and can be reordered. 280 * This operation is non-atomic and can be reordered.
@@ -281,11 +294,11 @@ __test_and_clear_bit(int nr, volatile void * addr)
281 294
282/** 295/**
283 * test_and_change_bit - Change a bit and return its old value 296 * test_and_change_bit - Change a bit and return its old value
284 * @nr: Bit to set 297 * @nr: Bit to change
285 * @addr: Address to count from 298 * @addr: Address to count from
286 * 299 *
287 * This operation is atomic and cannot be reordered. 300 * This operation is atomic and cannot be reordered.
288 * It also implies a memory barrier. 301 * It also implies the acquisition side of the memory barrier.
289 */ 302 */
290static __inline__ int 303static __inline__ int
291test_and_change_bit (int nr, volatile void *addr) 304test_and_change_bit (int nr, volatile void *addr)
@@ -304,8 +317,12 @@ test_and_change_bit (int nr, volatile void *addr)
304 return (old & bit) != 0; 317 return (old & bit) != 0;
305} 318}
306 319
307/* 320/**
308 * WARNING: non atomic version. 321 * __test_and_change_bit - Change a bit and return its old value
322 * @nr: Bit to change
323 * @addr: Address to count from
324 *
325 * This operation is non-atomic and can be reordered.
309 */ 326 */
310static __inline__ int 327static __inline__ int
311__test_and_change_bit (int nr, void *addr) 328__test_and_change_bit (int nr, void *addr)