summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/atomic64_32.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2014-04-23 20:28:37 +0200
committerThomas Gleixner <tglx@linutronix.de>2015-07-27 14:06:23 +0200
commit7fc1845dd45a825b3c2b760df342a94f61fb1113 (patch)
treebeac8c005d76389fbba5d251cc5774e9428c3ecb /arch/x86/include/asm/atomic64_32.h
parentae8c35c85be92b79c545c57c2a14c2f8136d3353 (diff)
downloadlinux-0-day-7fc1845dd45a825b3c2b760df342a94f61fb1113.tar.gz
linux-0-day-7fc1845dd45a825b3c2b760df342a94f61fb1113.tar.xz
x86: 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. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/include/asm/atomic64_32.h')
-rw-r--r--arch/x86/include/asm/atomic64_32.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/x86/include/asm/atomic64_32.h b/arch/x86/include/asm/atomic64_32.h
index b154de75c90cb..a11c30b77fb57 100644
--- a/arch/x86/include/asm/atomic64_32.h
+++ b/arch/x86/include/asm/atomic64_32.h
@@ -313,4 +313,18 @@ static inline long long atomic64_dec_if_positive(atomic64_t *v)
#undef alternative_atomic64
#undef __alternative_atomic64
+#define ATOMIC64_OP(op, c_op) \
+static inline void atomic64_##op(long long i, atomic64_t *v) \
+{ \
+ long long old, c = 0; \
+ while ((old = atomic64_cmpxchg(v, c, c c_op i)) != c) \
+ c = old; \
+}
+
+ATOMIC64_OP(and, &)
+ATOMIC64_OP(or, |)
+ATOMIC64_OP(xor, ^)
+
+#undef ATOMIC64_OP
+
#endif /* _ASM_X86_ATOMIC64_32_H */