arm64: remove pointless __KERNEL__ guards
authorMark Rutland <mark.rutland@arm.com>
Mon, 8 Jul 2019 16:36:40 +0000 (17:36 +0100)
committerWill Deacon <will@kernel.org>
Mon, 5 Aug 2019 10:06:33 +0000 (11:06 +0100)
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: Mark 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: Will Deacon <will@kernel.org>
16 files changed:
arch/arm64/include/asm/atomic.h
arch/arm64/include/asm/compat.h
arch/arm64/include/asm/debug-monitors.h
arch/arm64/include/asm/dma-mapping.h
arch/arm64/include/asm/fpsimd.h
arch/arm64/include/asm/futex.h
arch/arm64/include/asm/hw_breakpoint.h
arch/arm64/include/asm/io.h
arch/arm64/include/asm/irqflags.h
arch/arm64/include/asm/pci.h
arch/arm64/include/asm/proc-fns.h
arch/arm64/include/asm/processor.h
arch/arm64/include/asm/signal32.h
arch/arm64/include/asm/thread_info.h
arch/arm64/include/asm/vdso.h
arch/arm64/include/asm/vdso_datapage.h

index 657b0457d83cf1ebd5cdf92bc5d66adee25fe4a5..a5ca23950cfd22b886aba7cd57f83dab94258759 100644 (file)
@@ -15,8 +15,6 @@
 #include <asm/barrier.h>
 #include <asm/lse.h>
 
-#ifdef __KERNEL__
-
 #define __ARM64_IN_ATOMIC_IMPL
 
 #if defined(CONFIG_ARM64_LSE_ATOMICS) && defined(CONFIG_AS_LSE)
 
 #include <asm-generic/atomic-instrumented.h>
 
-#endif
-#endif
+#endif /* __ASM_ATOMIC_H */
index fb8ad4616b3bfff87e8e8e418755bbebb2174e39..b0d53a265f1d510cbb6372685b39a53de2361eed 100644 (file)
@@ -4,7 +4,6 @@
  */
 #ifndef __ASM_COMPAT_H
 #define __ASM_COMPAT_H
-#ifdef __KERNEL__
 #ifdef CONFIG_COMPAT
 
 /*
@@ -215,5 +214,4 @@ static inline int is_compat_thread(struct thread_info *thread)
 }
 
 #endif /* CONFIG_COMPAT */
-#endif /* __KERNEL__ */
 #endif /* __ASM_COMPAT_H */
index d8ec5bb881c26700d013b08ef35cffda8468fd1d..7619f473155f2fac2dabfc9ebddfcb797475f285 100644 (file)
@@ -5,8 +5,6 @@
 #ifndef __ASM_DEBUG_MONITORS_H
 #define __ASM_DEBUG_MONITORS_H
 
-#ifdef __KERNEL__
-
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <asm/brk-imm.h>
@@ -128,5 +126,4 @@ static inline int reinstall_suspended_bps(struct pt_regs *regs)
 int aarch32_break_handler(struct pt_regs *regs);
 
 #endif /* __ASSEMBLY */
-#endif /* __KERNEL__ */
 #endif /* __ASM_DEBUG_MONITORS_H */
index bdcb0922a40c953d28c263cf46a01b0f46eb23f1..fb3e5044f473a36cf3b36c19686060c4bd9ad133 100644 (file)
@@ -5,8 +5,6 @@
 #ifndef __ASM_DMA_MAPPING_H
 #define __ASM_DMA_MAPPING_H
 
-#ifdef __KERNEL__
-
 #include <linux/types.h>
 #include <linux/vmalloc.h>
 
@@ -27,5 +25,4 @@ static inline bool is_device_dma_coherent(struct device *dev)
        return dev->dma_coherent;
 }
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_DMA_MAPPING_H */
index b6a2c352f4c3fd64726115f478d1c6a4fd60b040..59f10dd13f121e3acb156740ff6c17e0d12856da 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/stddef.h>
 #include <linux/types.h>
 
-#if defined(__KERNEL__) && defined(CONFIG_COMPAT)
+#ifdef CONFIG_COMPAT
 /* Masks for extracting the FPSR and FPCR from the FPSCR */
 #define VFP_FPSCR_STAT_MASK    0xf800009f
 #define VFP_FPSCR_CTRL_MASK    0x07f79f00
index 6211e3105491e033f16d372916733ab88f7c6b37..6cc26a1278197a60d8f275a3b3ba0df7aba0a265 100644 (file)
@@ -5,8 +5,6 @@
 #ifndef __ASM_FUTEX_H
 #define __ASM_FUTEX_H
 
-#ifdef __KERNEL__
-
 #include <linux/futex.h>
 #include <linux/uaccess.h>
 
@@ -129,5 +127,4 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *_uaddr,
        return ret;
 }
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_FUTEX_H */
index db9ab760e6fdd9b239c97c954975503df9368a55..bc7aaed4b34e958386ae844a6795ba6d576bc182 100644 (file)
@@ -10,8 +10,6 @@
 #include <asm/sysreg.h>
 #include <asm/virt.h>
 
-#ifdef __KERNEL__
-
 struct arch_hw_breakpoint_ctrl {
        u32 __reserved  : 19,
        len             : 8,
@@ -156,5 +154,4 @@ static inline int get_num_wrps(void)
                                                ID_AA64DFR0_WRPS_SHIFT);
 }
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_BREAKPOINT_H */
index 7ed92626949d7d001d6f84a4402d9f419d01e637..179a4c65c0d4eaeb7cc2c4d39ff4e36d68100f5f 100644 (file)
@@ -8,8 +8,6 @@
 #ifndef __ASM_IO_H
 #define __ASM_IO_H
 
