diff options
| author | Simon Glass <[email protected]> | 2025-05-02 08:46:27 -0600 |
|---|---|---|
| committer | Simon Glass <[email protected]> | 2025-05-30 09:49:32 +0100 |
| commit | b991a0c8bf30095837b096acd691e0d2add07b8c (patch) | |
| tree | c747f676d09bc5838476b82cd30f613163d1529b /cmd | |
| parent | 509852111422454117561c3d4aa4827270ca68d4 (diff) | |
expo: Split bootflow_menu_run() into two pieces
Split the starting piece of this function into bootflow_menu_start()
and the polling part into bootflow_menu_poll() so that it is possible
for the caller to be in control of the event loop.
Move the expo_destroy() call into the caller.
Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/bootflow.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/cmd/bootflow.c b/cmd/bootflow.c index f2662239714..efac27a5d77 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -14,6 +14,8 @@ #include <console.h> #include <dm.h> #include <env.h> +#include <expo.h> +#include <log.h> #include <mapmem.h> /** @@ -105,24 +107,32 @@ __maybe_unused static int bootflow_handle_menu(struct bootstd_priv *std, bool text_mode, struct bootflow **bflowp) { + struct expo *exp; struct bootflow *bflow; int ret; - ret = bootflow_menu_run(std, text_mode, &bflow); - if (ret) { - if (ret == -EPIPE) { - printf("Nothing chosen\n"); - std->cur_bootflow = NULL; - } else { - printf("Menu failed (err=%d)\n", ret); - } + ret = bootflow_menu_start(std, text_mode, &exp); + if (ret) + return log_msg_ret("bhs", ret); - return ret; - } + do { + ret = bootflow_menu_poll(exp, &bflow); + } while (ret == -EAGAIN); - printf("Selected: %s\n", bflow->os_name ? bflow->os_name : bflow->name); - std->cur_bootflow = bflow; - *bflowp = bflow; + if (ret == -EPIPE) { + printf("Nothing chosen\n"); + std->cur_bootflow = NULL; + } else if (ret) { + printf("Menu failed (err=%d)\n", ret); + } else { + printf("Selected: %s\n", bflow->os_name ? bflow->os_name : + bflow->name); + std->cur_bootflow = bflow; + *bflowp = bflow; + } + expo_destroy(exp); + if (ret) + return ret; return 0; } |
