From patchwork Sat May 4 18:33:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13654091 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1E7D1DDF6; Sat, 4 May 2024 18:34:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847648; cv=none; b=FnEsCspkVlvE72edKfjMCZbQE4tYBZ3K+BVYWgcqh4jioHr4MFZvF4SUwq3V8Ms3rKMVBxG9xltxWjRkZipDU7f0zCb7KoGsf/gI1XoMPBEANZajqPMAbclqA01zJgPrzN97Je5fZjxU5j7IlpPlU6yvsKR+VYfnE5CV2hFD/pA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847648; c=relaxed/simple; bh=6HftrSu8b1ezVHLQUken8pjwxsgWWqlDrOx3oimesB8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=bKDDfIEKWbkbd51LKCXb5vko66vy+xjAcmjP0qUaeTV3qYEFLNjDdGahyyQkYrkbL7ww/ZxR7mXJDwNGCcXMRz4mzGaeU/nMlI6EpdbaR3ydkzn9upgokcfND8CLjm1ZGhMnV6Jqdhuf0RYDp7yrHCLez//sqNM5eCzKE2cWL8w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jbM8Sy3A; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jbM8Sy3A" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 867F5C4AF14; Sat, 4 May 2024 18:34:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714847648; bh=6HftrSu8b1ezVHLQUken8pjwxsgWWqlDrOx3oimesB8=; h=From:To:Cc:Subject:Date:From; b=jbM8Sy3AC1Tk8X7gAqQjhvY7QHGeD68MEbLd5IErSc8ps7z+CCJc5u62tNBYIuKQP zT0brJLuDRMEHsaH2kn5d/t/UMwUQCFt4wuDvxfXwDSF+hJi4yvqvYyCsO0THuT4Vk 4PSAjsvnsds1WwfvHIALpAhwcQ55AP2dGWLaBAGmLjT+UtgX1x9MiGMvGlfFpIsuiX E1zbrqwxQ55Li3+kxTOs2qgw27ZJU5+lAU7XwGKqt4dsI2s+XlWDBiK9jG6it/anlV Yb0swhaegfUmKHaxIxWbiQSh0PpRBhAvRrOX6By88nlFD3lRksbp8LHGIUdw2hPMGF xyZQSVKcTjPcA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 01/10] kconfig: gconf: redraw pane correctly after loading a config file Date: Sun, 5 May 2024 03:33:24 +0900 Message-Id: <20240504183333.2031860-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Every time a config file is loaded (either by clicking the "Load" button or selecting "File" -> "Load" from the menu), a new tree structure is appended to the widget. The current tree needs to be cleared by calling gtk_tree_store_clear(). Signed-off-by: Masahiro Yamada --- scripts/kconfig/gconf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index 67a27c497c40..12b55f2e369b 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c @@ -487,7 +487,7 @@ load_filename(GtkFileSelection * file_selector, gpointer user_data) if (conf_read(fn)) text_insert_msg("Error", "Unable to load configuration !"); else - display_tree(&rootmenu); + display_tree_part(); } void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data) @@ -1399,6 +1399,8 @@ static void display_tree_part(void) display_tree(current); else if (view_mode == SPLIT_VIEW) display_tree(browsed); + else if (view_mode == FULL_VIEW) + display_tree(&rootmenu); gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w)); } From patchwork Sat May 4 18:33:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13654092 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AE0B83CB8; Sat, 4 May 2024 18:34:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847650; cv=none; b=rqZn+Q9bHxMq9cInVSo1QLuGevIympYGNcyxs5K53xhR/X5D1pBhA4y0fpe5A0UAiA4mN+hoSKQU1gZCg2eqToZRPSN5aYndA6uE9JKHjbRl/pKVeeqI9J9RetqdIedxyPqveyJAYqKTZwxBKLLkXhtwWwILsD+ythHK+6TRZCc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847650; c=relaxed/simple; bh=/4u7V5qiFPZq7A2fjkQbdEptgQwpMRiVnwYeqYcRlLY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YJ7PtCsnud11jITR9k0i4sxJocO9NhE3cWEIZhdjKD9CwyWmdKymwDU/F2hknv/iSsxcI09UjhBWkq3gRfz13tp0vASyw96rad2zWvN+5t9qPwddWa9yAg1pWExvhofhiZ3boGUL4WKLwf/fG8+77zpf503jXtUW/xDxd1Oyq2o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kSdielt+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kSdielt+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC42CC4AF19; Sat, 4 May 2024 18:34:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714847649; bh=/4u7V5qiFPZq7A2fjkQbdEptgQwpMRiVnwYeqYcRlLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kSdielt+kvWy/o93TH5nBGaxPJKuGciN07K7smnYGcvCnlsmzUA+/h19E9CiBmT9T m/HmSXPrt5tXr6kf5cRiavcFFWwAyNcnJll0c3bDJA4f4QMn9t+BCtyuqnaQGJk9KX H4XijaDtnCAooYFjsA6Wz8cBXzpwo3WZ+NrZ7sXQhhvxdznB5kK95aWPuUA50b0wpO KNDWC3uuBoRwiyfWO3Zkaj5xtrFN9WchWWSckoTuQesG07K7lc1YMgrfj2gQd4Rphd +7qI6hfMj+dUU7b8pjhofJ1J37aod5Q2w/zyecYDfPgU5QDp9Wqp7p9Njxpx8sncmJ 4xr91/yQ11EdA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 02/10] kconfig: gconf: remove debug code Date: Sun, 5 May 2024 03:33:25 +0900 Message-Id: <20240504183333.2031860-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240504183333.2031860-1-masahiroy@kernel.org> References: <20240504183333.2031860-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This is not so useful. If necessary, you can insert printf() or whatever during debugging. Signed-off-by: Masahiro Yamada --- scripts/kconfig/gconf.c | 49 +---------------------------------------- 1 file changed, 1 insertion(+), 48 deletions(-) diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index 12b55f2e369b..89614f1e49e6 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c @@ -18,8 +18,6 @@ #include #include -//#define DEBUG - enum { SINGLE_VIEW, SPLIT_VIEW, FULL_VIEW }; @@ -71,33 +69,6 @@ static void set_node(GtkTreeIter * node, struct menu *menu, gchar ** row); static gchar **fill_row(struct menu *menu); static void conf_changed(void); -/* Helping/Debugging Functions */ -#ifdef DEBUG -static const char *dbg_sym_flags(int val) -{ - static char buf[256]; - - bzero(buf, 256); - - if (val & SYMBOL_CONST) - strcat(buf, "const/"); - if (val & SYMBOL_CHECK) - strcat(buf, "check/"); - if (val & SYMBOL_CHOICEVAL) - strcat(buf, "choiceval/"); - if (val & SYMBOL_VALID) - strcat(buf, "valid/"); - if (val & SYMBOL_WRITE) - strcat(buf, "write/"); - if (val & SYMBOL_CHANGED) - strcat(buf, "changed/"); - - buf[strlen(buf) - 1] = '\0'; - - return buf; -} -#endif - static void replace_button_icon(GladeXML *xml, GdkDrawable *window, GtkStyle *style, gchar *btn_name, gchar **xpm) { @@ -1262,12 +1233,6 @@ static void update_tree(struct menu *src, GtkTreeIter * dst) else menu2 = NULL; // force adding of a first child -#ifdef DEBUG - printf("%*c%s | %s\n", indent, ' ', - menu1 ? menu_get_prompt(menu1) : "nil", - menu2 ? menu_get_prompt(menu2) : "nil"); -#endif - if ((opt_mode == OPT_NORMAL && !menu_is_visible(child1)) || (opt_mode == OPT_PROMPT && !menu_has_prompt(child1)) || (opt_mode == OPT_ALL && !menu_get_prompt(child1))) { @@ -1354,19 +1319,7 @@ static void display_tree(struct menu *menu) (opt_mode == OPT_PROMPT && menu_has_prompt(child)) || (opt_mode == OPT_ALL && menu_get_prompt(child))) place_node(child, fill_row(child)); -#ifdef DEBUG - printf("%*c%s: ", indent, ' ', menu_get_prompt(child)); - printf("%s", child->flags & MENU_ROOT ? "rootmenu | " : ""); - printf("%s", prop_get_type_name(ptype)); - printf(" | "); - if (sym) { - printf("%s", sym_type_name(sym->type)); - printf(" | "); - printf("%s", dbg_sym_flags(sym->flags)); - printf("\n"); - } else - printf("\n"); -#endif + if ((view_mode != FULL_VIEW) && (ptype == P_MENU) && (tree == tree2)) continue; From patchwork Sat May 4 18:33:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13654093 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE80984D05; Sat, 4 May 2024 18:34:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847651; cv=none; b=JhIBQimZrMotyBGsIARYpIbzmZFStHXKkfzXl3OZOQ6E/r6RYYJipXy+tIYlaCJeODhetVenqp70LuU/gg2S9UId9qXsXrnAhpFdFXCtjmDumwclxaOYfZCM/T4qUFrt1UNBH4Ws6Taf6Crxf8MPDvjTCZtZOijDnXLoX7hivzI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847651; c=relaxed/simple; bh=GWbCaBdcnf01W2IHy2aEsnhjZHDC3HN1ToNEvWOVz2c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F2wHVl1FWPL6gyU4DiIDD9bOzHpo+TshCKljY8FYgDnbyDDTyX3WV2EJQdwgzZS6kaX2bZKlK+PlnFwy/N9PVm+XgAXoSYSXUJKn22q8b3BWbg/Jkxo1GoCDQgMfnN09vFNmJaXQbsqtEJPVLjQ3UEm5Y4ZOYYhG7tDC4x8oREM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m0aqiMt5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m0aqiMt5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61C76C4AF1A; Sat, 4 May 2024 18:34:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714847651; bh=GWbCaBdcnf01W2IHy2aEsnhjZHDC3HN1ToNEvWOVz2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m0aqiMt5vfstVZCTb5/OvPNzg7S0yoxYokcKNSqbEvJrMuM34iHkan3rtNG4p0XVj 16JNdAPT5Q+3aBmMFNfTavwaVOVUpr83ygOtGohBuThPw0nWmU4ia0oxAQ7Cg4ifaP yANBsXk3NmNtjkaUUQojF+kO36Ir85RcdHoyzy+7JpGVweBbh7av7loAUWDvezEMhH M+gheW0wIo/YL677ZT1EDR++iarjgyPzLsrx/T07OmLXnhP+k63SUFq7v3wajpJxAe 4FGPDAa99CVACKIH6De9URzabWgFaQD/grxE5VrMbb9Fp5kjnMiOtJYxmxn+zdH/uR 7CJ2Cbw1C4TXA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 03/10] kconfig: gconf: use MENU_CHANGED instead of SYMBOL_CHANGED Date: Sun, 5 May 2024 03:33:26 +0900 Message-Id: <20240504183333.2031860-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240504183333.2031860-1-masahiroy@kernel.org> References: <20240504183333.2031860-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 SYMBOL_CHANGED and MENU_CHANGED are used to update GUI frontends when the symbol value is changed. These are used inconsistently: SYMBOL_CHANGED in gconf.c and MENU_CHANGE in qconf.cc. MENU_CHANGED works more properly when a symbol has multiple prompts (although such code is not ideal). [test code] config FOO bool "foo prompt 1" config FOO bool "foo prompt 2" In gconfig, if one of the two checkboxes is clicked, only the first one is toggled. In xconfig, the two checkboxes work in sync. Replace SYMBOL_CHANGED in gconf.c with MENU_CHANGED to align with the xconfig behavior. Signed-off-by: Masahiro Yamada --- scripts/kconfig/gconf.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index 89614f1e49e6..10d602faa51e 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c @@ -1047,7 +1047,7 @@ static gchar **fill_row(struct menu *menu) row[COL_NAME] = g_strdup(sym->name); sym_calc_value(sym); - sym->flags &= ~SYMBOL_CHANGED; + menu->flags &= ~MENU_CHANGED; if (sym_is_choice(sym)) { // parse childs for getting final value struct menu *child; @@ -1273,7 +1273,7 @@ static void update_tree(struct menu *src, GtkTreeIter * dst) else goto reparse; // next child } - } else if (sym && (sym->flags & SYMBOL_CHANGED)) { + } else if (sym && (child1->flags & MENU_CHANGED)) { set_node(child2, menu1, fill_row(menu1)); } @@ -1289,7 +1289,6 @@ static void update_tree(struct menu *src, GtkTreeIter * dst) /* Display the whole tree (single/split/full view) */ static void display_tree(struct menu *menu) { - struct symbol *sym; struct property *prop; struct menu *child; enum prop_type ptype; @@ -1301,11 +1300,9 @@ static void display_tree(struct menu *menu) for (child = menu->list; child; child = child->next) { prop = child->prompt; - sym = child->sym; ptype = prop ? prop->type : P_UNKNOWN; - if (sym) - sym->flags &= ~SYMBOL_CHANGED; + menu->flags &= ~MENU_CHANGED; if ((view_mode == SPLIT_VIEW) && !(child->flags & MENU_ROOT) && (tree == tree1)) From patchwork Sat May 4 18:33:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13654094 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01E1384DEC; Sat, 4 May 2024 18:34:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847653; cv=none; b=WzgpLagiwKdNGbqrc8c/bZRhLPa6KIDw27Qfne31MTAsdx/2aXKa4LboAI1rQHGlPEF4d5DOtyq+7qJ3UYSj5AVdoAqw2xX1zFsybNj8DxeuxoQswEOX1gjCXefqv8HL14qeYcRJgwAq/AspNBnNb6uIG5oZ0sUrf5SYwCCg4SQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847653; c=relaxed/simple; bh=Nq8nXPC8Rz0nAfIq0jS+qR4DEI3gHUkggdiRm+SnbmE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SUk/kVI4FF+i6tE46OFe4mniph11/Yij8VnuNAm62RBWGgY2B8gtISuCUe2XwoXHGxh3fhVgfqnkBnwSOdE277epRU3w/iNf7CQ3K4dRRaTePp9ucfSPgbsEKSJfwgS1SZ6MLQs4lcntNvuWED/hMsdT8Ew/UQqNooS4ZMddjo4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Am59WeL8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Am59WeL8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBC98C4AF1B; Sat, 4 May 2024 18:34:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714847652; bh=Nq8nXPC8Rz0nAfIq0jS+qR4DEI3gHUkggdiRm+SnbmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Am59WeL8b0uHj1MyH9pYdvZ8bAKUMqtcxwpzimWapUZd5k7MhUrW+kcjc7DGfT00N mw7v1WAhF47/fvpzWb/nb4zfQvIyNlA3QqTS0S6Rqew5y2R564sIbI8QPrqZnFmjgd UedkwJDKdirR6zOBIOtDQwrYGc3R1ayu7hi3N23LN1IJQO8KnYWJixz9Vw77uk234k txRoJA7O7nBpSdJLOPpxDUXYYkmwIp5l5X2n2KrFnOu1iQ3L86SldsArpaXO/t8Dca SbXrCVisuOy1rE6ADYmz2ECuEXKAY9VKu9tW31XB1KI4Td4vGThvl4xT2OJmqwLhq9 3kb4uk+83cUFg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 04/10] kconfig: used linked list in sym_set_changed() Date: Sun, 5 May 2024 03:33:27 +0900 Message-Id: <20240504183333.2031860-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240504183333.2031860-1-masahiroy@kernel.org> References: <20240504183333.2031860-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Following the approach employed in commit bedf92362317 ("kconfig: use linked list in get_symbol_str() to iterate over menus"), simplify the iteration on the menus of the specified symbol. Signed-off-by: Masahiro Yamada --- scripts/kconfig/symbol.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index b909c64f3bac..8512c29c84bb 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -152,13 +152,11 @@ static void sym_validate_range(struct symbol *sym) static void sym_set_changed(struct symbol *sym) { - struct property *prop; + struct menu *menu; sym->flags |= SYMBOL_CHANGED; - for (prop = sym->prop; prop; prop = prop->next) { - if (prop->menu) - prop->menu->flags |= MENU_CHANGED; - } + list_for_each_entry(menu, &sym->menus, link) + menu->flags |= MENU_CHANGED; } static void sym_set_all_changed(void) From patchwork Sat May 4 18:33:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13654095 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75C8884E17; Sat, 4 May 2024 18:34:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847654; cv=none; b=Lb78mDLYCPZJeetk5l5CG99oAyhhbo2BDsyojhF8yvwiBL6yHXgdXIDjkf8uThDyS2YDW+YEDasOCOHc9N442gx2wqlLhygN3Fc3mDlURG2xLuigeUonwJ5oClWkRpfKD8P4ntdmdx4kh0351cu0TTjYHPKbUphU7Dmdmt0mRaw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847654; c=relaxed/simple; bh=tnu4Sm6RDAbK7lE25RylH7+gcqO8XLwyS5Zea6M1TcA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OPVN6ThonOjDELQF5FYPtdcUL0QWUfa4RS7rdlm0eV1MyVjSgf2IBDd/N/7IwG3jmd2Z1x0OYdenMwhLYJRK+RoYLnEfJqQDctEBcDWD0namMdqBUPMVPA3IJe4M2Ubnl6sKTEXcz5tPTFNcnEtitio78biPIcrx0xymRtb6n9E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WQrd8ykV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WQrd8ykV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 299BAC4AF14; Sat, 4 May 2024 18:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714847654; bh=tnu4Sm6RDAbK7lE25RylH7+gcqO8XLwyS5Zea6M1TcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WQrd8ykVwxeFW6cGp7B8J2wdYRh0inOEzKZJr5cbRX1v1KQtlDvKw8oHunV220vMY KhO0tVI6fcFceW9jWSE0r20m4SbpSG+0VIW/8RsOwa98qhs43N17zqD1UuOhv8i0kN v9D21R9IU1aza0C0pIB/DZ574om1MmdaNKcqaDueIovFEU7G5f9EgT7aX0GfbDU8c2 g3ixjoNm28ikAaIoxryv41T8YiqdhItbqy5p0gaEqNzKlcviX2RjHm1Z/2ksu4QCCT 6SfWzLrtu5Fo6t7l+XxnzbVUYcz68s/unYTVARk6Ra7O8hyJH0vOdBka2ktYRVjqPq DqYXl6GwUrRXQ== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 05/10] kconfig: add sym_get_choice_menu() helper Date: Sun, 5 May 2024 03:33:28 +0900 Message-Id: <20240504183333.2031860-5-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240504183333.2031860-1-masahiroy@kernel.org> References: <20240504183333.2031860-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Choices and their members are associated via the P_CHOICE property. Currently, prop_get_symbol(sym_get_choice_prop(sym)) is used to obtain the choice of the given choice member. We can do this without relying on P_CHOICE by checking the parent in the menu structure. Introduce a new helper to retrieve the choice if the given symbol is a choice member. This is intended to replace prop_get_symbol(sym_get_choice_prop(sym)) and deprecate P_CHOICE eventually. Signed-off-by: Masahiro Yamada --- scripts/kconfig/lkc_proto.h | 1 + scripts/kconfig/symbol.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index 2807fa584c2b..d76aaf4ea117 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h @@ -34,6 +34,7 @@ bool sym_string_within_range(struct symbol *sym, const char *str); bool sym_set_string_value(struct symbol *sym, const char *newval); bool sym_is_changeable(struct symbol *sym); struct property * sym_get_choice_prop(struct symbol *sym); +struct menu *sym_get_choice_menu(struct symbol *sym); const char * sym_get_string_value(struct symbol *sym); const char * prop_get_type_name(enum prop_type type); diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 8512c29c84bb..23829f44b8f8 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -78,6 +78,41 @@ struct property *sym_get_choice_prop(struct symbol *sym) return NULL; } +/** + * sym_get_choice_menu - get the parent choice menu if present + * + * @sym: a symbol pointer + * + * Return: a choice menu if this function is called against a choice member. + */ +struct menu *sym_get_choice_menu(struct symbol *sym) +{ + struct menu *menu = NULL; + struct menu *m; + + /* + * Choice members must have a prompt. Find a menu entry with a prompt, + * and assume it resides inside a choice block. + */ + list_for_each_entry(m, &sym->menus, link) + if (m->prompt) { + menu = m; + break; + } + + if (!menu) + return NULL; + + do { + menu = menu->parent; + } while (menu && !menu->sym); + + if (menu && menu->sym && sym_is_choice(menu->sym)) + return menu; + + return NULL; +} + static struct property *sym_get_default_prop(struct symbol *sym) { struct property *prop; From patchwork Sat May 4 18:33:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13654096 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B75DD84FBE; Sat, 4 May 2024 18:34:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847655; cv=none; b=E4E48fPxYc9w5FNhWfzCZ+DPwy8IM5pSSF2TlA5pWSk769TvJoTLSMajn677B83tYl2iQ3HllTY2vcnv0y7gWGUTSA64NeRWhLPfsakZbeoYzH15l8X9hJNrU7R5i+FEkr2JdfVle58u9CPiWXC7NeizDdxbwTmsJUQ39iRVLPk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847655; c=relaxed/simple; bh=1loWNNMJbgdISYcGMWi4T/QUodY2ppau9yw5McZ9ioc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oE6YBPfI8r8pfO2cRfgUqq+jyPG3fTI36l3+L/jiu5hf7rJAaJ5ptBPXaScgTNCdQul1JPNS7CNj9mqKXszKbDG8lDduek91WDHYTnof90D0+rgUiBOfwFp6JdIAkjLPX/WfWd6JwfUnryRNYJWmPDf0ttk+/4A+x+F3RrEst98= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qFv7KZVg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qFv7KZVg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B078C4AF66; Sat, 4 May 2024 18:34:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714847655; bh=1loWNNMJbgdISYcGMWi4T/QUodY2ppau9yw5McZ9ioc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qFv7KZVgWm34At1/vHc5cyybcWeTpVpjPVlUrbaQ1w98TMdfSK1ZVIA6kgvq5w5Lc 69oiKciVnkyr5dyQwS97WwzY8Th/adKPCRkFOauvSiVvRw1Ex+Adq5LSxPxmll0/UI Y/KqSKAmKQc5W3H5WjFKuPYOYoW/4zaZB1EWD4ugm8krXDKLWm3bo7WDSQOS6ckl+K ePPK3qly2RqJ6qCUpsL63kqQtO5CIVp548HHWfshp7fJPKPhNvLhyPN/xpmjQhEdf3 ITz15Ja7lQC6zuDkn5mUB/y7b76cygF4jbC+9VbQ7M4frHc87u6oWssO8wjtOEwOYL 83Rgcsi3v3MzA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 06/10] kconfig: use sym_get_choice_menu() in conf_write_defconfig() Date: Sun, 5 May 2024 03:33:29 +0900 Message-Id: <20240504183333.2031860-6-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240504183333.2031860-1-masahiroy@kernel.org> References: <20240504183333.2031860-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- scripts/kconfig/confdata.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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) From patchwork Sat May 4 18:33:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13654097 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A98985274; Sat, 4 May 2024 18:34:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847657; cv=none; b=hsBK5vZCE9G8z24RmV+VLk1fc9gPiLoEyihox+kA3ulC5EkWkMqI4Q74RCUpA4Ft34wUpjiom0eiWdLkLERdgte4a8Nic271tcefpoUocutrmPpd3VydK6kBI0O0lokzAT6A8vKCUXi18LxEWsN2kyq37c3deNK/lWjMkm0rgfw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847657; c=relaxed/simple; bh=eo6+W6TnHuiRwkZe3ODc0AWjobnC6OZhSBkg+ENoBXg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pdaOFpAPCOvHFy+zr5uIIc2fdsjE9XnJ5v2BjLgsm/Ip+nS6PS/Yuu2wapJkqtOiz3Gz6vn2OD9uHNDVpG8mj2NEOCPvK8ZFQbX2m30QvDxpxBtPTyEJJwTFK1/8CvXM+Y3GOg7L2YmkgeIls/ZpOJN3dGHhEBc5MEhm8dm5idA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=U845aXRS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="U845aXRS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9623C4AF4D; Sat, 4 May 2024 18:34:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714847656; bh=eo6+W6TnHuiRwkZe3ODc0AWjobnC6OZhSBkg+ENoBXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U845aXRS+VZXmdPDmoV+oKrIcCqc0nwa1AOyC/4xFx74PI6wQy5Bed9XZ+js/M9T4 xdcE4PFLJioiOSnnCdV8Yg2ylVOY71d2NwjYsIJCBDc/aIXoGFIjsNPdbVKpeDGYtf Sf5wuXfoOn8n8C0SZBEP6moovDuet03fvbEdpYhMr44tRURPICnSYjCapMI/XV27KT OE7jIC1eHbt2+CQvvO617+wZvMR2oTnmGtzsGJD0Mh771ihuqmAqrF7A/ESdtpS6zs k5Fc5BSKRapdoun8EgWVnIQWRMWL4jrf+2fhaJjGAxaCBX8ktG4bKXO/Hgw7vu33sX O1v/4VmzcWUpw== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 07/10] kconfig: use menu_list_for_each_sym() in sym_check_choice_deps() Date: Sun, 5 May 2024 03:33:30 +0900 Message-Id: <20240504183333.2031860-7-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240504183333.2031860-1-masahiroy@kernel.org> References: <20240504183333.2031860-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Choices and their members are associated via the P_CHOICE property. Currently, sym_get_choice_prop() and expr_list_for_each_sym() are used to iterate on choice members. Replace them with menu_for_each_sub_entry(), which achieves the same without relying on P_CHOICE. Signed-off-by: Masahiro Yamada --- scripts/kconfig/symbol.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 23829f44b8f8..75e7506fcb5c 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -1204,16 +1204,18 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym) static struct symbol *sym_check_choice_deps(struct symbol *choice) { - struct symbol *sym, *sym2; - struct property *prop; - struct expr *e; + struct menu *menu, *child; + struct symbol *sym2; struct dep_stack stack; dep_stack_insert(&stack, choice); - prop = sym_get_choice_prop(choice); - expr_list_for_each_sym(prop->expr, e, sym) - sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED); + menu = list_first_entry(&choice->menus, struct menu, link); + + menu_for_each_sub_entry(child, menu) { + if (child->sym) + child->sym->flags |= SYMBOL_CHECK | SYMBOL_CHECKED; + } choice->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED); sym2 = sym_check_sym_deps(choice); @@ -1221,14 +1223,17 @@ static struct symbol *sym_check_choice_deps(struct symbol *choice) if (sym2) goto out; - expr_list_for_each_sym(prop->expr, e, sym) { - sym2 = sym_check_sym_deps(sym); + menu_for_each_sub_entry(child, menu) { + if (!child->sym) + continue; + sym2 = sym_check_sym_deps(child->sym); if (sym2) break; } out: - expr_list_for_each_sym(prop->expr, e, sym) - sym->flags &= ~SYMBOL_CHECK; + menu_for_each_sub_entry(child, menu) + if (child->sym) + child->sym->flags &= ~SYMBOL_CHECK; if (sym2 && sym_is_choice_value(sym2) && prop_get_symbol(sym_get_choice_prop(sym2)) == choice) From patchwork Sat May 4 18:33:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13654098 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5EF685650; Sat, 4 May 2024 18:34:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847658; cv=none; b=lG9jaByQ92ofqpwckgEmmptPhT5RuBHHN9O+Jvj0MLSH2zu1I9DgozJmgvmX8pPeYXPBTihf3U2PGUrx6A6/rCa4HmEUXKmP0UNw5MLuPGRuam7+cEQWvM6UQGIsRn8DJLcfzcqkkcwNnwMQiXguzzV9AF5EWK8I9uRYd/GDQWU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847658; c=relaxed/simple; bh=n3kfPRVCQ5t0c9SyMZT7tSS34HDAWc2ENT6kh3eZwfY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Rp9fBdp/PYZnj7mdFjOMjHGWPvk5jc/dWbVe9psYxfWLyyYArvnBvHERsD4DdqbpAMW+oaDn2f97JBvXr7iygj7MiuiZ2Tp/OkiYOm6TUOyTFnUDAUEcARrKH+Lo6C4hzTUqg+PplMkIzujI+LRHrYeZkmMEFvqi9dFzBM0Pj4Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YB7W4a/r; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YB7W4a/r" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58C21C4AF19; Sat, 4 May 2024 18:34:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714847658; bh=n3kfPRVCQ5t0c9SyMZT7tSS34HDAWc2ENT6kh3eZwfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YB7W4a/r94YbuqIOmnzBSU2yP7Q4ojM/kpmfCjsl0HLqlgB++Q10eefoGmjqnm0fa kVt67HRAQz3OoCGB+3i0QfKFtlXc+LQSAMaYOaZIKrSsaHT/rEAabBm1VcKFccCahW tBEM4Kf3+EoDM67LGHF16Vfwn/SiJYBhBh4c2wwapkyxFWJoQj8V+UUx1cG9T1H7Uq szJzjQf6/yPJzdXE146n/3PYjassqfrx6f4xIKT8W7+6yrpFccNeKC/Pbgk04tm+9R +3zaWheqKamBeSjqzjv2PgaXoSKy+DUIWsS+0jtPzXEFA3LP29wfKQoqm6BCt42jU7 Y7PA4vd3mTc3g== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 08/10] kconfig: turn conf_choice() into void function Date: Sun, 5 May 2024 03:33:31 +0900 Message-Id: <20240504183333.2031860-8-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240504183333.2031860-1-masahiroy@kernel.org> References: <20240504183333.2031860-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The return value of conf_choice() is not used. Signed-off-by: Masahiro Yamada --- scripts/kconfig/conf.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 0156ca13f949..8ad2c52d9b1f 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -446,7 +446,7 @@ static int conf_sym(struct menu *menu) } } -static int conf_choice(struct menu *menu) +static void conf_choice(struct menu *menu) { struct symbol *sym, *def_sym; struct menu *child; @@ -459,19 +459,18 @@ static int conf_choice(struct menu *menu) sym_calc_value(sym); switch (sym_get_tristate_value(sym)) { case no: - return 1; case mod: - return 0; + return; case yes: break; } } else { switch (sym_get_tristate_value(sym)) { case no: - return 1; + return; case mod: printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); - return 0; + return; case yes: break; } @@ -551,7 +550,7 @@ static int conf_choice(struct menu *menu) continue; } sym_set_tristate_value(child->sym, yes); - return 1; + return; } } From patchwork Sat May 4 18:33:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13654099 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E3F285953; Sat, 4 May 2024 18:34:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847660; cv=none; b=OumMr0lWQcjjlzvT2cPQa+Lph5K93xsfYw+bhz8M+uU3/jrNp4NsAsQ6M40EumGxlr2rmcjOkcbxD4D5Uk8yjv03NJFiXXh3O1sweBjKYiMtnTR1lb58zNpUUYzaW2Ytl4qEAxocjKQrLMncNEq2NsQW3SSITZjdzRC5Py7pDkI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847660; c=relaxed/simple; bh=IjS/X0Zg7nzLrbnNApIqBryuz3RpzFI+6nuPMvnXyQY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=b9wXXVvzcVn8YbL+V8uXjE3LcVVWlPAMOUEnXAhZn49y6kQnDHt+MWtCc0YXL6o1Zp1c26IEzgj76/eJX33ZBBp83QNWoSkh/0bItmz9+SlwIjVgZUMf+KWj85gn7/EgjUyws9/ShVDXhxNKcDR2iDDHNbyRCaWmXx7uB/1pq0Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pyqA3Bm6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pyqA3Bm6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2C0DC4AF1B; Sat, 4 May 2024 18:34:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714847659; bh=IjS/X0Zg7nzLrbnNApIqBryuz3RpzFI+6nuPMvnXyQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pyqA3Bm6fsbLqFuCLaJ1FTzdxPwvjd9T3kZymn37zTC9zvyF8qjT0HAdKveohvoor nYKvTEcTrUmbEbDPP5IuGKnGbYNANtRD+eRY5HBFbhgM5FkJ0eT6UT62JPFWzjgf1+ FRJ9Ew6tpXAe/ed/b7Yfr8judF+Io/YYqUAbqSDgmfCl2Tss9Z+x7w5avYk74klux7 i4/XlrvzXPHmKFsnUryrC2P9jK/iv79VPD8gWBZ01+SRZ7u1TuhuwFuvnrK79VZAst f1BNoh57M2GLu8q0nwrYBP6GpjKwMlaCtcDJKcCw5jyKX2Z7xP7Ym58X4/+69n8w2Z vhOCy5u4YvY0A== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 09/10] kconfig: turn missing prompt for choice members into error Date: Sun, 5 May 2024 03:33:32 +0900 Message-Id: <20240504183333.2031860-9-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240504183333.2031860-1-masahiroy@kernel.org> References: <20240504183333.2031860-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Choice members must have a prompt; hence make it an error. While I was here, I moved the check to the parser to slim down _menu_finalize(). Signed-off-by: Masahiro Yamada --- scripts/kconfig/menu.c | 2 -- scripts/kconfig/parser.y | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index e01b9ee87c05..a9b1e451dfe7 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -507,8 +507,6 @@ static void _menu_finalize(struct menu *parent, bool inside_choice) menu->sym && !sym_is_choice_value(menu->sym)) { current_entry = menu; menu->sym->flags |= SYMBOL_CHOICEVAL; - if (!menu->prompt) - menu_warn(menu, "choice value must have a prompt"); for (prop = menu->sym->prop; prop; prop = prop->next) { if (prop->type == P_DEFAULT) prop_warn(prop, "defaults for choice " diff --git a/scripts/kconfig/parser.y b/scripts/kconfig/parser.y index 613fa8c9c2d0..ed86869e5ed0 100644 --- a/scripts/kconfig/parser.y +++ b/scripts/kconfig/parser.y @@ -30,6 +30,8 @@ static bool zconf_endtoken(const char *tokenname, struct menu *current_menu, *current_entry; +static bool inside_choice = false; + %} %union @@ -145,6 +147,14 @@ config_entry_start: T_CONFIG nonconst_symbol T_EOL config_stmt: config_entry_start config_option_list { + if (inside_choice) { + if (!current_entry->prompt) { + fprintf(stderr, "%s:%d: error: choice member must have a prompt\n", + current_entry->filename, current_entry->lineno); + yynerrs++; + } + } + printd(DEBUG_PARSE, "%s:%d:endconfig\n", cur_filename, cur_lineno); }; @@ -237,10 +247,14 @@ choice_entry: choice choice_option_list } $$ = menu_add_menu(); + + inside_choice = true; }; choice_end: end { + inside_choice = false; + if (zconf_endtoken($1, "choice")) { menu_end_menu(); printd(DEBUG_PARSE, "%s:%d:endchoice\n", cur_filename, cur_lineno); From patchwork Sat May 4 18:33:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13654100 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7916486246; Sat, 4 May 2024 18:34:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847661; cv=none; b=pO43+pF4gA7t9n1lux0BfR9XeyDZqh2PZ4dC/8lFoCBW7pGbvXGKljkZCnGUMmbw7v3cNsrMAYwkZcM/hAZ5H2Nw9SQZPH+MdcDlecdg54sUYlOejKIDUP2egiKPAqQAZcPFqp0J/6u8pnaizviL6PLTtaMwEMb9OoK+TDXWxWo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714847661; c=relaxed/simple; bh=XMH+AE/Klmn9DMqBahtTcW2r5APi9nvotzI6xvIKwkM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pUIeEsZ4pxTfwUXBmTfBL38H9qOkWN6ZIE2HX8D+bG2Kjl4tOe7qm4VoE+RDM65OIxUBy0emoe7zxJRyAuWiN6b85z1nMMdm8BPMEtO14F8ur+9HmgoBEtJJ9wDYd6McloacOdOA2v510nuNX4uCqsaap54030gzdE8Dz1ECiWk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HV4a5+bE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HV4a5+bE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F69BC4AF18; Sat, 4 May 2024 18:34:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714847661; bh=XMH+AE/Klmn9DMqBahtTcW2r5APi9nvotzI6xvIKwkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HV4a5+bEoFroBVyEmLVu/jIdqDyZ08rYKs/9wlQjSuXCXYns7ZX/t5robna8UCPqC iq8gKnoIYXesAZ2XXIGIBjUyc9pmKnAT/zal/J+DhS/xZBZG48jDBiqVWSyiWoc7NU hRNmrY8BnaBCCQ7oZU49K6HwwMO34SrYE6EGfVQRnBl3JeigaBOg030MCutCSWcaHC u9TsaduYy5LOJcY83Mau5bQhkFROcnmnuxzZMNrC3JZKzD9qxjQhCvv9CU+lGodmJm RZJfb6mosgx6myFQ8wHk5YZ6fhy9e+2pDYgyxX4FF1BIvEuvV1b0UgirkLPqlJSWG9 b0POmvtOII0Tw== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 10/10] kconfig: turn defaults and additional prompt for choice members into error Date: Sun, 5 May 2024 03:33:33 +0900 Message-Id: <20240504183333.2031860-10-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240504183333.2031860-1-masahiroy@kernel.org> References: <20240504183333.2031860-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 menu_finalize() warns default properties for choice members and prompts outside the choice block. These should be hard errors. While I was here, I moved the checks to slim down menu_finalize(). Signed-off-by: Masahiro Yamada --- scripts/kconfig/menu.c | 10 ---------- scripts/kconfig/parser.y | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index a9b1e451dfe7..bee96c9964fd 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -507,16 +507,6 @@ static void _menu_finalize(struct menu *parent, bool inside_choice) menu->sym && !sym_is_choice_value(menu->sym)) { current_entry = menu; menu->sym->flags |= SYMBOL_CHOICEVAL; - for (prop = menu->sym->prop; prop; prop = prop->next) { - if (prop->type == P_DEFAULT) - prop_warn(prop, "defaults for choice " - "values not supported"); - if (prop->menu == menu) - continue; - if (prop->type == P_PROMPT && - prop->menu->parent->sym != sym) - prop_warn(prop, "choice value used outside its choice group"); - } /* Non-tristate choice values of tristate choices must * depend on the choice being set to Y. The choice * values' dependencies were propagated to their diff --git a/scripts/kconfig/parser.y b/scripts/kconfig/parser.y index ed86869e5ed0..0a9e249b5dcc 100644 --- a/scripts/kconfig/parser.y +++ b/scripts/kconfig/parser.y @@ -476,6 +476,37 @@ assign_val: %% +/** + * choice_check_sanity - check sanity of a choice member + * + * @menu: menu of the choice member + * + * Return: -1 if an error is found, 0 otherwise. + */ +static int choice_check_sanity(struct menu *menu) +{ + struct property *prop; + int ret = 0; + + for (prop = menu->sym->prop; prop; prop = prop->next) { + if (prop->type == P_DEFAULT) { + fprintf(stderr, "%s:%d: error: %s", + prop->filename, prop->lineno, + "defaults for choice values not supported\n"); + ret = -1; + } + + if (prop->menu != menu && prop->type == P_PROMPT) { + fprintf(stderr, "%s:%d: error: %s", + prop->filename, prop->lineno, + "choice value has a prompt outside its choice group\n"); + ret = -1; + } + } + + return ret; +} + void conf_parse(const char *name) { struct menu *menu; @@ -523,8 +554,16 @@ void conf_parse(const char *name) menu_finalize(); menu_for_each_entry(menu) { + struct menu *child; + if (menu->sym && sym_check_deps(menu->sym)) yynerrs++; + + if (menu->sym && sym_is_choice(menu->sym)) { + menu_for_each_sub_entry(child, menu) + if (child->sym && choice_check_sanity(child)) + yynerrs++; + } } if (yynerrs)