U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] riscv: cpu: Use CONFIG_IS_ENABLED(CPU) instead of plain ifdef
@ 2025-07-17  6:26 Michal Simek
  2025-08-11  6:31 ` Leo Liang
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Simek @ 2025-07-17  6:26 UTC (permalink / raw)
  To: u-boot, git; +Cc: Leo, Mayuresh Chitale, Rick Chen, Tom Rini, Yao Zi

ifdef CONFIG_CPU only works in U-Boot proper but macro is not working when
XPL phases are used. In this case CONFIG_SPL_CPU is also defined and can be
disabled which is causing compilation error.

Signed-off-by: Michal Simek <michal.simek@amd.com>
---

 arch/riscv/cpu/cpu.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
index 15c4e14599d1..d5123e4b7d97 100644
--- a/arch/riscv/cpu/cpu.c
+++ b/arch/riscv/cpu/cpu.c
@@ -608,14 +608,14 @@ static inline bool supports_extension(char ext)
 
 static int riscv_cpu_probe(void)
 {
-#ifdef CONFIG_CPU
-	int ret;
+	if (CONFIG_IS_ENABLED(CPU)) {
+		int ret;
 
-	/* probe cpus so that RISC-V timer can be bound */
-	ret = cpu_probe_all();
-	if (ret)
-		return log_msg_ret("RISC-V cpus probe failed\n", ret);
-#endif
+		/* probe cpus so that RISC-V timer can be bound */
+		ret = cpu_probe_all();
+		if (ret)
+			return log_msg_ret("RISC-V cpus probe failed\n", ret);
+	}
 
 	return 0;
 }
-- 
2.43.0

base-commit: 4634016dd14f0e39b5afae1c20f01bfce2bda262
branch: debian-sent3

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

* Re: [PATCH] riscv: cpu: Use CONFIG_IS_ENABLED(CPU) instead of plain ifdef
  2025-07-17  6:26 [PATCH] riscv: cpu: Use CONFIG_IS_ENABLED(CPU) instead of plain ifdef Michal Simek
@ 2025-08-11  6:31 ` Leo Liang
  0 siblings, 0 replies; 2+ messages in thread
From: Leo Liang @ 2025-08-11  6:31 UTC (permalink / raw)
  To: Michal Simek; +Cc: u-boot, git, Mayuresh Chitale, Rick Chen, Tom Rini, Yao Zi

On Thu, Jul 17, 2025 at 08:26:15AM +0200, Michal Simek wrote:
> ifdef CONFIG_CPU only works in U-Boot proper but macro is not working when
> XPL phases are used. In this case CONFIG_SPL_CPU is also defined and can be
> disabled which is causing compilation error.
> 
> Signed-off-by: Michal Simek <michal.simek@amd.com>
> ---
> 
>  arch/riscv/cpu/cpu.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

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

end of thread, other threads:[~2025-08-11  6:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-17  6:26 [PATCH] riscv: cpu: Use CONFIG_IS_ENABLED(CPU) instead of plain ifdef Michal Simek
2025-08-11  6:31 ` Leo Liang

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