diff mbox series

[06/10] kconfig: use sym_get_choice_menu() in conf_write_defconfig()

Message ID 20240504183333.2031860-6-masahiroy@kernel.org (mailing list archive)
State New
Headers show
Series [01/10] kconfig: gconf: redraw pane correctly after loading a config file | expand

Commit Message

Masahiro Yamada May 4, 2024, 6:33 p.m. UTC
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 | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 5caec434e6f4..e68890bbc035 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -794,6 +794,8 @@  int conf_write_defconfig(const char *filename)
 	sym_clear_all_valid();
 
 	menu_for_each_entry(menu) {
+		struct menu *choice_menu;
+
 		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_menu = sym_get_choice_menu(sym);
+			if (choice_menu) {
 				struct symbol *ds;
 
-				cs = prop_get_symbol(sym_get_choice_prop(sym));
-				ds = sym_choice_default(cs);
+				ds = sym_choice_default(choice_menu->sym);
 				if (sym == ds) {
 					if ((sym->type == S_BOOLEAN) &&
 					    sym_get_tristate_value(sym) == yes)