summaryrefslogtreecommitdiff
path: root/arch/arc/include/asm/atomic.h
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@kernel.org>2020-05-11 13:27:23 -0700
committerVineet Gupta <vgupta@kernel.org>2021-08-24 14:25:47 -0700
commit301014cf6d72836dd5fd5b3e9c92633f35b298c0 (patch)
tree0c96401283a492b5e5dcc238fc8e957ed2897fa7 /arch/arc/include/asm/atomic.h
parentddc348c44d82d0b55236210d5606ac868e6cc364 (diff)
ARC: atomic_cmpxchg/atomic_xchg: implement relaxed variants
And move them out of cmpxchg.h to canonical atomic.h Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Vineet Gupta <vgupta@kernel.org>
Diffstat (limited to 'arch/arc/include/asm/atomic.h')
-rw-r--r--arch/arc/include/asm/atomic.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h
index ee88e1dbaab5..52ee51e1ff7c 100644
--- a/arch/arc/include/asm/atomic.h
+++ b/arch/arc/include/asm/atomic.h
@@ -22,6 +22,33 @@
#include <asm/atomic-spinlock.h>
#endif
+#define arch_atomic_cmpxchg(v, o, n) \
+({ \
+ arch_cmpxchg(&((v)->counter), (o), (n)); \
+})
+
+#ifdef arch_cmpxchg_relaxed
+#define arch_atomic_cmpxchg_relaxed(v, o, n) \
+({ \
+ arch_cmpxchg_relaxed(&((v)->counter), (o), (n)); \
+})
+#endif
+
+#define arch_atomic_xchg(v, n) \
+({ \
+ arch_xchg(&((v)->counter), (n)); \
+})
+
+#ifdef arch_xchg_relaxed
+#define arch_atomic_xchg_relaxed(v, n) \
+({ \
+ arch_xchg_relaxed(&((v)->counter), (n)); \
+})
+#endif
+
+/*
+ * 64-bit atomics
+ */
#ifdef CONFIG_GENERIC_ATOMIC64
#include <asm-generic/atomic64.h>
#else