arch_cmpxchg[64]_local() are not defined for openrisc. So implement
them with generci_cmpxchg[64]_local, advised by Masami Hiramatsu.

Closes: 
https://lore.kernel.org/linux-trace-kernel/169824660459.24340.14614817132696360531.stgit@devnote2
Closes: 
https://lore.kernel.org/oe-kbuild-all/[email protected]

Signed-off-by: wuqiang.matt <[email protected]>
---
 arch/openrisc/include/asm/cmpxchg.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/openrisc/include/asm/cmpxchg.h 
b/arch/openrisc/include/asm/cmpxchg.h
index 8ee151c072e4..7d0555257389 100644
--- a/arch/openrisc/include/asm/cmpxchg.h
+++ b/arch/openrisc/include/asm/cmpxchg.h
@@ -168,4 +168,18 @@ __arch_xchg(volatile void *ptr, unsigned long with, int 
size)
                                                 sizeof(*(ptr)));       \
        })
 
+/*
+ * always make arch_cmpxchg[64]_local available. __generic_cmpxchg[64]_local
+ * are atomic with respect to current cpu.
+ */
+#include <asm-generic/cmpxchg-local.h>
+
+#define arch_cmpxchg_local(ptr, o, n) ({                               \
+       (__typeof__(*ptr))__generic_cmpxchg_local((ptr),                \
+                                               (unsigned long)(o),     \
+                                               (unsigned long)(n),     \
+                                               sizeof(*(ptr)));        \
+})
+#define arch_cmpxchg64_local(ptr, o, n) __generic_cmpxchg64_local((ptr), (o), 
(n))
+
 #endif /* __ASM_OPENRISC_CMPXCHG_H */
-- 
2.40.1


Reply via email to