Re: [PATCH v3] arch: rename all internal names __xchg to __arch_xchg

2023-01-03 Thread Heiko Carstens
On Fri, Dec 30, 2022 at 03:15:52PM +0100, Andrzej Hajda wrote:
> __xchg will be used for non-atomic xchg macro.
> 
> Signed-off-by: Andrzej Hajda 
> Reviewed-by: Arnd Bergmann 
> ---
> v2: squashed all arch patches into one
> v3: fixed alpha/xchg_local, thx to l...@intel.com
> ---
...
>  arch/s390/include/asm/cmpxchg.h  | 4 ++--
> diff --git a/arch/s390/include/asm/cmpxchg.h b/arch/s390/include/asm/cmpxchg.h
> index 84c3f0d576c5b1..efc16f4aac8643 100644
> --- a/arch/s390/include/asm/cmpxchg.h
> +++ b/arch/s390/include/asm/cmpxchg.h
> @@ -14,7 +14,7 @@
>  
>  void __xchg_called_with_bad_pointer(void);
>  
> -static __always_inline unsigned long __xchg(unsigned long x,
> +static __always_inline unsigned long __arch_xchg(unsigned long x,
>   unsigned long address, int size)

Please adjust the alignment of the second line.

> @@ -77,7 +77,7 @@ static __always_inline unsigned long __xchg(unsigned long x,
>   __typeof__(*(ptr)) __ret;   \
>   \
>   __ret = (__typeof__(*(ptr)))\
> - __xchg((unsigned long)(x), (unsigned long)(ptr),\
> + __arch_xchg((unsigned long)(x), (unsigned long)(ptr),   \
>  sizeof(*(ptr))); \

Same here.

The same is true for a couple of other architectures - not sure if
they care however.


[PATCH v3] arch: rename all internal names __xchg to __arch_xchg

2022-12-30 Thread Andrzej Hajda
__xchg will be used for non-atomic xchg macro.

Signed-off-by: Andrzej Hajda 
Reviewed-by: Arnd Bergmann 
---
v2: squashed all arch patches into one
v3: fixed alpha/xchg_local, thx to l...@intel.com
---
 arch/alpha/include/asm/cmpxchg.h | 8 
 arch/arc/include/asm/cmpxchg.h   | 4 ++--
 arch/arm/include/asm/cmpxchg.h   | 4 ++--
 arch/arm64/include/asm/cmpxchg.h | 4 ++--
 arch/hexagon/include/asm/cmpxchg.h   | 6 +++---
 arch/ia64/include/asm/cmpxchg.h  | 2 +-
 arch/ia64/include/uapi/asm/cmpxchg.h | 4 ++--
 arch/loongarch/include/asm/cmpxchg.h | 4 ++--
 arch/m68k/include/asm/cmpxchg.h  | 6 +++---
 arch/mips/include/asm/cmpxchg.h  | 4 ++--
 arch/openrisc/include/asm/cmpxchg.h  | 4 ++--
 arch/parisc/include/asm/cmpxchg.h| 4 ++--
 arch/powerpc/include/asm/cmpxchg.h   | 4 ++--
 arch/riscv/include/asm/atomic.h  | 2 +-
 arch/riscv/include/asm/cmpxchg.h | 4 ++--
 arch/s390/include/asm/cmpxchg.h  | 4 ++--
 arch/sh/include/asm/cmpxchg.h| 4 ++--
 arch/sparc/include/asm/cmpxchg_32.h  | 4 ++--
 arch/sparc/include/asm/cmpxchg_64.h  | 4 ++--
 arch/xtensa/include/asm/cmpxchg.h| 4 ++--
 20 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/arch/alpha/include/asm/cmpxchg.h b/arch/alpha/include/asm/cmpxchg.h
index 6e0a850aa9d38c..e0cb5b5c1c54b9 100644
--- a/arch/alpha/include/asm/cmpxchg.h
+++ b/arch/alpha/include/asm/cmpxchg.h
@@ -6,14 +6,14 @@
  * Atomic exchange routines.
  */
 
-#define xchg(type, args...)__xchg ## type ## _local(args)
+#define xchg(type, args...)__arch_xchg ## type ## 
_local(args)
 #define cmpxchg(type, args...) __cmpxchg ## type ## _local(args)
 #include 
 
 #define xchg_local(ptr, x) \
 ({ \
__typeof__(*(ptr)) _x_ = (x);   \
-   (__typeof__(*(ptr))) __xchg_local((ptr), (unsigned long)_x_,\
+   (__typeof__(*(ptr))) __arch_xchg_local((ptr), (unsigned long)_x_,\
   sizeof(*(ptr))); \
 })
 
@@ -34,7 +34,7 @@
 
 #undef xchg
 #undef cmpxchg
-#define xchg(type, args...)__xchg ##type(args)
+#define xchg(type, args...)__arch_xchg ##type(args)
 #define cmpxchg(type, args...) __cmpxchg ##type(args)
 #include 
 
@@ -48,7 +48,7 @@
__typeof__(*(ptr)) _x_ = (x);   \
smp_mb();   \
__ret = (__typeof__(*(ptr)))\
-   __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr)));  \
+   __arch_xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \
smp_mb();   \
__ret;  \
 })
diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h
index c5b544a5fe8106..e138fde067dea5 100644
--- a/arch/arc/include/asm/cmpxchg.h
+++ b/arch/arc/include/asm/cmpxchg.h
@@ -85,7 +85,7 @@
  */
 #ifdef CONFIG_ARC_HAS_LLSC
 
-#define __xchg(ptr, val)   \
+#define __arch_xchg(ptr, val)  \
 ({ \
__asm__ __volatile__(   \
"   ex  %0, [%1]\n" /* set new value */ \
@@ -102,7 +102,7 @@
\
switch(sizeof(*(_p_))) {\
case 4: \
-   _val_ = __xchg(_p_, _val_); \
+   _val_ = __arch_xchg(_p_, _val_);\
break;  \
default:\
BUILD_BUG();\
diff --git a/arch/arm/include/asm/cmpxchg.h b/arch/arm/include/asm/cmpxchg.h
index 4dfe538dfc689b..6953fc05a97886 100644
--- a/arch/arm/include/asm/cmpxchg.h
+++ b/arch/arm/include/asm/cmpxchg.h
@@ -25,7 +25,7 @@
 #define swp_is_buggy
 #endif
 
-static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int 
size)
+static inline unsigned long __arch_xchg(unsigned long x, volatile void *ptr, 
int size)
 {
extern void __bad_xchg(volatile void *, int);
unsigned long ret;
@@ -115,7 +115,7 @@ static inline unsigned long __xchg(unsigned long x, 
volatile void *ptr, int size
 }
 
 #define arch_xchg_relaxed(ptr, x) ({   \
-   (__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr),   \
+