kconfig: use sym_get_choice_menu() in conf_write_defconfig()
authorMasahiro Yamada <masahiroy@kernel.org>
Sat, 4 May 2024 18:33:29 +0000 (03:33 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Thu, 9 May 2024 19:34:53 +0000 (04:34 +0900)
Choices and their members are associated via the P_CHOICE property.

Currently, prop_get_symbol(sym_get_choice_prop()) is used to obtain
the choice of the given choice member.

Replace it with sym_get_choice_menu(), which retrieves the choice
without relying on P_CHOICE.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/kconfig/confdata.c

index 5caec434e6f4ace5740c0df00a4c2e81f1a79a9b..387503daf0f73cecadd8eb3ebe6c14f35a55a390 100644 (file)
@@ -794,6 +794,8 @@ int conf_write_defconfig(const char *filename)
        sym_clear_all_valid();
 
        menu_for_each_entry(menu) {
+               struct menu *choice;
+
                sym = menu->sym;
                if (sym && !sym_is_choice(sym)) {
                        sym_calc_value(sym);
@@ -811,12 +813,11 @@ int conf_write_defconfig(const char *filename)
                         * If symbol is a choice value and equals to the
                         * default for a choice - skip.
                         */
-                       if (sym_is_choice_value(sym)) {
-                               struct symbol *cs;
+                       choice = sym_get_choice_menu(sym);
+                       if (choice) {
                                struct symbol *ds;
 
-                               cs = prop_get_symbol(sym_get_choice_prop(sym));
-                               ds = sym_choice_default(cs);
+                               ds = sym_choice_default(choice->sym);
                                if (sym == ds) {
                                        if ((sym->type == S_BOOLEAN) &&
                                            sym_get_tristate_value(sym) == yes)