avr32: Provide atomic_{or,xor,and}
authorPeter Zijlstra <peterz@infradead.org>
Wed, 23 Apr 2014 18:02:20 +0000 (20:02 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 27 Jul 2015 12:06:22 +0000 (14:06 +0200)
Implement atomic logic ops -- atomic_{or,xor,and}.

These will replace the atomic_{set,clear}_mask functions that are
available on some archs.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/avr32/include/asm/atomic.h

index 2d07ce1c5327cae2f0428714757ecf0163b8605d..115d3005e4bc1d00a9e173d494016cdbdf80a617 100644 (file)
@@ -44,6 +44,20 @@ static inline int __atomic_##op##_return(int i, atomic_t *v)         \
 ATOMIC_OP_RETURN(sub, sub, rKs21)
 ATOMIC_OP_RETURN(add, add, r)
 
+#define ATOMIC_OP(op, asm_op)                                          \
+ATOMIC_OP_RETURN(op, asm_op, r)                                                \
+static inline void atomic_##op(int i, atomic_t *v)                     \
+{                                                                      \
+       (void)__atomic_##op##_return(i, v);                             \
+}
+
+#define CONFIG_ARCH_HAS_ATOMIC_OR
+
+ATOMIC_OP(and, and)
+ATOMIC_OP(or, or)
+ATOMIC_OP(xor, eor)
+
+#undef ATOMIC_OP
 #undef ATOMIC_OP_RETURN
 
 /*