diff mbox series

[2/6] board_r: env: Use IS_ENABLED() instead of #ifdefs

Message ID 20200506173847.35635-2-ovidiu.panait@windriver.com
State Accepted
Commit 9441f8cbfe30e9addd12ad7735e36b4815be65b1
Headers show
Series [1/6] env: Convert CONFIG_DELAY_ENVIRONMENT to Kconfig | expand

Commit Message

Ovidiu Panait May 6, 2020, 5:38 p.m. UTC
Use IS_ENABLED() instead of #ifdef in should_load_env and initr_env
functions.

No functional change intended.

Signed-off-by: Ovidiu Panait <ovidiu.panait at windriver.com>
---
 common/board_r.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Comments

Tom Rini May 16, 2020, 1:45 a.m. UTC | #1
On Wed, May 06, 2020 at 08:38:43PM +0300, Ovidiu Panait wrote:

> Use IS_ENABLED() instead of #ifdef in should_load_env and initr_env
> functions.
> 
> No functional change intended.
> 
> Signed-off-by: Ovidiu Panait <ovidiu.panait at windriver.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/common/board_r.c b/common/board_r.c
index d9015cd057..f6770f2300 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -464,13 +464,14 @@  static int initr_mmc(void)
  */
 static int should_load_env(void)
 {
-#ifdef CONFIG_OF_CONTROL
-	return fdtdec_get_config_int(gd->fdt_blob, "load-environment", 1);
-#elif defined CONFIG_DELAY_ENVIRONMENT
-	return 0;
-#else
+	if (IS_ENABLED(CONFIG_OF_CONTROL))
+		return fdtdec_get_config_int(gd->fdt_blob,
+						"load-environment", 1);
+
+	if (IS_ENABLED(CONFIG_DELAY_ENVIRONMENT))
+		return 0;
+
 	return 1;
-#endif
 }
 
 static int initr_env(void)
@@ -480,10 +481,10 @@  static int initr_env(void)
 		env_relocate();
 	else
 		env_set_default(NULL, 0);
-#ifdef CONFIG_OF_CONTROL
-	env_set_hex("fdtcontroladdr",
-		    (unsigned long)map_to_sysmem(gd->fdt_blob));
-#endif
+
+	if (IS_ENABLED(CONFIG_OF_CONTROL))
+		env_set_hex("fdtcontroladdr",
+			    (unsigned long)map_to_sysmem(gd->fdt_blob));
 
 	/* Initialize from environment */
 	image_load_addr = env_get_ulong("loadaddr", 16, image_load_addr);