]> Git Repo - linux.git/commitdiff
kconfig: use linked list in get_symbol_str() to iterate over menus
authorMasahiro Yamada <[email protected]>
Sun, 3 Mar 2024 04:00:34 +0000 (13:00 +0900)
committerMasahiro Yamada <[email protected]>
Sat, 9 Mar 2024 06:04:22 +0000 (15:04 +0900)
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]>
scripts/kconfig/menu.c

index 571394ed71e01ad36cacac7ad0fd7480d3d330d6..840ce642ec439ee177e87a2caf9104601e712bbf 100644 (file)
@@ -771,6 +771,7 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym,
                    struct list_head *head)
 {
        struct property *prop;
+       struct menu *menu;
 
        if (sym && sym->name) {
                str_printf(r, "Symbol: %s [=%s]\n", sym->name,
@@ -787,17 +788,17 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym,
        }
 
        /* Print the definitions with prompts before the ones without */
-       for_all_properties(sym, prop, P_SYMBOL) {
-               if (prop->menu->prompt) {
-                       get_def_str(r, prop->menu);
-                       get_prompt_str(r, prop->menu->prompt, head);
+       list_for_each_entry(menu, &sym->menus, link) {
+               if (menu->prompt) {
+                       get_def_str(r, menu);
+                       get_prompt_str(r, menu->prompt, head);
                }
        }
 
-       for_all_properties(sym, prop, P_SYMBOL) {
-               if (!prop->menu->prompt) {
-                       get_def_str(r, prop->menu);
-                       get_dep_str(r, prop->menu->dep, "  Depends on: ");
+       list_for_each_entry(menu, &sym->menus, link) {
+               if (!menu->prompt) {
+                       get_def_str(r, menu);
+                       get_dep_str(r, menu->dep, "  Depends on: ");
                }
        }
 
This page took 0.057073 seconds and 4 git commands to generate.