summaryrefslogtreecommitdiffstats
path: root/arch/arc/include/asm
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@kernel.org>2020-05-09 09:15:36 +0200
committerVineet Gupta <vgupta@kernel.org>2021-08-24 23:25:47 +0200
commitddc348c44d82d0b55236210d5606ac868e6cc364 (patch)
tree9cdc6d88fa8510b86aee531b2ee129840031b927 /arch/arc/include/asm
parentARC: cmpxchg/xchg: rewrite as macros to make type safe (diff)
downloadlinux-ddc348c44d82d0b55236210d5606ac868e6cc364.tar.xz
linux-ddc348c44d82d0b55236210d5606ac868e6cc364.zip
ARC: cmpxchg/xchg: implement relaxed variants (LLSC config only)
It only makes sense to do this for the LLSC config Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Vineet Gupta <vgupta@kernel.org>
Diffstat (limited to 'arch/arc/include/asm')
-rw-r--r--arch/arc/include/asm/cmpxchg.h11
1 files changed, 2 insertions, 9 deletions
diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h
index 00deb076d6f6..e2ae0eb1ca07 100644
--- a/arch/arc/include/asm/cmpxchg.h
+++ b/arch/arc/include/asm/cmpxchg.h
@@ -38,7 +38,7 @@
_prev; \
})
-#define arch_cmpxchg(ptr, old, new) \
+#define arch_cmpxchg_relaxed(ptr, old, new) \
({ \
__typeof__(ptr) _p_ = (ptr); \
__typeof__(*(ptr)) _o_ = (old); \
@@ -47,12 +47,7 @@
\
switch(sizeof((_p_))) { \
case 4: \
- /* \
- * Explicit full memory barrier needed before/after \
- */ \
- smp_mb(); \
_prev_ = __cmpxchg(_p_, _o_, _n_); \
- smp_mb(); \
break; \
default: \
BUILD_BUG(); \
@@ -108,16 +103,14 @@
_val_; /* get old value */ \
})
-#define arch_xchg(ptr, val) \
+#define arch_xchg_relaxed(ptr, val) \
({ \
__typeof__(ptr) _p_ = (ptr); \
__typeof__(*(ptr)) _val_ = (val); \
\
switch(sizeof(*(_p_))) { \
case 4: \
- smp_mb(); \
_val_ = __xchg(_p_, _val_); \
- smp_mb(); \
break; \
default: \
BUILD_BUG(); \