[SRU][J][PATCH 1/7] arm64: mm: use IS_ENABLED(CONFIG_KEXEC_CORE) instead of #ifdef

Ioanna Alifieraki ioanna-maria.alifieraki at canonical.com
Mon Jul 10 12:56:06 UTC 2023


From: Jisheng Zhang <jszhang at kernel.org>

BugLink: https://bugs.launchpad.net/bugs/2024479

Replace the conditional compilation using "#ifdef CONFIG_KEXEC_CORE" by a
check for "IS_ENABLED(CONFIG_KEXEC_CORE)", to simplify the code and
increase compile coverage.

Link: https://lkml.kernel.org/r/20211206160514.2000-5-jszhang@kernel.org
Signed-off-by: Jisheng Zhang <jszhang at kernel.org>
Acked-by: Catalin Marinas <catalin.marinas at arm.com>
Acked-by: Baoquan He <bhe at redhat.com>
Cc: Albert Ou <aou at eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex at ghiti.fr>
Cc: Borislav Petkov <bp at alien8.de>
Cc: Dave Hansen <dave.hansen at linux.intel.com>
Cc: Eric W. Biederman <ebiederm at xmission.com>
Cc: H. Peter Anvin <hpa at zytor.com>
Cc: Ingo Molnar <mingo at redhat.com>
Cc: Palmer Dabbelt <palmer at dabbelt.com>
Cc: Palmer Dabbelt <palmer at rivosinc.com>
Cc: Paul Walmsley <paul.walmsley at sifive.com>
Cc: Russell King <linux at armlinux.org.uk>
Cc: Russell King (Oracle) <rmk+kernel at armlinux.org.uk>
Cc: Thomas Gleixner <tglx at linutronix.de>
Cc: Will Deacon <will at kernel.org>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
(cherry picked from commit d339f1584f0acf32b32326627fa3b48e6e65c599)
Signed-off-by: Ioanna Alifieraki <ioanna-maria.alifieraki at canonical.com>
---
 arch/arm64/mm/init.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 3b269c756798..8c3ffcfc3b58 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -90,7 +90,6 @@ phys_addr_t __ro_after_init arm64_dma_phys_limit;
 phys_addr_t __ro_after_init arm64_dma_phys_limit = PHYS_MASK + 1;
 #endif
 
-#ifdef CONFIG_KEXEC_CORE
 /*
  * reserve_crashkernel() - reserves memory for crash kernel
  *
@@ -104,6 +103,9 @@ static void __init reserve_crashkernel(void)
 	unsigned long long crash_max = arm64_dma_phys_limit;
 	int ret;
 
+	if (!IS_ENABLED(CONFIG_KEXEC_CORE))
+		return;
+
 	ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
 				&crash_size, &crash_base);
 	/* no crashkernel= or invalid value specified */
@@ -136,11 +138,6 @@ static void __init reserve_crashkernel(void)
 	crashk_res.start = crash_base;
 	crashk_res.end = crash_base + crash_size - 1;
 }
-#else
-static void __init reserve_crashkernel(void)
-{
-}
-#endif /* CONFIG_KEXEC_CORE */
 
 /*
  * Return the maximum physical address for a zone accessible by the given bits
-- 
2.34.1




More information about the kernel-team mailing list