Commit f0ef0b02 authored by Thomas Huth's avatar Thomas Huth Committed by Huacai Chen
Browse files

LoongArch: Replace __ASSEMBLY__ with __ASSEMBLER__ in headers



While the GCC and Clang compilers already define __ASSEMBLER__
automatically when compiling assembler code, __ASSEMBLY__ is a macro
that only gets defined by the Makefiles in the kernel. This is bad
since macros starting with two underscores are names that are reserved
by the C language. It can also be very confusing for the developers
when switching between userspace and kernelspace coding, or when
dealing with uapi headers that rather should use __ASSEMBLER__ instead.
So let's now standardize on the __ASSEMBLER__ macro that is provided
by the compilers.

This is almost a completely mechanical patch (done with a simple
"sed -i" statement), with one comment tweaked manually in the
arch/loongarch/include/asm/cpu.h file (it was missing the trailing
underscores).

Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent 86731a2a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -18,12 +18,12 @@
/*
 * This gives the physical RAM offset.
 */
#ifndef __ASSEMBLY__
#ifndef __ASSEMBLER__
#ifndef PHYS_OFFSET
#define PHYS_OFFSET	_UL(0)
#endif
extern unsigned long vm_map_base;
#endif /* __ASSEMBLY__ */
#endif /* __ASSEMBLER__ */

#ifndef IO_BASE
#define IO_BASE			CSR_DMW0_BASE
@@ -66,7 +66,7 @@ extern unsigned long vm_map_base;
#define FIXADDR_TOP		((unsigned long)(long)(int)0xfffe0000)
#endif

#ifdef __ASSEMBLY__
#ifdef __ASSEMBLER__
#define _ATYPE_
#define _ATYPE32_
#define _ATYPE64_
@@ -85,7 +85,7 @@ extern unsigned long vm_map_base;
/*
 *  32/64-bit LoongArch address spaces
 */
#ifdef __ASSEMBLY__
#ifdef __ASSEMBLER__
#define _ACAST32_
#define _ACAST64_
#else
+2 −2
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
#ifndef _ASM_ALTERNATIVE_ASM_H
#define _ASM_ALTERNATIVE_ASM_H

#ifdef __ASSEMBLY__
#ifdef __ASSEMBLER__

#include <asm/asm.h>

@@ -77,6 +77,6 @@
	.previous
.endm

#endif  /*  __ASSEMBLY__  */
#endif  /*  __ASSEMBLER__  */

#endif /* _ASM_ALTERNATIVE_ASM_H */
+2 −2
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
#ifndef _ASM_ALTERNATIVE_H
#define _ASM_ALTERNATIVE_H

#ifndef __ASSEMBLY__
#ifndef __ASSEMBLER__

#include <linux/types.h>
#include <linux/stddef.h>
@@ -106,6 +106,6 @@ extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
#define alternative_2(oldinstr, newinstr1, feature1, newinstr2, feature2) \
	(asm volatile(ALTERNATIVE_2(oldinstr, newinstr1, feature1, newinstr2, feature2) ::: "memory"))

#endif /* __ASSEMBLY__ */
#endif /* __ASSEMBLER__ */

#endif /* _ASM_ALTERNATIVE_H */
+3 −3
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
#define EX_TYPE_UACCESS_ERR_ZERO	2
#define EX_TYPE_BPF			3

#ifdef __ASSEMBLY__
#ifdef __ASSEMBLER__

#define __ASM_EXTABLE_RAW(insn, fixup, type, data)	\
	.pushsection	__ex_table, "a";		\
@@ -22,7 +22,7 @@
	__ASM_EXTABLE_RAW(\insn, \fixup, EX_TYPE_FIXUP, 0)
	.endm

#else /* __ASSEMBLY__ */
#else /* __ASSEMBLER__ */

#include <linux/bits.h>
#include <linux/stringify.h>
@@ -60,6 +60,6 @@
#define _ASM_EXTABLE_UACCESS_ERR(insn, fixup, err)			\
	_ASM_EXTABLE_UACCESS_ERR_ZERO(insn, fixup, err, zero)

#endif /* __ASSEMBLY__ */
#endif /* __ASSEMBLER__ */

#endif /* __ASM_ASM_EXTABLE_H */
+4 −4
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@
#define LONG_SRA	srai.w
#define LONG_SRAV	sra.w

#ifdef __ASSEMBLY__
#ifdef __ASSEMBLER__
#define LONG		.word
#endif
#define LONGSIZE	4
@@ -131,7 +131,7 @@
#define LONG_SRA	srai.d
#define LONG_SRAV	sra.d

#ifdef __ASSEMBLY__
#ifdef __ASSEMBLER__
#define LONG		.dword
#endif
#define LONGSIZE	8
@@ -158,7 +158,7 @@

#define PTR_SCALESHIFT	2

#ifdef __ASSEMBLY__
#ifdef __ASSEMBLER__
#define PTR		.word
#endif
#define PTRSIZE		4
@@ -181,7 +181,7 @@

#define PTR_SCALESHIFT	3

#ifdef __ASSEMBLY__
#ifdef __ASSEMBLER__
#define PTR		.dword
#endif
#define PTRSIZE		8
Loading