-#ifdef __KERNEL__
-
 #include <linux/types.h>
 
 #include <asm/byteorder.h>
@@ -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);
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_IO_H */
index 7872f260c9ee3e14755e916230be06095a936dbf..1a59f0ed1ae392ac06fe26d2da2a9274239c0432 100644 (file)
@@ -5,8 +5,6 @@
 #ifndef __ASM_IRQFLAGS_H
 #define __ASM_IRQFLAGS_H
 
-#ifdef __KERNEL__
-
 #include <asm/alternative.h>
 #include <asm/ptrace.h>
 #include <asm/sysreg.h>
@@ -128,5 +126,4 @@ static inline void arch_local_irq_restore(unsigned long flags)
                : "memory");
 }
 
-#endif
-#endif
+#endif /* __ASM_IRQFLAGS_H */
index 9e690686e8aad3fac10fd838dc75d8b7e77a8cde..70b323cf83000d51c1d823c5f4c8eb8fe47bebda 100644 (file)
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #ifndef __ASM_PCI_H
 #define __ASM_PCI_H
-#ifdef __KERNEL__
 
 #include <linux/types.h>
 #include <linux/slab.h>
@@ -35,5 +34,4 @@ static inline int pci_proc_domain(struct pci_bus *bus)
 }
 #endif  /* CONFIG_PCI */
 
-#endif  /* __KERNEL__ */
 #endif  /* __ASM_PCI_H */
index 368d90a9d0e5fa893f53bad7f34e54ec33ab3353..a2ce65a0c1fa9d539e1f38a73d18ae11537f7b27 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef __ASM_PROCFNS_H
 #define __ASM_PROCFNS_H
 
-#ifdef __KERNEL__
 #ifndef __ASSEMBLY__
 
 #include <asm/page.h>
@@ -25,5 +24,4 @@ extern u64 cpu_do_resume(phys_addr_t ptr, u64 idmap_ttbr);
 #include <asm/memory.h>
 
 #endif /* __ASSEMBLY__ */
-#endif /* __KERNEL__ */
 #endif /* __ASM_PROCFNS_H */
index 844e2964b0f5e5b0aad4b866283f24e26f794afe..fa7a6f63308f0226a53e8beb345af691ec83ca09 100644 (file)
@@ -20,7 +20,6 @@
 #define NET_IP_ALIGN   0
 
 #ifndef __ASSEMBLY__
-#ifdef __KERNEL__
 
 #include <linux/build_bug.h>
 #include <linux/cache.h>
@@ -283,8 +282,6 @@ static inline void spin_lock_prefetch(const void *ptr)
 
 #define HAVE_ARCH_PICK_MMAP_LAYOUT
 
-#endif
-
 extern unsigned long __ro_after_init signal_minsigstksz; /* sigframe size */
 extern void __init minsigstksz_setup(void);
 
index bd43d1cf724b175f1bc187bf83554492402cefa7..7e9f163d02ecad97d4df2992395bce32bdef2375 100644 (file)
@@ -5,7 +5,6 @@
 #ifndef __ASM_SIGNAL32_H
 #define __ASM_SIGNAL32_H
 
-#ifdef __KERNEL__
 #ifdef CONFIG_COMPAT
 #include <linux/compat.h>
 
@@ -79,5 +78,4 @@ static inline void compat_setup_restart_syscall(struct pt_regs *regs)
 {
 }
 #endif /* CONFIG_COMPAT */
-#endif /* __KERNEL__ */
 #endif /* __ASM_SIGNAL32_H */
index 180b34ec59650a9bcbca37ae4c7fbba373251e09..e35cd84b102c6b3ddee01f0e16cace5bdb2c602e 100644 (file)
@@ -8,8 +8,6 @@
 #ifndef __ASM_THREAD_INFO_H
 #define __ASM_THREAD_INFO_H
 
-#ifdef __KERNEL__
-
 #include <linux/compiler.h>
 
 #ifndef __ASSEMBLY__
@@ -121,5 +119,4 @@ void arch_release_task_struct(struct task_struct *tsk);
        .addr_limit     = KERNEL_DS,                                    \
 }
 
-#endif /* __KERNEL__ */
 #endif /* __ASM_THREAD_INFO_H */
index 9c15e0a063017ad27677b958b85c36ce329873d3..07468428fd2907a6e9453e840da0d95694fcf541 100644 (file)
@@ -5,8 +5,6 @@
 #ifndef __ASM_VDSO_H
 #define __ASM_VDSO_H
 
-#ifdef __KERNEL__
-
 /*
  * Default link address for the vDSO.
  * Since we randomise the VDSO mapping, there's little point in trying
@@ -28,6 +26,4 @@
 
 #endif /* !__ASSEMBLY__ */
 
-#endif /* __KERNEL__ */
-
 #endif /* __ASM_VDSO_H */
index ba6dbc3de86480129727fda5fa150ee5b1df2f30..1f38bf330a6efe4d89803b7a86c4417f3cf33862 100644 (file)
@@ -5,8 +5,6 @@
 #ifndef __ASM_VDSO_DATAPAGE_H
 #define __ASM_VDSO_DATAPAGE_H
 
-#ifdef __KERNEL__
-
 #ifndef __ASSEMBLY__
 
 struct vdso_data {
@@ -32,6 +30,4 @@ struct vdso_data {
 
 #endif /* !__ASSEMBLY__ */
 
-#endif /* __KERNEL__ */
-
 #endif /* __ASM_VDSO_DATAPAGE_H */