Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

asm-generic: percpu: Add assembly guard

Currently, asm/percpu.h is directly or indirectly included by
some assembly files on x86. Some of them (e.g., checksum_32.S)
are also used on um. But x86 and um provide different versions
of asm/percpu.h -- um uses asm-generic/percpu.h directly.

When SMP is enabled, asm-generic/percpu.h will introduce C code
that cannot be assembled. Since asm-generic/percpu.h currently
is not designed for use in assembly, and these assembly files
do not actually need asm/percpu.h on um, let's add the assembly
guard in asm-generic/percpu.h to fix this issue.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arch@vger.kernel.org
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20251027001815.1666872-8-tiwei.bie@linux.dev
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Tiwei Bie and committed by
Johannes Berg
8d748955 37f847b7

+3
+3
include/asm-generic/percpu.h
··· 2 2 #ifndef _ASM_GENERIC_PERCPU_H_ 3 3 #define _ASM_GENERIC_PERCPU_H_ 4 4 5 + #ifndef __ASSEMBLER__ 6 + 5 7 #include <linux/compiler.h> 6 8 #include <linux/threads.h> 7 9 #include <linux/percpu-defs.h> ··· 559 557 this_cpu_generic_cmpxchg(pcp, oval, nval) 560 558 #endif 561 559 560 + #endif /* __ASSEMBLER__ */ 562 561 #endif /* _ASM_GENERIC_PERCPU_H_ */