asm-generic: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers
PATCH 1/1 asm-generic: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-uapi headers
While the GCC and Clang compilers already define __ASSEMBLER__ auto- matically when compiling assembly code, __ASSEMBLY__ is a macro that only gets defined by the Makefiles in the kernel. This can be very confusing when switching between userspace and kernelspace coding, or when dealing with uapi headers that rather should use __ASSEMBLER__ instead. Let's standardize now on the __ASSEMBLER__ macro to avoid this confusion.
---
Note: This has been split from an earlier bigger patch of mine into
this separate patch to ease reviewing
include/asm-generic/barrier.h | 4 ++-- include/asm-generic/bug.h | 4 ++-- include/asm-generic/current.h | 2 +- include/asm-generic/error-injection.h | 2 +- include/asm-generic/int-ll64.h | 6 +++--- include/asm-generic/rwonce.h | 4 ++-- include/asm-generic/signal.h | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-)
include/asm-generic/barrier.h +2 -2
@@ -11,7 +11,7 @@#ifndef __ASM_GENERIC_BARRIER_H#define __ASM_GENERIC_BARRIER_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/compiler.h> #include <linux/kcsan-checks.h>
@@ -302,5 +302,5 @@ do { \# define smp_mb__after_switch_mm () smp_mb()#endif -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* __ASM_GENERIC_BARRIER_H */
include/asm-generic/bug.h +2 -2
@@ -26,7 +26,7 @@#endif #endif /* WARN_CONDITION_STR */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/panic.h> #include <linux/printk.h>
@@ -258,6 +258,6 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);# define WARN_ON_SMP (x) ({0;})#endif -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif
include/asm-generic/current.h +1 -1
@@ -2,7 +2,7 @@#ifndef __ASM_GENERIC_CURRENT_H#define __ASM_GENERIC_CURRENT_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/thread_info.h> #define get_current () (current_thread_info()->task)
include/asm-generic/error-injection.h +1 -1
@@ -2,7 +2,7 @@#ifndef _ASM_GENERIC_ERROR_INJECTION_H#define _ASM_GENERIC_ERROR_INJECTION_H -#if defined(__KERNEL__) && !defined(__ASSEMBLY__) +#if defined(__KERNEL__) && !defined(__ASSEMBLER__)enum {EI_ETYPE_NULL ,/* Return NULL if failure */ EI_ETYPE_ERRNO, /* Return -ERRNO if failure */
include/asm-generic/int-ll64.h +3 -3
@@ -11,7 +11,7 @@#include <uapi/asm-generic/int-ll64.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__typedef __s8 s8 ;typedef __u8 u8 ;
@@ -31,7 +31,7 @@ typedef __u64 u64;#define S64_C (x) x ## LL#define U64_C (x) x ## ULL -#else /* __ASSEMBLY__ */ +#else /* __ASSEMBLER__ */ #define S8_C (x) x#define U8_C (x) x
@@ -42,6 +42,6 @@ typedef __u64 u64;#define S64_C (x) x#define U64_C (x) x -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_GENERIC_INT_LL64_H */
include/asm-generic/rwonce.h +2 -2
@@ -20,7 +20,7 @@#ifndef __ASM_GENERIC_RWONCE_H#define __ASM_GENERIC_RWONCE_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/compiler_types.h> #include <linux/kasan-checks.h>
@@ -94,5 +94,5 @@ unsigned long read_word_at_a_time(const void *addr)return *(unsigned long *)addr; } -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* __ASM_GENERIC_RWONCE_H */
include/asm-generic/signal.h +2 -2
@@ -4,10 +4,10 @@#include <uapi/asm-generic/signal.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <asm/sigcontext.h> #undef __HAVE_ARCH_SIG_BITOPS -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_GENERIC_SIGNAL_H */
Signature · 1 line
2.55.0
Quoted 13 lines · Thomas Huth
While the GCC and Clang compilers already define
__ASSEMBLER__auto- matically when compiling assembly code,__ASSEMBLY__is a macro that only gets defined by the Makefiles in the kernel. This can be very confusing when switching between userspace and kernelspace coding, or when dealing with uapi headers that rather should use__ASSEMBLER__instead. Let's standardize now on the__ASSEMBLER__macro to avoid this confusion.Signed-off-by Thomas Huth <[email protected]>---
Note: This has been split from an earlier bigger patch of mine into
this separate patch to ease reviewing
Quoted 8 lines
include/asm-generic/barrier.h | 4 ++-- include/asm-generic/bug.h | 4 ++-- include/asm-generic/current.h | 2 +- include/asm-generic/error-injection.h | 2 +- include/asm-generic/int-ll64.h | 6 +++--- include/asm-generic/rwonce.h | 4 ++-- include/asm-generic/signal.h | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-)
Friendly ping?
Quoted 134 lines
include/asm-generic/barrier.h +2
-2@@ -11,7 +11,7 @@#ifndef __ASM_GENERIC_BARRIER_H#define __ASM_GENERIC_BARRIER_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/compiler.h> #include <linux/kcsan-checks.h> @@ -302,5 +302,5 @@ do { \# define smp_mb__after_switch_mm () smp_mb()#endif -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* __ASM_GENERIC_BARRIER_H */ include/asm-generic/bug.h +2
-2@@ -26,7 +26,7 @@#endif #endif /* WARN_CONDITION_STR */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/panic.h> #include <linux/printk.h> @@ -258,6 +258,6 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);# define WARN_ON_SMP (x) ({0;})#endif -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif include/asm-generic/current.h +1
-1@@ -2,7 +2,7 @@#ifndef __ASM_GENERIC_CURRENT_H#define __ASM_GENERIC_CURRENT_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/thread_info.h> #define get_current () (current_thread_info()->task)include/asm-generic/error-injection.h +1
-1@@ -2,7 +2,7 @@#ifndef _ASM_GENERIC_ERROR_INJECTION_H#define _ASM_GENERIC_ERROR_INJECTION_H -#if defined(__KERNEL__) && !defined(__ASSEMBLY__) +#if defined(__KERNEL__) && !defined(__ASSEMBLER__)enum {EI_ETYPE_NULL ,/* Return NULL if failure */ EI_ETYPE_ERRNO, /* Return -ERRNO if failure */include/asm-generic/int-ll64.h +3
-3@@ -11,7 +11,7 @@#include <uapi/asm-generic/int-ll64.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__typedef __s8 s8 ;typedef __u8 u8 ;@@ -31,7 +31,7 @@ typedef __u64 u64;#define S64_C (x) x ## LL#define U64_C (x) x ## ULL -#else /* __ASSEMBLY__ */ +#else /* __ASSEMBLER__ */ #define S8_C (x) x#define U8_C (x) x@@ -42,6 +42,6 @@ typedef __u64 u64;#define S64_C (x) x#define U64_C (x) x -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_GENERIC_INT_LL64_H */ include/asm-generic/rwonce.h +2
-2@@ -20,7 +20,7 @@#ifndef __ASM_GENERIC_RWONCE_H#define __ASM_GENERIC_RWONCE_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/compiler_types.h> #include <linux/kasan-checks.h> @@ -94,5 +94,5 @@ unsigned long read_word_at_a_time(const void *addr)return *(unsigned long *)addr; } -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* __ASM_GENERIC_RWONCE_H */ include/asm-generic/signal.h +2
-2@@ -4,10 +4,10 @@#include <uapi/asm-generic/signal.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <asm/sigcontext.h> #undef __HAVE_ARCH_SIG_BITOPS -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_GENERIC_SIGNAL_H */