[PATCH v3 13/22] bootz: Avoid use of #ifdef
Simon Glass
sjg at chromium.org
Sat Dec 16 04:14:17 CET 2023
Use the compiler to get the set of states, instead of the preprocessor.
Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Tom Rini <trini at konsulko.com>
---
(no changes since v2)
Changes in v2:
- Split out bootz removal of #ifdef
cmd/bootz.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/cmd/bootz.c b/cmd/bootz.c
index a652879ea5ec..8c25905598a8 100644
--- a/cmd/bootz.c
+++ b/cmd/bootz.c
@@ -64,7 +64,7 @@ static int bootz_start(struct cmd_tbl *cmdtp, int flag, int argc,
int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
- int ret;
+ int states, ret;
/* Consume 'bootz' */
argc--; argv++;
@@ -79,14 +79,13 @@ int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
bootm_disable_interrupts();
images.os.os = IH_OS_LINUX;
- 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);
+
+ 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;
}
--
2.43.0.472.g3155946c3a-goog
More information about the U-Boot
mailing list