aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2014-04-23 14:06:20 -0400
committerThomas Gleixner <tglx@linutronix.de>2015-07-27 08:06:21 -0400
commitcda7e4137a4e39c7d877b6ed41da13a5b30dd2cf (patch)
tree9339f7096a482c0171414880d438c4134aa1386a /arch/arc
parent212d3be102d73dce70cc12f39dce4e0aed2c025b (diff)
arc: Provide atomic_{or,xor,and}
Implement atomic logic ops -- atomic_{or,xor,and}. These will replace the atomic_{set,clear}_mask functions that are available on some archs. Acked-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/arc')
-rw-r--r--arch/arc/include/asm/atomic.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h
index 03484cb4d16d..e90b701fc6a8 100644
--- a/arch/arc/include/asm/atomic.h
+++ b/arch/arc/include/asm/atomic.h
@@ -143,14 +143,29 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \
143 143
144ATOMIC_OPS(add, +=, add) 144ATOMIC_OPS(add, +=, add)
145ATOMIC_OPS(sub, -=, sub) 145ATOMIC_OPS(sub, -=, sub)
146ATOMIC_OP(and, &=, and)
147 146
148#define atomic_clear_mask(mask, v) atomic_and(~(mask), (v)) 147#define CONFIG_ARCH_HAS_ATOMIC_OR
148#define atomic_andnot atomic_andnot
149
150ATOMIC_OP(and, &=, and)
151ATOMIC_OP(andnot, &= ~, bic)
152ATOMIC_OP(or, |=, or)
153ATOMIC_OP(xor, ^=, xor)
149 154
150#undef ATOMIC_OPS 155#undef ATOMIC_OPS
151#undef ATOMIC_OP_RETURN 156#undef ATOMIC_OP_RETURN
152#undef ATOMIC_OP 157#undef ATOMIC_OP
153 158
159static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
160{
161 atomic_and(~mask, v);
162}
163
164static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
165{
166 atomic_or(mask, v);
167}
168
154/** 169/**
155 * __atomic_add_unless - add unless the number is a given value 170 * __atomic_add_unless - add unless the number is a given value
156 * @v: pointer of type atomic_t 171 * @v: pointer of type atomic_t