aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-10-11 09:47:09 -0600
committerSimon Glass <sjg@chromium.org>2022-10-17 21:17:12 -0600
commit2c0b61d562d3d5db46cc72cd4ae66fb13b3185cf (patch)
treeb94df45f6abad72c8f40b6f3a0f59b29387c6e61
parentf06443f9d5dfc616b05d3526c258044bfce77419 (diff)
downloadu-boot-2c0b61d562d3d5db46cc72cd4ae66fb13b3185cf.zip
u-boot-2c0b61d562d3d5db46cc72cd4ae66fb13b3185cf.tar.gz
u-boot-2c0b61d562d3d5db46cc72cd4ae66fb13b3185cf.tar.bz2
bootm: Drop #ifdef from do_bootm()
Drop the #ifdefs from this command by using a variable to hold the states that should be executed. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--cmd/bootm.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/cmd/bootm.c b/cmd/bootm.c
index f09b41c..37c2af9 100644
--- a/cmd/bootm.c
+++ b/cmd/bootm.c
@@ -120,6 +120,7 @@ static int do_bootm_subcommand(struct cmd_tbl *cmdtp, int flag, int argc,
int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
+ int states;
int ret;
#ifdef CONFIG_NEEDS_MANUAL_RELOC
@@ -154,17 +155,15 @@ int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return do_bootm_subcommand(cmdtp, flag, argc, argv);
}
- ret = do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START |
- BOOTM_STATE_FINDOS | BOOTM_STATE_PRE_LOAD | BOOTM_STATE_FINDOTHER |
- BOOTM_STATE_LOADOS |
-#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
- BOOTM_STATE_RAMDISK |
-#endif
-#if defined(CONFIG_PPC) || defined(CONFIG_MIPS)
- BOOTM_STATE_OS_CMDLINE |
-#endif
+ states = BOOTM_STATE_START | BOOTM_STATE_FINDOS | BOOTM_STATE_PRE_LOAD |
+ BOOTM_STATE_FINDOTHER | BOOTM_STATE_LOADOS |
BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO |
- BOOTM_STATE_OS_GO, &images, 1);
+ BOOTM_STATE_OS_GO;
+ if (IS_ENABLED(CONFIG_SYS_BOOT_RAMDISK_HIGH))
+ states |= BOOTM_STATE_RAMDISK;
+ if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_MIPS))
+ states |= BOOTM_STATE_OS_CMDLINE;
+ ret = do_bootm_states(cmdtp, flag, argc, argv, states, &images, 1);
return ret ? CMD_RET_FAILURE : 0;
}