diff options
| author | Simon Glass <[email protected]> | 2025-05-02 08:46:56 -0600 |
|---|---|---|
| committer | Simon Glass <[email protected]> | 2025-05-30 09:49:33 +0100 |
| commit | f769735f88fe8d864a895b275b4148616ffe2a29 (patch) | |
| tree | 3d7940c0a7baec9dd430231f25ac0f4856491581 /boot | |
| parent | 06a9d88e4d887ea4c7395636d2cfb52948ab4112 (diff) | |
expo: Split setting up the menu from adding items
Some callers may wish to add items later as they are discovered. Split
the setup code into its own function, to permit this.
Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'boot')
| -rw-r--r-- | boot/bootflow_menu.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/boot/bootflow_menu.c b/boot/bootflow_menu.c index 6bca17142ad..56a34ac8ed5 100644 --- a/boot/bootflow_menu.c +++ b/boot/bootflow_menu.c @@ -210,7 +210,6 @@ int bootflow_menu_add_all(struct expo *exp) ret = bootflow_menu_add(exp, bflow, i, &scn); if (ret) return log_msg_ret("bao", ret); - } ret = scene_arrange(scn); @@ -257,7 +256,7 @@ int bootflow_menu_apply_theme(struct expo *exp, ofnode node) return 0; } -int bootflow_menu_start(struct bootstd_priv *std, bool text_mode, +int bootflow_menu_setup(struct bootstd_priv *std, bool text_mode, struct expo **expp) { struct udevice *dev; @@ -267,9 +266,6 @@ int bootflow_menu_start(struct bootstd_priv *std, bool text_mode, ret = bootflow_menu_new(&exp); if (ret) return log_msg_ret("bmn", ret); - ret = bootflow_menu_add_all(exp); - if (ret) - return log_msg_ret("bma", ret); if (ofnode_valid(std->theme)) { ret = bootflow_menu_apply_theme(exp, std->theme); @@ -292,6 +288,31 @@ int bootflow_menu_start(struct bootstd_priv *std, bool text_mode, if (text_mode) expo_set_text_mode(exp, text_mode); + *expp = exp; + + return 0; +} + +int bootflow_menu_start(struct bootstd_priv *std, bool text_mode, + struct expo **expp) +{ + struct expo *exp; + int ret; + + ret = bootflow_menu_setup(std, text_mode, &exp); + if (ret) + return log_msg_ret("bmd", ret); + + ret = bootflow_menu_add_all(exp); + if (ret) + return log_msg_ret("bma", ret); + + if (ofnode_valid(std->theme)) { + ret = expo_apply_theme(exp, std->theme); + if (ret) + return log_msg_ret("thm", ret); + } + ret = expo_calc_dims(exp); if (ret) return log_msg_ret("bmd", ret); |
