aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-12-15 20:14:16 -0700
committerTom Rini <trini@konsulko.com>2023-12-21 16:07:52 -0500
commit0c96b6817f22b7a3d3e7892d21430a1ce9cc0c83 (patch)
tree226439503f35ee29a3d7c025eac404cd1b297500
parente370e3df108800ecfc3b3fe3a7f6ba37498e0289 (diff)
downloadu-boot-0c96b6817f22b7a3d3e7892d21430a1ce9cc0c83.zip
u-boot-0c96b6817f22b7a3d3e7892d21430a1ce9cc0c83.tar.gz
u-boot-0c96b6817f22b7a3d3e7892d21430a1ce9cc0c83.tar.bz2
booti: Avoid use of #ifdef
Use the compiler to get the set of states, instead of the preprocessor. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
-rw-r--r--cmd/booti.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/cmd/booti.c b/cmd/booti.c
index 41d40c9..d3cceb7 100644
--- a/cmd/booti.c
+++ b/cmd/booti.c
@@ -105,6 +105,7 @@ static int booti_start(struct cmd_tbl *cmdtp, int flag, int argc,
int do_booti(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
+ int states;
int ret;
/* Consume 'booti' */
@@ -120,19 +121,16 @@ int do_booti(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
bootm_disable_interrupts();
images.os.os = IH_OS_LINUX;
-#ifdef CONFIG_RISCV_SMODE
- images.os.arch = IH_ARCH_RISCV;
-#elif CONFIG_ARM64
- images.os.arch = IH_ARCH_ARM64;
-#endif
- ret = do_bootm_states(cmdtp, flag, argc, argv,
-#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
- BOOTM_STATE_RAMDISK |
-#endif
- BOOTM_STATE_MEASURE |
- BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO |
- BOOTM_STATE_OS_GO,
- &images, 1);
+ if (IS_ENABLED(CONFIG_RISCV_SMODE))
+ images.os.arch = IH_ARCH_RISCV;
+ else if (IS_ENABLED(CONFIG_ARM64))
+ images.os.arch = IH_ARCH_ARM64;
+
+ states = BOOTM_STATE_MEASURE | BOOTM_STATE_OS_PREP |
+ BOOTM_STATE_OS_FAKE_GO | BOOTM_STATE_OS_GO;
+ if (IS_ENABLED(CONFIG_SYS_BOOT_RAMDISK_HIGH))
+ states |= BOOTM_STATE_RAMDISK;
+ ret = do_bootm_states(cmdtp, flag, argc, argv, states, &images, 1);
return ret;
}