Skip to content

Commit bedf923

Browse files
committed
kconfig: use linked list in get_symbol_str() to iterate over menus
Currently, get_symbol_str() uses a tricky approach to traverse the associated menus. With relevant menus now linked to the symbol using a linked list, use list_for_each_entry() for iterating on the menus. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nicolas Schier <[email protected]>
1 parent e049221 commit bedf923

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Diff for: scripts/kconfig/menu.c

+9-8
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,7 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym,
771771
struct list_head *head)
772772
{
773773
struct property *prop;
774+
struct menu *menu;
774775

775776
if (sym && sym->name) {
776777
str_printf(r, "Symbol: %s [=%s]\n", sym->name,
@@ -787,17 +788,17 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym,
787788
}
788789

789790
/* Print the definitions with prompts before the ones without */
790-
for_all_properties(sym, prop, P_SYMBOL) {
791-
if (prop->menu->prompt) {
792-
get_def_str(r, prop->menu);
793-
get_prompt_str(r, prop->menu->prompt, head);
791+
list_for_each_entry(menu, &sym->menus, link) {
792+
if (menu->prompt) {
793+
get_def_str(r, menu);
794+
get_prompt_str(r, menu->prompt, head);
794795
}
795796
}
796797

797-
for_all_properties(sym, prop, P_SYMBOL) {
798-
if (!prop->menu->prompt) {
799-
get_def_str(r, prop->menu);
800-
get_dep_str(r, prop->menu->dep, " Depends on: ");
798+
list_for_each_entry(menu, &sym->menus, link) {
799+
if (!menu->prompt) {
800+
get_def_str(r, menu);
801+
get_dep_str(r, menu->dep, " Depends on: ");
801802
}
802803
}
803804

0 commit comments

Comments
 (0)