Lines Matching full:v
19 * @v: pointer of type atomic_t
21 * Atomically reads the value of @v.
23 static __always_inline int arch_atomic_read(const atomic_t *v) in arch_atomic_read() argument
29 return __READ_ONCE((v)->counter); in arch_atomic_read()
34 * @v: pointer of type atomic_t
37 * Atomically sets the value of @v to @i.
39 static __always_inline void arch_atomic_set(atomic_t *v, int i) in arch_atomic_set() argument
41 __WRITE_ONCE(v->counter, i); in arch_atomic_set()
47 * @v: pointer of type atomic_t
49 * Atomically adds @i to @v.
51 static __always_inline void arch_atomic_add(int i, atomic_t *v) in arch_atomic_add() argument
54 : "+m" (v->counter) in arch_atomic_add()
61 * @v: pointer of type atomic_t
63 * Atomically subtracts @i from @v.
65 static __always_inline void arch_atomic_sub(int i, atomic_t *v) in arch_atomic_sub() argument
68 : "+m" (v->counter) in arch_atomic_sub()
75 * @v: pointer of type atomic_t
77 * Atomically subtracts @i from @v and returns
81 static __always_inline bool arch_atomic_sub_and_test(int i, atomic_t *v) in arch_atomic_sub_and_test() argument
83 return GEN_BINARY_RMWcc(LOCK_PREFIX "subl", v->counter, e, "er", i); in arch_atomic_sub_and_test()
89 * @v: pointer of type atomic_t
91 * Atomically increments @v by 1.
93 static __always_inline void arch_atomic_inc(atomic_t *v) in arch_atomic_inc() argument
96 : "+m" (v->counter) :: "memory"); in arch_atomic_inc()
102 * @v: pointer of type atomic_t
104 * Atomically decrements @v by 1.
106 static __always_inline void arch_atomic_dec(atomic_t *v) in arch_atomic_dec() argument
109 : "+m" (v->counter) :: "memory"); in arch_atomic_dec()
115 * @v: pointer of type atomic_t
117 * Atomically decrements @v by 1 and
121 static __always_inline bool arch_atomic_dec_and_test(atomic_t *v) in arch_atomic_dec_and_test() argument
123 return GEN_UNARY_RMWcc(LOCK_PREFIX "decl", v->counter, e); in arch_atomic_dec_and_test()
129 * @v: pointer of type atomic_t
131 * Atomically increments @v by 1
135 static __always_inline bool arch_atomic_inc_and_test(atomic_t *v) in arch_atomic_inc_and_test() argument
137 return GEN_UNARY_RMWcc(LOCK_PREFIX "incl", v->counter, e); in arch_atomic_inc_and_test()
144 * @v: pointer of type atomic_t
146 * Atomically adds @i to @v and returns true
150 static __always_inline bool arch_atomic_add_negative(int i, atomic_t *v) in arch_atomic_add_negative() argument
152 return GEN_BINARY_RMWcc(LOCK_PREFIX "addl", v->counter, s, "er", i); in arch_atomic_add_negative()
159 * @v: pointer of type atomic_t
161 * Atomically adds @i to @v and returns @i + @v
163 static __always_inline int arch_atomic_add_return(int i, atomic_t *v) in arch_atomic_add_return() argument
165 return i + xadd(&v->counter, i); in arch_atomic_add_return()
171 * @v: pointer of type atomic_t
174 * Atomically subtracts @i from @v and returns @v - @i
176 static __always_inline int arch_atomic_sub_return(int i, atomic_t *v) in arch_atomic_sub_return() argument
178 return arch_atomic_add_return(-i, v); in arch_atomic_sub_return()
182 static __always_inline int arch_atomic_fetch_add(int i, atomic_t *v) in arch_atomic_fetch_add() argument
184 return xadd(&v->counter, i); in arch_atomic_fetch_add()
188 static __always_inline int arch_atomic_fetch_sub(int i, atomic_t *v) in arch_atomic_fetch_sub() argument
190 return xadd(&v->counter, -i); in arch_atomic_fetch_sub()
194 static __always_inline int arch_atomic_cmpxchg(atomic_t *v, int old, int new) in arch_atomic_cmpxchg() argument
196 return arch_cmpxchg(&v->counter, old, new); in arch_atomic_cmpxchg()
200 static __always_inline bool arch_atomic_try_cmpxchg(atomic_t *v, int *old, int new) in arch_atomic_try_cmpxchg() argument
202 return try_cmpxchg(&v->counter, old, new); in arch_atomic_try_cmpxchg()
206 static __always_inline int arch_atomic_xchg(atomic_t *v, int new) in arch_atomic_xchg() argument
208 return arch_xchg(&v->counter, new); in arch_atomic_xchg()
212 static __always_inline void arch_atomic_and(int i, atomic_t *v) in arch_atomic_and() argument
215 : "+m" (v->counter) in arch_atomic_and()
220 static __always_inline int arch_atomic_fetch_and(int i, atomic_t *v) in arch_atomic_fetch_and() argument
222 int val = arch_atomic_read(v); in arch_atomic_fetch_and()
224 do { } while (!arch_atomic_try_cmpxchg(v, &val, val & i)); in arch_atomic_fetch_and()
230 static __always_inline void arch_atomic_or(int i, atomic_t *v) in arch_atomic_or() argument
233 : "+m" (v->counter) in arch_atomic_or()
238 static __always_inline int arch_atomic_fetch_or(int i, atomic_t *v) in arch_atomic_fetch_or() argument
240 int val = arch_atomic_read(v); in arch_atomic_fetch_or()
242 do { } while (!arch_atomic_try_cmpxchg(v, &val, val | i)); in arch_atomic_fetch_or()
248 static __always_inline void arch_atomic_xor(int i, atomic_t *v) in arch_atomic_xor() argument
251 : "+m" (v->counter) in arch_atomic_xor()
256 static __always_inline int arch_atomic_fetch_xor(int i, atomic_t *v) in arch_atomic_fetch_xor() argument
258 int val = arch_atomic_read(v); in arch_atomic_fetch_xor()
260 do { } while (!arch_atomic_try_cmpxchg(v, &val, val ^ i)); in arch_atomic_fetch_xor()