Commit dfff05cc authored by Masahiro Yamada's avatar Masahiro Yamada

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: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent fb8dd482
...@@ -1204,16 +1204,18 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym) ...@@ -1204,16 +1204,18 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym)
static struct symbol *sym_check_choice_deps(struct symbol *choice) static struct symbol *sym_check_choice_deps(struct symbol *choice)
{ {
struct symbol *sym, *sym2; struct menu *choice_menu, *menu;
struct property *prop; struct symbol *sym2;
struct expr *e;
struct dep_stack stack; struct dep_stack stack;
dep_stack_insert(&stack, choice); dep_stack_insert(&stack, choice);
prop = sym_get_choice_prop(choice); choice_menu = list_first_entry(&choice->menus, struct menu, link);
expr_list_for_each_sym(prop->expr, e, sym)
sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED); menu_for_each_sub_entry(menu, choice_menu) {
if (menu->sym)
menu->sym->flags |= SYMBOL_CHECK | SYMBOL_CHECKED;
}
choice->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED); choice->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED);
sym2 = sym_check_sym_deps(choice); sym2 = sym_check_sym_deps(choice);
...@@ -1221,14 +1223,17 @@ static struct symbol *sym_check_choice_deps(struct symbol *choice) ...@@ -1221,14 +1223,17 @@ static struct symbol *sym_check_choice_deps(struct symbol *choice)
if (sym2) if (sym2)
goto out; goto out;
expr_list_for_each_sym(prop->expr, e, sym) { menu_for_each_sub_entry(menu, choice_menu) {
sym2 = sym_check_sym_deps(sym); if (!menu->sym)
continue;
sym2 = sym_check_sym_deps(menu->sym);
if (sym2) if (sym2)
break; break;
} }
out: out:
expr_list_for_each_sym(prop->expr, e, sym) menu_for_each_sub_entry(menu, choice_menu)
sym->flags &= ~SYMBOL_CHECK; if (menu->sym)
menu->sym->flags &= ~SYMBOL_CHECK;
if (sym2 && sym_is_choice_value(sym2) && if (sym2 && sym_is_choice_value(sym2) &&
prop_get_symbol(sym_get_choice_prop(sym2)) == choice) prop_get_symbol(sym_get_choice_prop(sym2)) == choice)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment