Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Masahiro Yamada <masahiroy@kernel.org>
Subject: [PATCH 09/16] kconfig: change sym_choice_default() to take the choice menu
Date: Wed, 12 Jun 2024 02:55:18 +0900	[thread overview]
Message-ID: <20240611175536.3518179-10-masahiroy@kernel.org> (raw)
In-Reply-To: <20240611175536.3518179-1-masahiroy@kernel.org>

Change the argument of sym_choice_default() to ease further cleanups.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/kconfig/confdata.c | 2 +-
 scripts/kconfig/lkc.h      | 2 +-
 scripts/kconfig/symbol.c   | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 4359fbc9255b..76193ce5a792 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -779,7 +779,7 @@ int conf_write_defconfig(const char *filename)
 		if (choice) {
 			struct symbol *ds;
 
-			ds = sym_choice_default(choice->sym);
+			ds = sym_choice_default(choice);
 			if (sym == ds && sym_get_tristate_value(sym) == yes)
 				continue;
 		}
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index d820272a85fb..586a5e11f51e 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -109,7 +109,7 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help);
 
 /* symbol.c */
 void sym_clear_all_valid(void);
-struct symbol *sym_choice_default(struct symbol *sym);
+struct symbol *sym_choice_default(struct menu *choice);
 struct symbol *sym_calc_choice(struct menu *choice);
 struct property *sym_get_range_prop(struct symbol *sym);
 const char *sym_get_string_default(struct symbol *sym);
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index b2fdae15f367..32c80a29dcd4 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -255,14 +255,14 @@ static void sym_calc_visibility(struct symbol *sym)
  * Next locate the first visible choice value
  * Return NULL if none was found
  */
-struct symbol *sym_choice_default(struct symbol *sym)
+struct symbol *sym_choice_default(struct menu *choice)
 {
 	struct symbol *def_sym;
 	struct property *prop;
 	struct expr *e;
 
 	/* any of the defaults visible? */
-	for_all_defaults(sym, prop) {
+	for_all_defaults(choice->sym, prop) {
 		prop->visible.tri = expr_calc_value(prop->visible.expr);
 		if (prop->visible.tri == no)
 			continue;
@@ -272,7 +272,7 @@ struct symbol *sym_choice_default(struct symbol *sym)
 	}
 
 	/* just get the first visible value */
-	prop = sym_get_choice_prop(sym);
+	prop = sym_get_choice_prop(choice->sym);
 	expr_list_for_each_sym(prop->expr, e, def_sym)
 		if (def_sym->visible != no)
 			return def_sym;
@@ -309,7 +309,7 @@ struct symbol *sym_calc_choice(struct menu *choice)
 
 	/* If 'y' is not found in the user input, try the default */
 	if (!res) {
-		res = sym_choice_default(choice->sym);
+		res = sym_choice_default(choice);
 		if (res && sym_has_value(res) && res->def[S_DEF_USER].tri == no)
 			res = NULL;
 	}
-- 
2.43.0


  parent reply	other threads:[~2024-06-11 17:56 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11 17:55 [PATCH 00/16] kconfig: fix choice value calculation with misc cleanups Masahiro Yamada
2024-06-11 17:55 ` [PATCH 01/16] kconfig: remove unneeded code in expr_compare_type() Masahiro Yamada
2024-06-11 17:55 ` [PATCH 02/16] kconfig: add fallthrough comments to expr_compare_type() Masahiro Yamada
2024-06-11 17:55 ` [PATCH 03/16] kconfig: introduce choice_set_value() helper Masahiro Yamada
2024-06-11 17:55 ` [PATCH 04/16] kconfig: remember the current choice while parsing the choice block Masahiro Yamada
2024-06-11 17:55 ` [PATCH 05/16] kconfig: import list_move() and list_move_tail() Masahiro Yamada
2024-06-11 17:55 ` [PATCH 06/16] kconfig: refactor choice value calculation Masahiro Yamada
2024-06-11 21:18   ` kernel test robot
2024-06-12  5:33     ` Masahiro Yamada
2024-06-12  3:06   ` kernel test robot
2024-06-12  5:35   ` Masahiro Yamada
2024-06-11 17:55 ` [PATCH 07/16] kconfig: remove sym_get_choice_value() Masahiro Yamada
2024-06-11 17:55 ` [PATCH 08/16] kconfig: remove conf_unsaved in conf_read_simple() Masahiro Yamada
2024-06-11 17:55 ` Masahiro Yamada [this message]
2024-06-11 17:55 ` [PATCH 10/16] kconfig: use menu_list_for_each_sym() in sym_choice_default() Masahiro Yamada
2024-06-11 17:55 ` [PATCH 11/16] kconfig: remove expr_list_for_each_sym() macro Masahiro Yamada
2024-06-11 17:55 ` [PATCH 12/16] kconfig: use sym_get_choice_menu() in sym_check_print_recursive() Masahiro Yamada
2024-06-11 17:55 ` [PATCH 13/16] kconfig: use sym_get_choice_menu() in sym_check_choice_deps() Masahiro Yamada
2024-06-11 17:55 ` [PATCH 14/16] kconfig: use sym_get_choice_menu() in sym_check_deps() Masahiro Yamada
2024-06-11 17:55 ` [PATCH 15/16] kconfig: remove P_CHOICE property Masahiro Yamada
2024-06-11 17:55 ` [PATCH 16/16] kconfig: remove E_LIST expression type Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240611175536.3518179-10-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox