summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-01-06 17:52:23 +0300
committerTom Rini <trini@konsulko.com>2023-01-16 22:14:11 +0300
commit5712976b26f7865f348aba51c9fa367c456e1795 (patch)
treedb46234be425f7f86318957feac2896f8bdc19ec /common
parent2da4a15e7e947d2d304ec1ba392556c3e0393e13 (diff)
downloadu-boot-5712976b26f7865f348aba51c9fa367c456e1795.tar.xz
menu: Update bootmenu_autoboot_loop() to return the code
Use the return value to save having to pass around a pointer. This also resolves any ambiguity about what *key contains when the function is called. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/menu.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/common/menu.c b/common/menu.c
index a245c5a9c6..bafc8470d7 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -425,9 +425,9 @@ int menu_destroy(struct menu *m)
return 1;
}
-void bootmenu_autoboot_loop(struct bootmenu_data *menu,
- enum bootmenu_key *key, int *esc)
+enum bootmenu_key bootmenu_autoboot_loop(struct bootmenu_data *menu, int *esc)
{
+ enum bootmenu_key key = BKEY_NONE;
int i, c;
while (menu->delay > 0) {
@@ -446,16 +446,16 @@ void bootmenu_autoboot_loop(struct bootmenu_data *menu,
switch (c) {
case '\e':
*esc = 1;
- *key = BKEY_NONE;
+ key = BKEY_NONE;
break;
case '\r':
- *key = BKEY_SELECT;
+ key = BKEY_SELECT;
break;
case 0x3: /* ^C */
- *key = BKEY_QUIT;
+ key = BKEY_QUIT;
break;
default:
- *key = BKEY_NONE;
+ key = BKEY_NONE;
break;
}
@@ -471,7 +471,9 @@ void bootmenu_autoboot_loop(struct bootmenu_data *menu,
printf(ANSI_CURSOR_POSITION ANSI_CLEAR_LINE, menu->count + 5, 1);
if (menu->delay == 0)
- *key = BKEY_SELECT;
+ key = BKEY_SELECT;
+
+ return key;
}
void bootmenu_loop(struct bootmenu_data *menu,