Skip to content

Commit dfff05c

Browse files
committed
kconfig: use menu_list_for_each_sym() in sym_check_choice_deps()
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 fb8dd48 commit dfff05c

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

scripts/kconfig/symbol.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,31 +1204,36 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym)
12041204

12051205
static struct symbol *sym_check_choice_deps(struct symbol *choice)
12061206
{
1207-
struct symbol *sym, *sym2;
1208-
struct property *prop;
1209-
struct expr *e;
1207+
struct menu *choice_menu, *menu;
1208+
struct symbol *sym2;
12101209
struct dep_stack stack;
12111210

12121211
dep_stack_insert(&stack, choice);
12131212

1214-
prop = sym_get_choice_prop(choice);
1215-
expr_list_for_each_sym(prop->expr, e, sym)
1216-
sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
1213+
choice_menu = list_first_entry(&choice->menus, struct menu, link);
1214+
1215+
menu_for_each_sub_entry(menu, choice_menu) {
1216+
if (menu->sym)
1217+
menu->sym->flags |= SYMBOL_CHECK | SYMBOL_CHECKED;
1218+
}
12171219

12181220
choice->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
12191221
sym2 = sym_check_sym_deps(choice);
12201222
choice->flags &= ~SYMBOL_CHECK;
12211223
if (sym2)
12221224
goto out;
12231225

1224-
expr_list_for_each_sym(prop->expr, e, sym) {
1225-
sym2 = sym_check_sym_deps(sym);
1226+
menu_for_each_sub_entry(menu, choice_menu) {
1227+
if (!menu->sym)
1228+
continue;
1229+
sym2 = sym_check_sym_deps(menu->sym);
12261230
if (sym2)
12271231
break;
12281232
}
12291233
out:
1230-
expr_list_for_each_sym(prop->expr, e, sym)
1231-
sym->flags &= ~SYMBOL_CHECK;
1234+
menu_for_each_sub_entry(menu, choice_menu)
1235+
if (menu->sym)
1236+
menu->sym->flags &= ~SYMBOL_CHECK;
12321237

12331238
if (sym2 && sym_is_choice_value(sym2) &&
12341239
prop_get_symbol(sym_get_choice_prop(sym2)) == choice)

0 commit comments

Comments
 (0)