summaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/symbol.c
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2024-06-18 12:35:25 +0200
committerMasahiro Yamada <masahiroy@kernel.org>2024-07-15 18:08:37 +0200
commit6e6d0e917a9714297614b41fbbfde1625249e197 (patch)
tree1320a4dc4f3ae5ac0b2e544cba1906c77b5b1fdf /scripts/kconfig/symbol.c
parentkconfig: change sym_choice_default() to take the choice menu (diff)
downloadlinux-6e6d0e917a9714297614b41fbbfde1625249e197.tar.xz
linux-6e6d0e917a9714297614b41fbbfde1625249e197.zip
kconfig: use menu_list_for_each_sym() in sym_choice_default()
Choices and their members are associated via the P_CHOICE property. Currently, sym_get_choice_prop() and expr_list_for_each_sym() are used to iterate on choice members. Replace them with menu_for_each_sub_entry(), which achieves the same without relying on P_CHOICE. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/kconfig/symbol.c')
-rw-r--r--scripts/kconfig/symbol.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 3d68ab8e1eb4..56e7a76e7a77 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -257,9 +257,9 @@ static void sym_calc_visibility(struct symbol *sym)
*/
struct symbol *sym_choice_default(struct menu *choice)
{
+ struct menu *menu;
struct symbol *def_sym;
struct property *prop;
- struct expr *e;
/* any of the defaults visible? */
for_all_defaults(choice->sym, prop) {
@@ -272,10 +272,9 @@ struct symbol *sym_choice_default(struct menu *choice)
}
/* just get the first visible value */
- prop = sym_get_choice_prop(choice->sym);
- expr_list_for_each_sym(prop->expr, e, def_sym)
- if (def_sym->visible != no)
- return def_sym;
+ menu_for_each_sub_entry(menu, choice)
+ if (menu->sym && menu->sym->visible != no)
+ return menu->sym;
/* failed to locate any defaults */
return NULL;