x86/percpu: Refer __percpu_prefix to __force_percpu_prefix
authorUros Bizjak <ubizjak@gmail.com>
Fri, 11 Apr 2025 09:31:17 +0000 (11:31 +0200)
committerIngo Molnar <mingo@kernel.org>
Sun, 13 Apr 2025 07:48:24 +0000 (09:48 +0200)
Refer __percpu_prefix to __force_percpu_prefix to avoid duplicate
definition. While there, slightly reorder definitions to a more
logical sequence, remove unneeded double quotes and move misplaced
comment to the right place.

No functional changes intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Link: https://lore.kernel.org/r/20250411093130.81389-1-ubizjak@gmail.com
arch/x86/include/asm/percpu.h

index 5fe314a2e73eacebd35798533221f64f26a0224f..b0d03b6c279bee16cb029989ff4f08786696d333 100644 (file)
@@ -29,6 +29,8 @@
 
 #ifdef CONFIG_SMP
 
+#define __force_percpu_prefix  "%%"__stringify(__percpu_seg)":"
+
 #ifdef CONFIG_CC_HAS_NAMED_AS
 
 #ifdef __CHECKER__
 # define __seg_fs              __attribute__((address_space(__seg_fs)))
 #endif
 
+#define __percpu_prefix
 #define __percpu_seg_override  CONCATENATE(__seg_, __percpu_seg)
-#define __percpu_prefix                ""
 
 #else /* !CONFIG_CC_HAS_NAMED_AS: */
 
+#define __percpu_prefix                __force_percpu_prefix
 #define __percpu_seg_override
-#define __percpu_prefix                "%%"__stringify(__percpu_seg)":"
 
 #endif /* CONFIG_CC_HAS_NAMED_AS */
 
-#define __force_percpu_prefix  "%%"__stringify(__percpu_seg)":"
-#define __my_cpu_offset                this_cpu_read(this_cpu_off)
-
 /*
  * Compared to the generic __my_cpu_offset version, the following
  * saves one instruction and avoids clobbering a temp register.
- *
+ */
+#define __my_cpu_offset                this_cpu_read(this_cpu_off)
+
+/*
  * arch_raw_cpu_ptr should not be used in 32-bit VDSO for a 64-bit
  * kernel, because games are played with CONFIG_X86_64 there and
  * sizeof(this_cpu_off) becames 4.
@@ -77,9 +79,9 @@
 
 #else /* !CONFIG_SMP: */
 
+#define __force_percpu_prefix
+#define __percpu_prefix
 #define __percpu_seg_override
-#define __percpu_prefix                ""
-#define __force_percpu_prefix  ""
 
 #define PER_CPU_VAR(var)       (var)__percpu_rel
 
@@ -97,8 +99,8 @@
 # define __my_cpu_var(var)     (*__my_cpu_ptr(&(var)))
 #endif
 
-#define __percpu_arg(x)                __percpu_prefix "%" #x
 #define __force_percpu_arg(x)  __force_percpu_prefix "%" #x
+#define __percpu_arg(x)                __percpu_prefix "%" #x
 
 /*
  * For arch-specific code, we can use direct single-insn ops (they