Skip to content

Commit 6e6d0e9

Browse files
committed
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 <[email protected]>
1 parent e8fcd91 commit 6e6d0e9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

scripts/kconfig/symbol.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ static void sym_calc_visibility(struct symbol *sym)
257257
*/
258258
struct symbol *sym_choice_default(struct menu *choice)
259259
{
260+
struct menu *menu;
260261
struct symbol *def_sym;
261262
struct property *prop;
262-
struct expr *e;
263263

264264
/* any of the defaults visible? */
265265
for_all_defaults(choice->sym, prop) {
@@ -272,10 +272,9 @@ struct symbol *sym_choice_default(struct menu *choice)
272272
}
273273

274274
/* just get the first visible value */
275-
prop = sym_get_choice_prop(choice->sym);
276-
expr_list_for_each_sym(prop->expr, e, def_sym)
277-
if (def_sym->visible != no)
278-
return def_sym;
275+
menu_for_each_sub_entry(menu, choice)
276+
if (menu->sym && menu->sym->visible != no)
277+
return menu->sym;
279278

280279
/* failed to locate any defaults */
281280
return NULL;

0 commit comments

Comments
 (0)