diff options
author | Simon Glass <sjg@chromium.org> | 2023-12-03 17:29:29 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-04-10 13:49:16 -0600 |
commit | 228c6722d4468d8cd9a3688e657976968ee3cdb8 (patch) | |
tree | 3bc39a64a6c810fd8d4ebb604d9d20a2d338fe8b /cmd/x86 | |
parent | 80d4c987576070082ed27da88aed732d42396135 (diff) | |
download | u-boot-228c6722d4468d8cd9a3688e657976968ee3cdb8.tar.gz u-boot-228c6722d4468d8cd9a3688e657976968ee3cdb8.tar.bz2 u-boot-228c6722d4468d8cd9a3688e657976968ee3cdb8.zip |
x86: zboot: Avoid iteration in do_zboot_states()
Drop the iteration and write out each state in full. This will allow
the arguments to be reduced and adjusted in future patches.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd/x86')
-rw-r--r-- | cmd/x86/zboot.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/cmd/x86/zboot.c b/cmd/x86/zboot.c index c9375fb417..03cab1d67e 100644 --- a/cmd/x86/zboot.c +++ b/cmd/x86/zboot.c @@ -136,19 +136,20 @@ U_BOOT_SUBCMDS(zboot, int do_zboot_states(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[], int state_mask) { - int i; - - for (i = 0; i < ZBOOT_STATE_COUNT; i++) { - struct cmd_tbl *cmd = &zboot_subcmds[i]; - int mask = 1 << i; - int ret; - - if (mask & state_mask) { - ret = cmd->cmd(cmd, flag, argc, argv); - if (ret) - return ret; - } - } + int ret; + + if (flag & ZBOOT_STATE_START) + ret = do_zboot_start(cmdtp, flag, argc, argv); + if (!ret && (flag & ZBOOT_STATE_LOAD)) + ret = do_zboot_load(cmdtp, flag, argc, argv); + if (!ret && (flag & ZBOOT_STATE_SETUP)) + ret = do_zboot_setup(cmdtp, flag, argc, argv); + if (!ret && (flag & ZBOOT_STATE_INFO)) + ret = do_zboot_info(cmdtp, flag, argc, argv); + if (!ret && (flag & ZBOOT_STATE_GO)) + ret = do_zboot_go(cmdtp, flag, argc, argv); + if (ret) + return ret; return 0; } |