]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
expo: Move cedit-state fields into expo
authorSimon Glass <sjg@chromium.org>
Fri, 2 May 2025 14:46:20 +0000 (08:46 -0600)
committerSimon Glass <sjg@chromium.org>
Fri, 30 May 2025 08:49:32 +0000 (09:49 +0100)
Move the boolean flags into struct expo so that the state can be
maintained over function calls.

Signed-off-by: Simon Glass <sjg@chromium.org>
boot/cedit.c
include/expo.h

index b7b9cc510e05fa091a07c1296578828440cd4143..8c6948d1d4610272a15856a2d9d39d208ee619e9 100644 (file)
@@ -154,7 +154,6 @@ int cedit_run(struct expo *exp)
        struct video_priv *vid_priv;
        uint scene_id;
        struct scene *scn;
-       bool done, save;
        int ret;
 
        ret = cedit_prepare(exp, &vid_priv, &scn);
@@ -162,8 +161,8 @@ int cedit_run(struct expo *exp)
                return log_msg_ret("prep", ret);
        scene_id = ret;
 
-       done = false;
-       save = false;
+       exp->done = false;
+       exp->save = false;
        do {
                struct expo_action act;
 
@@ -179,11 +178,11 @@ int cedit_run(struct expo *exp)
                                cedit_arange(exp, vid_priv, scene_id);
                                switch (scn->highlight_id) {
                                case EXPOID_SAVE:
-                                       done = true;
-                                       save = true;
+                                       exp->done = true;
+                                       exp->save = true;
                                        break;
                                case EXPOID_DISCARD:
-                                       done = true;
+                                       exp->done = true;
                                        break;
                                }
                                break;
@@ -197,7 +196,7 @@ int cedit_run(struct expo *exp)
                                break;
                        case EXPOACT_QUIT:
                                log_debug("quitting\n");
-                               done = true;
+                               exp->done = true;
                                break;
                        default:
                                break;
@@ -205,11 +204,11 @@ int cedit_run(struct expo *exp)
                } else if (ret != -EAGAIN) {
                        return log_msg_ret("cep", ret);
                }
-       } while (!done);
+       } while (!exp->done);
 
        if (ret)
                return log_msg_ret("end", ret);
-       if (!save)
+       if (!exp->save)
                return -EACCES;
 
        return 0;
index 63452bbdd6a5662607af8c78f107b3fba79afb28..f8d44c0ea20a2f92b722fb5d63bacf6656708c69 100644 (file)
@@ -105,6 +105,8 @@ struct expo_theme {
  * @text_mode: true to use text mode for the menu (no vidconsole)
  * @popup: true to use popup menus, instead of showing all items
  * @priv: Private data for the controller
+ * @done: Indicates that a cedit session is complete and the user has quit
+ * @save: Indicates that cedit data should be saved, rather than discarded
  * @theme: Information about fonts styles, etc.
  * @scene_head: List of scenes
  * @str_head: list of strings
@@ -120,6 +122,8 @@ struct expo {
        bool text_mode;
        bool popup;
        void *priv;
+       bool done;
+       bool save;
        struct expo_theme theme;
        struct list_head scene_head;
        struct list_head str_head;