Commit b907b80d authored by Mark Rutland's avatar Mark Rutland Committed by Will Deacon

arm64: remove pointless __KERNEL__ guards

For a number of years, UAPI headers have been split from kernel-internal
headers. The latter are never exposed to userspace, and always built
with __KERNEL__ defined.

Most headers under arch/arm64 don't have __KERNEL__ guards, but there
are a few stragglers lying around. To make things more consistent, and
to set a good example going forward, let's remove these redundant
__KERNEL__ guards.

In a couple of cases, a trailing #endif lacked a comment describing its
corresponding #if or #ifdef, so these are fixes up at the same time.

Guards in auto-generated crypto code are left as-is, as these guards are
generated by scripting imported from the upstream openssl project
scripts. Guards in UAPI headers are left as-is, as these can be included
by userspace or the kernel.

There should be no functional change as a result of this patch.
Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent c8785794
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include <asm/barrier.h> #include <asm/barrier.h>
#include <asm/lse.h> #include <asm/lse.h>
#ifdef __KERNEL__
#define __ARM64_IN_ATOMIC_IMPL #define __ARM64_IN_ATOMIC_IMPL
#if defined(CONFIG_ARM64_LSE_ATOMICS) && defined(CONFIG_AS_LSE) #if defined(CONFIG_ARM64_LSE_ATOMICS) && defined(CONFIG_AS_LSE)
...@@ -157,5 +155,4 @@ ...@@ -157,5 +155,4 @@
#include <asm-generic/atomic-instrumented.h> #include <asm-generic/atomic-instrumented.h>
#endif #endif /* __ASM_ATOMIC_H */
#endif
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
*/ */
#ifndef __ASM_COMPAT_H #ifndef __ASM_COMPAT_H
#define __ASM_COMPAT_H #define __ASM_COMPAT_H
#ifdef __KERNEL__
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
/* /*
...@@ -215,5 +214,4 @@ static inline int is_compat_thread(struct thread_info *thread) ...@@ -215,5 +214,4 @@ static inline int is_compat_thread(struct thread_info *thread)
} }
#endif /* CONFIG_COMPAT */ #endif /* CONFIG_COMPAT */
#endif /* __KERNEL__ */
#endif /* __ASM_COMPAT_H */ #endif /* __ASM_COMPAT_H */
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#ifndef __ASM_DEBUG_MONITORS_H #ifndef __ASM_DEBUG_MONITORS_H
#define __ASM_DEBUG_MONITORS_H #define __ASM_DEBUG_MONITORS_H
#ifdef __KERNEL__
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/types.h> #include <linux/types.h>
#include <asm/brk-imm.h> #include <asm/brk-imm.h>
...@@ -128,5 +126,4 @@ static inline int reinstall_suspended_bps(struct pt_regs *regs) ...@@ -128,5 +126,4 @@ static inline int reinstall_suspended_bps(struct pt_regs *regs)
int aarch32_break_handler(struct pt_regs *regs); int aarch32_break_handler(struct pt_regs *regs);
#endif /* __ASSEMBLY */ #endif /* __ASSEMBLY */
#endif /* __KERNEL__ */
#endif /* __ASM_DEBUG_MONITORS_H */ #endif /* __ASM_DEBUG_MONITORS_H */
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#ifndef __ASM_DMA_MAPPING_H #ifndef __ASM_DMA_MAPPING_H
#define __ASM_DMA_MAPPING_H #define __ASM_DMA_MAPPING_H
#ifdef __KERNEL__
#include <linux/types.h> #include <linux/types.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
...@@ -27,5 +25,4 @@ static inline bool is_device_dma_coherent(struct device *dev) ...@@ -27,5 +25,4 @@ static inline bool is_device_dma_coherent(struct device *dev)
return dev->dma_coherent; return dev->dma_coherent;
} }
#endif /* __KERNEL__ */
#endif /* __ASM_DMA_MAPPING_H */ #endif /* __ASM_DMA_MAPPING_H */
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/types.h> #include <linux/types.h>
#if defined(__KERNEL__) && defined(CONFIG_COMPAT) #ifdef CONFIG_COMPAT
/* Masks for extracting the FPSR and FPCR from the FPSCR */ /* Masks for extracting the FPSR and FPCR from the FPSCR */
#define VFP_FPSCR_STAT_MASK 0xf800009f #define VFP_FPSCR_STAT_MASK 0xf800009f
#define VFP_FPSCR_CTRL_MASK 0x07f79f00 #define VFP_FPSCR_CTRL_MASK 0x07f79f00
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#ifndef __ASM_FUTEX_H #ifndef __ASM_FUTEX_H
#define __ASM_FUTEX_H #define __ASM_FUTEX_H
#ifdef __KERNEL__
#include <linux/futex.h> #include <linux/futex.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
...@@ -129,5 +127,4 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *_uaddr, ...@@ -129,5 +127,4 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *_uaddr,
return ret; return ret;
} }
#endif /* __KERNEL__ */
#endif /* __ASM_FUTEX_H */ #endif /* __ASM_FUTEX_H */
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
#include <asm/sysreg.h> #include <asm/sysreg.h>
#include <asm/virt.h> #include <asm/virt.h>
#ifdef __KERNEL__
struct arch_hw_breakpoint_ctrl { struct arch_hw_breakpoint_ctrl {
u32 __reserved : 19, u32 __reserved : 19,
len : 8, len : 8,
...@@ -156,5 +154,4 @@ static inline int get_num_wrps(void) ...@@ -156,5 +154,4 @@ static inline int get_num_wrps(void)
ID_AA64DFR0_WRPS_SHIFT); ID_AA64DFR0_WRPS_SHIFT);
} }
#endif /* __KERNEL__ */
#endif /* __ASM_BREAKPOINT_H */ #endif /* __ASM_BREAKPOINT_H */
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
#ifndef __ASM_IO_H #ifndef __ASM_IO_H
#define __ASM_IO_H #define __ASM_IO_H
#ifdef __KERNEL__
#include <linux/types.h> #include <linux/types.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
...@@ -207,5 +205,4 @@ extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); ...@@ -207,5 +205,4 @@ extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
extern int devmem_is_allowed(unsigned long pfn); extern int devmem_is_allowed(unsigned long pfn);
#endif /* __KERNEL__ */
#endif /* __ASM_IO_H */ #endif /* __ASM_IO_H */
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#ifndef __ASM_IRQFLAGS_H #ifndef __ASM_IRQFLAGS_H
#define __ASM_IRQFLAGS_H #define __ASM_IRQFLAGS_H
#ifdef __KERNEL__
#include <asm/alternative.h> #include <asm/alternative.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/sysreg.h> #include <asm/sysreg.h>
...@@ -128,5 +126,4 @@ static inline void arch_local_irq_restore(unsigned long flags) ...@@ -128,5 +126,4 @@ static inline void arch_local_irq_restore(unsigned long flags)
: "memory"); : "memory");
} }
#endif #endif /* __ASM_IRQFLAGS_H */
#endif
/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ASM_PCI_H #ifndef __ASM_PCI_H
#define __ASM_PCI_H #define __ASM_PCI_H
#ifdef __KERNEL__
#include <linux/types.h> #include <linux/types.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -35,5 +34,4 @@ static inline int pci_proc_domain(struct pci_bus *bus) ...@@ -35,5 +34,4 @@ static inline int pci_proc_domain(struct pci_bus *bus)
} }
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
#endif /* __KERNEL__ */
#endif /* __ASM_PCI_H */ #endif /* __ASM_PCI_H */
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#ifndef __ASM_PROCFNS_H #ifndef __ASM_PROCFNS_H
#define __ASM_PROCFNS_H #define __ASM_PROCFNS_H
#ifdef __KERNEL__
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <asm/page.h> #include <asm/page.h>
...@@ -25,5 +24,4 @@ extern u64 cpu_do_resume(phys_addr_t ptr, u64 idmap_ttbr); ...@@ -25,5 +24,4 @@ extern u64 cpu_do_resume(phys_addr_t ptr, u64 idmap_ttbr);
#include <asm/memory.h> #include <asm/memory.h>
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
#endif /* __ASM_PROCFNS_H */ #endif /* __ASM_PROCFNS_H */
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#define NET_IP_ALIGN 0 #define NET_IP_ALIGN 0
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#ifdef __KERNEL__
#include <linux/build_bug.h> #include <linux/build_bug.h>
#include <linux/cache.h> #include <linux/cache.h>
...@@ -283,8 +282,6 @@ static inline void spin_lock_prefetch(const void *ptr) ...@@ -283,8 +282,6 @@ static inline void spin_lock_prefetch(const void *ptr)
#define HAVE_ARCH_PICK_MMAP_LAYOUT #define HAVE_ARCH_PICK_MMAP_LAYOUT
#endif
extern unsigned long __ro_after_init signal_minsigstksz; /* sigframe size */ extern unsigned long __ro_after_init signal_minsigstksz; /* sigframe size */
extern void __init minsigstksz_setup(void); extern void __init minsigstksz_setup(void);
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#ifndef __ASM_SIGNAL32_H #ifndef __ASM_SIGNAL32_H
#define __ASM_SIGNAL32_H #define __ASM_SIGNAL32_H
#ifdef __KERNEL__
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
#include <linux/compat.h> #include <linux/compat.h>
...@@ -79,5 +78,4 @@ static inline void compat_setup_restart_syscall(struct pt_regs *regs) ...@@ -79,5 +78,4 @@ static inline void compat_setup_restart_syscall(struct pt_regs *regs)
{ {
} }
#endif /* CONFIG_COMPAT */ #endif /* CONFIG_COMPAT */
#endif /* __KERNEL__ */
#endif /* __ASM_SIGNAL32_H */ #endif /* __ASM_SIGNAL32_H */
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
#ifndef __ASM_THREAD_INFO_H #ifndef __ASM_THREAD_INFO_H
#define __ASM_THREAD_INFO_H #define __ASM_THREAD_INFO_H
#ifdef __KERNEL__
#include <linux/compiler.h> #include <linux/compiler.h>
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
...@@ -121,5 +119,4 @@ void arch_release_task_struct(struct task_struct *tsk); ...@@ -121,5 +119,4 @@ void arch_release_task_struct(struct task_struct *tsk);
.addr_limit = KERNEL_DS, \ .addr_limit = KERNEL_DS, \
} }
#endif /* __KERNEL__ */
#endif /* __ASM_THREAD_INFO_H */ #endif /* __ASM_THREAD_INFO_H */
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#ifndef __ASM_VDSO_H #ifndef __ASM_VDSO_H
#define __ASM_VDSO_H #define __ASM_VDSO_H
#ifdef __KERNEL__
/* /*
* Default link address for the vDSO. * Default link address for the vDSO.
* Since we randomise the VDSO mapping, there's little point in trying * Since we randomise the VDSO mapping, there's little point in trying
...@@ -28,6 +26,4 @@ ...@@ -28,6 +26,4 @@
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
#endif /* __KERNEL__ */
#endif /* __ASM_VDSO_H */ #endif /* __ASM_VDSO_H */
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#ifndef __ASM_VDSO_DATAPAGE_H #ifndef __ASM_VDSO_DATAPAGE_H
#define __ASM_VDSO_DATAPAGE_H #define __ASM_VDSO_DATAPAGE_H
#ifdef __KERNEL__
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
struct vdso_data { struct vdso_data {
...@@ -32,6 +30,4 @@ struct vdso_data { ...@@ -32,6 +30,4 @@ struct vdso_data {
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
#endif /* __KERNEL__ */
#endif /* __ASM_VDSO_DATAPAGE_H */ #endif /* __ASM_VDSO_DATAPAGE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment