Skip to contentSkip to conversation

riscv: ae350: Use #if defined instead of CONFIG_IS_ENABLED

PATCH Superseded Leo Yu-Chi Liang 3 participants 6 messages Oct 27, 2021 – Nov 1, 2021 1 message not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: ae350: Use #if defined instead of CONFIG_IS_ENABLED

According to ./include/linux/kconfig.h,
CONFIG_IS_ENABLED(OF_BOARD) expands to 0
when CONFIG_SPL_BUILD is defined because
there is no CONFIG_SPL_OF_BOARD.

Use #if defined instead.

---
 board/AndesTech/ax25-ae350/ax25-ae350.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/AndesTech/ax25-ae350/ax25-ae350.c +2 -2
index b28894ed46..58bf236497 100644
@@ -56,9 +56,9 @@ ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
 
 void *board_fdt_blob_setup(void)
 {
-#if CONFIG_IS_ENABLED(OF_BOARD)
+#if defined(CONFIG_OF_BOARD)
 	return (void *)(ulong)gd->arch.firmware_fdt_addr;
-#elif CONFIG_IS_ENABLED(OF_SEPARATE)
+#elif defined(CONFIG_OF_SEPARATE)
 	return (void *)CONFIG_SYS_FDT_BASE;
 #else
 	return NULL;
Signature · 1 line
2.17.0

A message that is not in the archive (sent off-list or not yet received): HK0PR03MB2994A2BC40279DC7AF913DE2C18A9@HK0PR03MB2994.apcprd03.prod.outlook.com

Reviewed-by
#2 lore raw
Quoted 9 lines

From: Leo Yu-Chi Liang(梁育齊) <[email protected]>
Sent: Wednesday, October 27, 2021 4:59 PM
To: Rick Jian-Zhi Chen(陳建志) <[email protected]>; Leo Yu-Chi Liang(梁育齊) <[email protected]>
Cc: [email protected]
Subject: [PATCH] riscv: ae350: Use #if defined instead of CONFIG_IS_ENABLED

According to ./include/linux/kconfig.h,
CONFIG_IS_ENABLED(OF_BOARD) expands to 0 when CONFIG_SPL_BUILD is defined because there is no CONFIG_SPL_OF_BOARD.

Quoted 6 lines

Use #if defined instead.

---
 board/AndesTech/ax25-ae350/ax25-ae350.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
#3 lore raw
In reply to Leo Yu-Chi Liang

Hi Leo,

Quoted 5 lines · Leo Yu-Chi Liang

According to ./include/linux/kconfig.h,
CONFIG_IS_ENABLED(OF_BOARD) expands to 0
when CONFIG_SPL_BUILD is defined because
there is no CONFIG_SPL_OF_BOARD.

Why is the change?

Quoted 8 lines

Use #if defined instead.

---
 board/AndesTech/ax25-ae350/ax25-ae350.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Regards,
Bin

author
#4 lore raw

Hi Bin,

Quoted 11 lines · Bin Meng

Hi Leo,

Quoted 5 lines · Leo Yu-Chi Liang

According to ./include/linux/kconfig.h,
CONFIG_IS_ENABLED(OF_BOARD) expands to 0
when CONFIG_SPL_BUILD is defined because
there is no CONFIG_SPL_OF_BOARD.

Why is the change?

The original code was

void *board_fdt_blob_setup(void)
{
#if CONFIG_IS_ENABLED(OF_BOARD)
return (void *)(ulong)gd->arch.firmware_fdt_addr;
#elif CONFIG_IS_ENABLED(OF_SEPARATE)
return (void *)CONFIG_SYS_FDT_BASE;
#else
return NULL;
}

But the "return (void *)(ulong)gd->arch.firmware_fdt_addr;" does not get compiled even if OF_BOARD is selected when building ae350_*_spl_*_defconfig, thus this patch.

The reason is because ./include/linux/kconfig.h states "CONFIG_IS_ENABLED(FOO) expands to 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y'".
However, we don't have CONFIG_SPL_OF_BOARD, so CONFIG_IS_ENABLED(OF_BOARD) only expands to 0.

Best regards,
Leo

Quoted 11 lines
Quoted 8 lines

Use #if defined instead.

---
 board/AndesTech/ax25-ae350/ax25-ae350.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Regards,
Bin

Reviewed-by
#5 lore raw

Hi Leo,

Quoted 31 lines · Leo Liang

Hi Bin,

Quoted 11 lines · Bin Meng

Hi Leo,

Quoted 5 lines · Leo Yu-Chi Liang

According to ./include/linux/kconfig.h,
CONFIG_IS_ENABLED(OF_BOARD) expands to 0
when CONFIG_SPL_BUILD is defined because
there is no CONFIG_SPL_OF_BOARD.

Why is the change?

The original code was

void *board_fdt_blob_setup(void)
{

#if CONFIG_IS_ENABLED(OF_BOARD)
        return (void *)(ulong)gd->arch.firmware_fdt_addr;
#elif CONFIG_IS_ENABLED(OF_SEPARATE)
        return (void *)CONFIG_SYS_FDT_BASE;
#else
        return NULL;
}

But the "return (void *)(ulong)gd->arch.firmware_fdt_addr;" does not get compiled even if OF_BOARD is selected when building ae350_*_spl_*_defconfig, thus this patch.

Quoted 6 lines

The reason is because ./include/linux/kconfig.h states "CONFIG_IS_ENABLED(FOO) expands to 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y'".
However, we don't have CONFIG_SPL_OF_BOARD, so CONFIG_IS_ENABLED(OF_BOARD) only expands to 0.

Thanks!

Please add:

Fixes 2e8d2f88439d ("riscv: Remove OF_PRIOR_STAGE from RISC-V boards")

Regards,
Bin

author
#6 lore raw
Quoted 41 lines · Bin Meng

Hi Leo,

Quoted 31 lines · Leo Liang

Hi Bin,

Quoted 11 lines · Bin Meng

Hi Leo,

Quoted 5 lines · Leo Yu-Chi Liang

According to ./include/linux/kconfig.h,
CONFIG_IS_ENABLED(OF_BOARD) expands to 0
when CONFIG_SPL_BUILD is defined because
there is no CONFIG_SPL_OF_BOARD.

Why is the change?

The original code was

void *board_fdt_blob_setup(void)
{

#if CONFIG_IS_ENABLED(OF_BOARD)
        return (void *)(ulong)gd->arch.firmware_fdt_addr;
#elif CONFIG_IS_ENABLED(OF_SEPARATE)
        return (void *)CONFIG_SYS_FDT_BASE;
#else
        return NULL;
}

But the "return (void *)(ulong)gd->arch.firmware_fdt_addr;" does not get compiled even if OF_BOARD is selected when building ae350_*_spl_*_defconfig, thus this patch.

Quoted 6 lines

The reason is because ./include/linux/kconfig.h states "CONFIG_IS_ENABLED(FOO) expands to 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y'".
However, we don't have CONFIG_SPL_OF_BOARD, so CONFIG_IS_ENABLED(OF_BOARD) only expands to 0.

Quoted 7 lines

Thanks!

Please add:

Fixes 2e8d2f88439d ("riscv: Remove OF_PRIOR_STAGE from RISC-V boards")

Will do. Thanks!

Best regards,
Leo

Quoted 2 lines

Regards,
Bin