Skip to contentSkip to conversation

locking/atomic: sh: Use generic_cmpxchg_local for arch_cmpxchg_local()

PATCH In review Masami Hiramatsu (Google) 3 participants 3 messages Oct 25, 2023 – Nov 2, 2023

Subsystems (2)
lore
Share & tools
lore

Masami Hiramatsu (Google)

author maintainer
#0 lore raw

PATCH v2 1/1 locking/atomic: sh: Use generic_cmpxchg_local for arch_cmpxchg_local()

From: Masami Hiramatsu (Google) <[email protected]>

Use __generic_cmpxchg_local() for arch_cmpxchg_local() implementation in SH architecture because it does not implement arch_cmpxchg_local().

---
 arch/sh/include/asm/cmpxchg.h |    9 +++++++++
 1 file changed, 9 insertions(+)
arch/sh/include/asm/cmpxchg.h +9 -0
index 288f6f38d98f..5d617b3ef78f 100644
@@ -71,4 +71,13 @@ static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
 				    (unsigned long)_n_, sizeof(*(ptr))); \
   })
 
+#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)));	\
+})
+
 #endif /* __ASM_SH_CMPXCHG_H */
Reviewed-by on v2 1/1
#1 lore raw
Quoted 8 lines · Masami Hiramatsu (Google)

From: Masami Hiramatsu (Google) <[email protected]>

Use __generic_cmpxchg_local() for arch_cmpxchg_local() implementation in SH architecture because it does not implement arch_cmpxchg_local().

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
maintainer Reviewed-by on v2 1/1
#2 lore raw
In reply to Masami Hiramatsu (Google)
Quoted 20 lines · Masami Hiramatsu (Google)

From: Masami Hiramatsu (Google) <[email protected]>

Use __generic_cmpxchg_local() for arch_cmpxchg_local() implementation in SH architecture because it does not implement arch_cmpxchg_local().

---
 arch/sh/include/asm/cmpxchg.h |    9 +++++++++
 1 file changed, 9 insertions(+)
arch/sh/include/asm/cmpxchg.h +0 -0
index 288f6f38d98f..5d617b3ef78f 100644
@@ -71,4 +71,13 @@ static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
 				    (unsigned long)_n_, sizeof(*(ptr))); \
   })
 

arch/sh/include/asm/cmpxchg.h static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old, · line 83

Quoted 10 lines
arch/sh/include/asm/cmpxchg.h +9 -0
+#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)));	\
+})
+
 #endif /* __ASM_SH_CMPXCHG_H */
Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913