diff mbox series

[RFC,5/5] arm: use IS_ENABLED(CONFIG_KEXEC_CORE) instead of #ifdef

Message ID 20211203051157.2160-6-jszhang@kernel.org (mailing list archive)
State New, archived
Headers show
Series kexec: use IS_ENABLED(CONFIG_KEXEC_CORE) instead of #ifdef | expand

Commit Message

Jisheng Zhang Dec. 3, 2021, 5:11 a.m. UTC
Replace the conditional compilation using "#ifdef CONFIG_KEXEC_CORE"
by a check for "IS_ENABLED(CONFIG_BLK_DEV_INITRD)", to simplify the
code and increase compile coverage.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
 arch/arm/kernel/setup.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Russell King (Oracle) Dec. 3, 2021, 4:23 p.m. UTC | #1
On Fri, Dec 03, 2021 at 01:11:57PM +0800, Jisheng Zhang wrote:
> Replace the conditional compilation using "#ifdef CONFIG_KEXEC_CORE"
> by a check for "IS_ENABLED(CONFIG_BLK_DEV_INITRD)", to simplify the
> code and increase compile coverage.
> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Emil Renner Berthing Dec. 3, 2021, 4:39 p.m. UTC | #2
Hi Jisheng,

On Fri, 3 Dec 2021 at 06:22, Jisheng Zhang <jszhang@kernel.org> wrote:
> Replace the conditional compilation using "#ifdef CONFIG_KEXEC_CORE"
> by a check for "IS_ENABLED(CONFIG_BLK_DEV_INITRD)", to simplify the

The patch looks fine, but I think you mean
IS_ENABLED(CONFIG_KEXEC_CORE) here, not CONFIG_BLK_DEV_INITRD.

/Emil

> code and increase compile coverage.
>
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
>  arch/arm/kernel/setup.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> index 284a80c0b6e1..f9a054a344c0 100644
> --- a/arch/arm/kernel/setup.c
> +++ b/arch/arm/kernel/setup.c
> @@ -973,7 +973,6 @@ static int __init init_machine_late(void)
>  }
>  late_initcall(init_machine_late);
>
> -#ifdef CONFIG_KEXEC
>  /*
>   * The crash region must be aligned to 128MB to avoid
>   * zImage relocating below the reserved region.
> @@ -1001,6 +1000,9 @@ static void __init reserve_crashkernel(void)
>         unsigned long long total_mem;
>         int ret;
>
> +       if (!IS_ENABLED(CONFIG_KEXEC_CORE))
> +               return;
> +
>         total_mem = get_total_mem();
>         ret = parse_crashkernel(boot_command_line, total_mem,
>                                 &crash_size, &crash_base);
> @@ -1056,9 +1058,6 @@ static void __init reserve_crashkernel(void)
>                 insert_resource(&iomem_resource, &crashk_boot_res);
>         }
>  }
> -#else
> -static inline void reserve_crashkernel(void) {}
> -#endif /* CONFIG_KEXEC */
>
>  void __init hyp_mode_check(void)
>  {
> --
> 2.34.1
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
diff mbox series

Patch

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 284a80c0b6e1..f9a054a344c0 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -973,7 +973,6 @@  static int __init init_machine_late(void)
 }
 late_initcall(init_machine_late);
 
-#ifdef CONFIG_KEXEC
 /*
  * The crash region must be aligned to 128MB to avoid
  * zImage relocating below the reserved region.
@@ -1001,6 +1000,9 @@  static void __init reserve_crashkernel(void)
 	unsigned long long total_mem;
 	int ret;
 
+	if (!IS_ENABLED(CONFIG_KEXEC_CORE))
+		return;
+
 	total_mem = get_total_mem();
 	ret = parse_crashkernel(boot_command_line, total_mem,
 				&crash_size, &crash_base);
@@ -1056,9 +1058,6 @@  static void __init reserve_crashkernel(void)
 		insert_resource(&iomem_resource, &crashk_boot_res);
 	}
 }
-#else
-static inline void reserve_crashkernel(void) {}
-#endif /* CONFIG_KEXEC */
 
 void __init hyp_mode_check(void)
 {