]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
kconfig: remove sym_get_choice_value()
authorMasahiro Yamada <masahiroy@kernel.org>
Tue, 18 Jun 2024 10:35:22 +0000 (19:35 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Mon, 15 Jul 2024 16:08:37 +0000 (01:08 +0900)
sym_get_choice_value(menu->sym) is equivalent to sym_calc_choice(menu).

Convert all call sites of sym_get_choice_value() and then remove it.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/kconfig/conf.c
scripts/kconfig/gconf.c
scripts/kconfig/lkc.h
scripts/kconfig/mconf.c
scripts/kconfig/nconf.c
scripts/kconfig/symbol.c

index 1c59998a62f75790181362a06d2b77f74e9c6582..3d7d454c54da3c01df7a4a0b488b114be132e7b1 100644 (file)
@@ -422,17 +422,15 @@ help:
 
 static void conf_choice(struct menu *menu)
 {
-       struct symbol *sym, *def_sym;
+       struct symbol *def_sym;
        struct menu *child;
        bool is_new = false;
 
-       sym = menu->sym;
-
        while (1) {
                int cnt, def;
 
                printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
-               def_sym = sym_get_choice_value(sym);
+               def_sym = sym_calc_choice(menu);
                cnt = def = 0;
                line[0] = 0;
                for (child = menu->list; child; child = child->next) {
index 380421a5cfb2a5e54bbb0620a40b271d493c4dcf..6b50e25133e3bfcd194dcc3a1d118dd6d19aa656 100644 (file)
@@ -1054,7 +1054,7 @@ static gchar **fill_row(struct menu *menu)
 
        if (sym_is_choice(sym)) {       // parse childs for getting final value
                struct menu *child;
-               struct symbol *def_sym = sym_get_choice_value(sym);
+               struct symbol *def_sym = sym_calc_choice(menu);
                struct menu *def_menu = NULL;
 
                for (child = menu->list; child; child = child->next) {
index bdd37a16b040757eaa9232e942ae41685b6d3220..d820272a85fb0a7a42438fd6ba7d5b9ee50f39b5 100644 (file)
@@ -110,6 +110,7 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help);
 /* symbol.c */
 void sym_clear_all_valid(void);
 struct symbol *sym_choice_default(struct symbol *sym);
+struct symbol *sym_calc_choice(struct menu *choice);
 struct property *sym_get_range_prop(struct symbol *sym);
 const char *sym_get_string_default(struct symbol *sym);
 struct symbol *sym_check_deps(struct symbol *sym);
@@ -120,8 +121,6 @@ static inline tristate sym_get_tristate_value(struct symbol *sym)
        return sym->curr.tri;
 }
 
-struct symbol *sym_get_choice_value(struct symbol *sym);
-
 static inline bool sym_is_choice(struct symbol *sym)
 {
        /* A choice is a symbol with no name */
index 03709eb734aece0d2f4e97855c1d0672ce46a0d3..4a0a97bb342f6b8e6b80dba4bb862233cace0ae0 100644 (file)
@@ -514,7 +514,7 @@ static void build_conf(struct menu *menu)
 
        type = sym_get_type(sym);
        if (sym_is_choice(sym)) {
-               struct symbol *def_sym = sym_get_choice_value(sym);
+               struct symbol *def_sym = sym_calc_choice(menu);
                struct menu *def_menu = NULL;
 
                child_count++;
@@ -600,7 +600,7 @@ static void conf_choice(struct menu *menu)
        struct menu *child;
        struct symbol *active;
 
-       active = sym_get_choice_value(menu->sym);
+       active = sym_calc_choice(menu);
        while (1) {
                int res;
                int selected;
@@ -619,7 +619,7 @@ static void conf_choice(struct menu *menu)
                        item_set_data(child);
                        if (child->sym == active)
                                item_set_selected(1);
-                       if (child->sym == sym_get_choice_value(menu->sym))
+                       if (child->sym == sym_calc_choice(menu))
                                item_set_tag('X');
                }
                dialog_clear();
index eb5fc3ccaf9da7e7aaf1fab8ffc6297c1a006aa8..1456e24969aa5368fa12b3fec7fc50d577574a1b 100644 (file)
@@ -815,7 +815,7 @@ static void build_conf(struct menu *menu)
 
        type = sym_get_type(sym);
        if (sym_is_choice(sym)) {
-               struct symbol *def_sym = sym_get_choice_value(sym);
+               struct symbol *def_sym = sym_calc_choice(menu);
                struct menu *def_menu = NULL;
 
                child_count++;
@@ -1239,7 +1239,7 @@ static void conf_choice(struct menu *menu)
                .pattern = "",
        };
 
-       active = sym_get_choice_value(menu->sym);
+       active = sym_calc_choice(menu);
        /* this is mostly duplicated from the conf() function. */
        while (!global_exit) {
                reset_menu();
@@ -1248,7 +1248,7 @@ static void conf_choice(struct menu *menu)
                        if (!show_all_items && !menu_is_visible(child))
                                continue;
 
-                       if (child->sym == sym_get_choice_value(menu->sym))
+                       if (child->sym == sym_calc_choice(menu))
                                item_make(child, ':', "<X> %s",
                                                menu_get_prompt(child));
                        else if (child->sym)
index 329c7bd314cfc37c1767f5c189a3a64bf2f5e6d8..344a241e1e9416ff796bd2c40bbf6e66162c4203 100644 (file)
@@ -288,7 +288,7 @@ struct symbol *sym_choice_default(struct symbol *sym)
  *
  * Return: a chosen symbol
  */
-static struct symbol *sym_calc_choice(struct menu *choice)
+struct symbol *sym_calc_choice(struct menu *choice)
 {
        struct symbol *res = NULL;
        struct symbol *sym;
@@ -365,13 +365,6 @@ static struct symbol *sym_calc_choice(struct menu *choice)
        return res;
 }
 
-struct symbol *sym_get_choice_value(struct symbol *sym)
-{
-       struct menu *menu = list_first_entry(&sym->menus, struct menu, link);
-
-       return sym_calc_choice(menu);
-}
-
 static void sym_warn_unmet_dep(struct symbol *sym)
 {
        struct gstr gs = str_new();