public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] riscv: merge two if-blocks for KBUILD_IMAGE
@ 2024-03-23 11:35 Masahiro Yamada
  2024-03-26 19:52 ` Alexandre Ghiti
  2024-04-10 14:10 ` patchwork-bot+linux-riscv
  0 siblings, 2 replies; 3+ messages in thread
From: Masahiro Yamada @ 2024-03-23 11:35 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-riscv
  Cc: linux-kernel, Masahiro Yamada

In arch/riscv/Makefile, KBUILD_IMAGE is assigned in two separate
if-blocks.

When CONFIG_XIP_KERNEL is disabled, the decision made by the first
if-block is overwritten by the second one, which is redundant and
unreadable.

Merge the two if-blocks.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 arch/riscv/Makefile | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 252d63942f34..a74e70405d3f 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -133,7 +133,15 @@ boot		:= arch/riscv/boot
 ifeq ($(CONFIG_XIP_KERNEL),y)
 KBUILD_IMAGE := $(boot)/xipImage
 else
+ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_ARCH_CANAAN),yy)
+KBUILD_IMAGE := $(boot)/loader.bin
+else
+ifeq ($(CONFIG_EFI_ZBOOT),)
 KBUILD_IMAGE	:= $(boot)/Image.gz
+else
+KBUILD_IMAGE := $(boot)/vmlinuz.efi
+endif
+endif
 endif
 
 libs-y += arch/riscv/lib/
@@ -153,17 +161,6 @@ endif
 vdso-install-y			+= arch/riscv/kernel/vdso/vdso.so.dbg
 vdso-install-$(CONFIG_COMPAT)	+= arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg:../compat_vdso/compat_vdso.so
 
-ifneq ($(CONFIG_XIP_KERNEL),y)
-ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_ARCH_CANAAN),yy)
-KBUILD_IMAGE := $(boot)/loader.bin
-else
-ifeq ($(CONFIG_EFI_ZBOOT),)
-KBUILD_IMAGE := $(boot)/Image.gz
-else
-KBUILD_IMAGE := $(boot)/vmlinuz.efi
-endif
-endif
-endif
 BOOT_TARGETS := Image Image.gz loader loader.bin xipImage vmlinuz.efi
 
 all:	$(notdir $(KBUILD_IMAGE))
-- 
2.40.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] riscv: merge two if-blocks for KBUILD_IMAGE
  2024-03-23 11:35 [PATCH] riscv: merge two if-blocks for KBUILD_IMAGE Masahiro Yamada
@ 2024-03-26 19:52 ` Alexandre Ghiti
  2024-04-10 14:10 ` patchwork-bot+linux-riscv
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Ghiti @ 2024-03-26 19:52 UTC (permalink / raw)
  To: Masahiro Yamada, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-riscv
  Cc: linux-kernel

Hi Masahiro,

On 23/03/2024 12:35, Masahiro Yamada wrote:
> In arch/riscv/Makefile, KBUILD_IMAGE is assigned in two separate
> if-blocks.
>
> When CONFIG_XIP_KERNEL is disabled, the decision made by the first
> if-block is overwritten by the second one, which is redundant and
> unreadable.
>
> Merge the two if-blocks.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
>   arch/riscv/Makefile | 19 ++++++++-----------
>   1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> index 252d63942f34..a74e70405d3f 100644
> --- a/arch/riscv/Makefile
> +++ b/arch/riscv/Makefile
> @@ -133,7 +133,15 @@ boot		:= arch/riscv/boot
>   ifeq ($(CONFIG_XIP_KERNEL),y)
>   KBUILD_IMAGE := $(boot)/xipImage
>   else
> +ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_ARCH_CANAAN),yy)
> +KBUILD_IMAGE := $(boot)/loader.bin
> +else
> +ifeq ($(CONFIG_EFI_ZBOOT),)
>   KBUILD_IMAGE	:= $(boot)/Image.gz
> +else
> +KBUILD_IMAGE := $(boot)/vmlinuz.efi
> +endif
> +endif
>   endif
>   
>   libs-y += arch/riscv/lib/
> @@ -153,17 +161,6 @@ endif
>   vdso-install-y			+= arch/riscv/kernel/vdso/vdso.so.dbg
>   vdso-install-$(CONFIG_COMPAT)	+= arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg:../compat_vdso/compat_vdso.so
>   
> -ifneq ($(CONFIG_XIP_KERNEL),y)
> -ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_ARCH_CANAAN),yy)
> -KBUILD_IMAGE := $(boot)/loader.bin
> -else
> -ifeq ($(CONFIG_EFI_ZBOOT),)
> -KBUILD_IMAGE := $(boot)/Image.gz
> -else
> -KBUILD_IMAGE := $(boot)/vmlinuz.efi
> -endif
> -endif
> -endif
>   BOOT_TARGETS := Image Image.gz loader loader.bin xipImage vmlinuz.efi
>   
>   all:	$(notdir $(KBUILD_IMAGE))


You can add:

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Thanks,

Alex


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] riscv: merge two if-blocks for KBUILD_IMAGE
  2024-03-23 11:35 [PATCH] riscv: merge two if-blocks for KBUILD_IMAGE Masahiro Yamada
  2024-03-26 19:52 ` Alexandre Ghiti
@ 2024-04-10 14:10 ` patchwork-bot+linux-riscv
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-04-10 14:10 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-riscv, paul.walmsley, palmer, aou, linux-kernel

Hello:

This patch was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Sat, 23 Mar 2024 20:35:00 +0900 you wrote:
> In arch/riscv/Makefile, KBUILD_IMAGE is assigned in two separate
> if-blocks.
> 
> When CONFIG_XIP_KERNEL is disabled, the decision made by the first
> if-block is overwritten by the second one, which is redundant and
> unreadable.
> 
> [...]

Here is the summary with links:
  - riscv: merge two if-blocks for KBUILD_IMAGE
    https://git.kernel.org/riscv/c/3b938e231b66

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-10 14:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-23 11:35 [PATCH] riscv: merge two if-blocks for KBUILD_IMAGE Masahiro Yamada
2024-03-26 19:52 ` Alexandre Ghiti
2024-04-10 14:10 ` patchwork-bot+linux-riscv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox