Go to the documentation of this file. 1 #ifndef _ALPHA_ATOMIC_H
2 #define _ALPHA_ATOMIC_H
4 #include <linux/types.h>
5 #include <asm/barrier.h>
6 #include <asm/cmpxchg.h>
17 #define ATOMIC_INIT(i) { (i) }
18 #define ATOMIC64_INIT(i) { (i) }
20 #define atomic_read(v) (*(volatile int *)&(v)->counter)
21 #define atomic64_read(v) (*(volatile long *)&(v)->counter)
23 #define atomic_set(v,i) ((v)->counter = (i))
24 #define atomic64_set(v,i) ((v)->counter = (i))
43 :
"=&r" (temp),
"=m" (v->
counter)
58 :
"=&r" (temp),
"=m" (v->
counter)
73 :
"=&r" (temp),
"=m" (v->
counter)
88 :
"=&r" (temp),
"=m" (v->
counter)
109 :
"=&r" (temp),
"=m" (v->
counter),
"=&r" (result)
110 :
"Ir" (i),
"m" (v->
counter) :
"memory");
128 :
"=&r" (temp),
"=m" (v->
counter),
"=&r" (result)
129 :
"Ir" (i),
"m" (v->
counter) :
"memory");
147 :
"=&r" (temp),
"=m" (v->
counter),
"=&r" (result)
148 :
"Ir" (i),
"m" (v->
counter) :
"memory");
166 :
"=&r" (temp),
"=m" (v->
counter),
"=&r" (result)
167 :
"Ir" (i),
"m" (v->
counter) :
"memory");
172 #define atomic64_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new))
173 #define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
175 #define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new))
176 #define atomic_xchg(v, new) (xchg(&((v)->counter), new))
227 #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
229 #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
230 #define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) < 0)
232 #define atomic_dec_return(v) atomic_sub_return(1,(v))
233 #define atomic64_dec_return(v) atomic64_sub_return(1,(v))
235 #define atomic_inc_return(v) atomic_add_return(1,(v))
236 #define atomic64_inc_return(v) atomic64_add_return(1,(v))
238 #define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
239 #define atomic64_sub_and_test(i,v) (atomic64_sub_return((i), (v)) == 0)
241 #define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
242 #define atomic64_inc_and_test(v) (atomic64_add_return(1, (v)) == 0)
244 #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
245 #define atomic64_dec_and_test(v) (atomic64_sub_return(1, (v)) == 0)
247 #define atomic_inc(v) atomic_add(1,(v))
248 #define atomic64_inc(v) atomic64_add(1,(v))
250 #define atomic_dec(v) atomic_sub(1,(v))
251 #define atomic64_dec(v) atomic64_sub(1,(v))
253 #define smp_mb__before_atomic_dec() smp_mb()
254 #define smp_mb__after_atomic_dec() smp_mb()
255 #define smp_mb__before_atomic_inc() smp_mb()
256 #define smp_mb__after_atomic_inc() smp_mb()