From patchwork Fri May 10 10:23:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13661261 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 3E10A130E39; Fri, 10 May 2024 10:24:41 +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=1715336682; cv=none; b=IZdYFE7upTzyLVZYeHV8w2q6nLHFSPbbX6gaWTqy0E/Qc20A7CXQB8TXICRIIQ8LRzttYRm1VSC0hcowZ7w5etkgl4baLYcj+NFglg6QXIvvv7Ca1g0G/NkGVgP3HC9P+P/b0bq+L4G3Hl8g2RGaEC4oMl/OTEP2K6NhC3QX65k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715336682; c=relaxed/simple; bh=Q5ZDUnExSnU8qi8YRiMhs4Ryi8d1arD/GQlT0xAQ3jA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=dgb9NS8k1d/Dfi2MFkFbM9ZrueCuBSuVyNQEdUAL6DOwlrn37MVMFcLmYqypHC+BacUqIN4dtTxSppm/hnJrfoKM3B73a0RSFcYjrnhBby+yplisDJaE6ntrIgUADJDt0ZkDQiXscURPupmcHIGbeGevH7mwfu3B4/lm+T/uR4g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t0RiO78B; 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="t0RiO78B" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0562AC113CC; Fri, 10 May 2024 10:24:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715336681; bh=Q5ZDUnExSnU8qi8YRiMhs4Ryi8d1arD/GQlT0xAQ3jA=; h=From:To:Cc:Subject:Date:From; b=t0RiO78BOWpYP+ckiAh37hqwnRWGabYb6hfLyyCoMH45bETJ8uGJYflHwcIVqdy1t RQuV8fOi8XOwZwRimEBeqE3tg7p9i8NH9A33oAZfSsBZalD185AA67augK82Q8meYj gvjbkL/1RSqlDpWBnABsuchan285IXZs9gzxTP78vXYBF3pA/oavhfrTggUbHPFjY9 LnMJLCSvVRrQfPYN9scWvRhheIYoHIVSRWI1NWBfjkFT238cZjSrPAlx6nPEsNmBpe X+05cr/CdIezmNfkCIkNXqi/Rv+9Qubcg5o5j0nzdOhz9clqi7Ri3Aum9CJGYKlFzN UpBYStORbdO0g== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH v2 1/3] kconfig: m/nconf: remove dead code to display children of choice members Date: Fri, 10 May 2024 19:23:21 +0900 Message-Id: <20240510102323.2948886-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 This code previously displayed child symbols of the selected choice member. Since commit 7e3465f63a0a ("kconfig: do not reparent the menu inside a choice block"), choice members never have child symbols, therefore this is dead code. Signed-off-by: Masahiro Yamada --- Changes in v2: - Remove more dead code scripts/kconfig/mconf.c | 81 +++++++++++++++++---------------------- scripts/kconfig/nconf.c | 85 +++++++++++++++++------------------------ 2 files changed, 71 insertions(+), 95 deletions(-) diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index c0969097447d..8de4af43e865 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -551,11 +551,6 @@ static void build_conf(struct menu *menu) if (def_menu) { item_add_str(" (%s)", menu_get_prompt(def_menu)); item_add_str(" --->"); - if (def_menu->list) { - indent += 2; - build_conf(def_menu); - indent -= 2; - } } return; } @@ -568,49 +563,43 @@ static void build_conf(struct menu *menu) } child_count++; val = sym_get_tristate_value(sym); - if (sym_is_choice_value(sym) && val == yes) { - item_make(" "); - item_set_tag(':'); + switch (type) { + case S_BOOLEAN: + if (sym_is_changeable(sym)) + item_make("[%c]", val == no ? ' ' : '*'); + else + item_make("-%c-", val == no ? ' ' : '*'); + item_set_tag('t'); item_set_data(menu); - } else { - switch (type) { - case S_BOOLEAN: - if (sym_is_changeable(sym)) - item_make("[%c]", val == no ? ' ' : '*'); - else - item_make("-%c-", val == no ? ' ' : '*'); - item_set_tag('t'); - item_set_data(menu); - break; - case S_TRISTATE: - switch (val) { - case yes: ch = '*'; break; - case mod: ch = 'M'; break; - default: ch = ' '; break; - } - if (sym_is_changeable(sym)) { - if (sym->rev_dep.tri == mod) - item_make("{%c}", ch); - else - item_make("<%c>", ch); - } else - item_make("-%c-", ch); - item_set_tag('t'); - item_set_data(menu); - break; - default: - tmp = 2 + strlen(sym_get_string_value(sym)); /* () = 2 */ - item_make("(%s)", sym_get_string_value(sym)); - tmp = indent - tmp + 4; - if (tmp < 0) - tmp = 0; - item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu), - (sym_has_value(sym) || !sym_is_changeable(sym)) ? - "" : " (NEW)"); - item_set_tag('s'); - item_set_data(menu); - goto conf_childs; + break; + case S_TRISTATE: + switch (val) { + case yes: ch = '*'; break; + case mod: ch = 'M'; break; + default: ch = ' '; break; } + if (sym_is_changeable(sym)) { + if (sym->rev_dep.tri == mod) + item_make("{%c}", ch); + else + item_make("<%c>", ch); + } else + item_make("-%c-", ch); + item_set_tag('t'); + item_set_data(menu); + break; + default: + tmp = 2 + strlen(sym_get_string_value(sym)); /* () = 2 */ + item_make("(%s)", sym_get_string_value(sym)); + tmp = indent - tmp + 4; + if (tmp < 0) + tmp = 0; + item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu), + (sym_has_value(sym) || !sym_is_changeable(sym)) ? + "" : " (NEW)"); + item_set_tag('s'); + item_set_data(menu); + goto conf_childs; } item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), (sym_has_value(sym) || !sym_is_changeable(sym)) ? diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index 9d22b0f3197b..bf460233a4cc 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c @@ -857,11 +857,6 @@ static void build_conf(struct menu *menu) item_add_str(" (%s)", menu_get_prompt(def_menu)); item_add_str(" --->"); - if (def_menu->list) { - indent += 2; - build_conf(def_menu); - indent -= 2; - } } return; } @@ -874,54 +869,46 @@ static void build_conf(struct menu *menu) } child_count++; val = sym_get_tristate_value(sym); - if (sym_is_choice_value(sym) && val == yes) { - item_make(menu, ':', " "); - } else { - switch (type) { - case S_BOOLEAN: - if (sym_is_changeable(sym)) - item_make(menu, 't', "[%c]", - val == no ? ' ' : '*'); - else - item_make(menu, 't', "-%c-", - val == no ? ' ' : '*'); + switch (type) { + case S_BOOLEAN: + if (sym_is_changeable(sym)) + item_make(menu, 't', "[%c]", + val == no ? ' ' : '*'); + else + item_make(menu, 't', "-%c-", + val == no ? ' ' : '*'); + break; + case S_TRISTATE: + switch (val) { + case yes: + ch = '*'; break; - case S_TRISTATE: - switch (val) { - case yes: - ch = '*'; - break; - case mod: - ch = 'M'; - break; - default: - ch = ' '; - break; - } - if (sym_is_changeable(sym)) { - if (sym->rev_dep.tri == mod) - item_make(menu, - 't', "{%c}", ch); - else - item_make(menu, - 't', "<%c>", ch); - } else - item_make(menu, 't', "-%c-", ch); + case mod: + ch = 'M'; break; default: - tmp = 2 + strlen(sym_get_string_value(sym)); - item_make(menu, 's', " (%s)", - sym_get_string_value(sym)); - tmp = indent - tmp + 4; - if (tmp < 0) - tmp = 0; - item_add_str("%*c%s%s", tmp, ' ', - menu_get_prompt(menu), - (sym_has_value(sym) || - !sym_is_changeable(sym)) ? "" : - " (NEW)"); - goto conf_childs; + ch = ' '; + break; } + if (sym_is_changeable(sym)) { + if (sym->rev_dep.tri == mod) + item_make(menu, 't', "{%c}", ch); + else + item_make(menu, 't', "<%c>", ch); + } else + item_make(menu, 't', "-%c-", ch); + break; + default: + tmp = 2 + strlen(sym_get_string_value(sym)); + item_make(menu, 's', " (%s)", + sym_get_string_value(sym)); + tmp = indent - tmp + 4; + if (tmp < 0) + tmp = 0; + item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu), + (sym_has_value(sym) || + !sym_is_changeable(sym)) ? "" : " (NEW)"); + goto conf_childs; } item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), From patchwork Fri May 10 10:23:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13661262 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 32253168AFE; Fri, 10 May 2024 10:24:43 +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=1715336683; cv=none; b=AKe5BIXs/UIBsvbObSVLfJJe13kC41eoXIolwvKlpD7Rpmloxw4SitHpsKUTmePtKiGYNSUAwSq/goX+kqXbMPDyH0A/Dgkcwpjzlz5Ne2IujpImS1teLyAh1ZiG+gfxW9TnTfhvwAN5USWPEnZ3vUJMez2zbfvUesJdCL20IVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715336683; c=relaxed/simple; bh=Ze8Q2NPH+lSYb7GIrGOA0moGIm4Q2QeviYx2Y8PWdGc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=p+ZBpBO7YFiVVsrTwSf02CGynl9yNsgi5MKPkYvtVtZJUb12lZTG42wxaZnIgOVAZ8JBo30yL99Z6FpXql9WG5NGDTux7Tcd/LgJrwhUQAf/NfRhEZ55Vo4noIvsHg3W36hTZo6QH1dT9uyA9UBlyzF4z/7FrUuMGkwcXZanT7I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YT7bLdue; 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="YT7bLdue" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FC53C32782; Fri, 10 May 2024 10:24:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715336683; bh=Ze8Q2NPH+lSYb7GIrGOA0moGIm4Q2QeviYx2Y8PWdGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YT7bLdueDc0PkEw8gXPF2shBbQsnt/830VRkyRsZcvmfXO+UtbvGXJ3yxvLwB8d6u qekB5YocfItYOmDeux5RFNdAuHeKdbjb2T9cGSOSUhKVA52AGPaeEmgBSajsjNMItd qrYkNqw8ucGaLjWlSFLTjhQdMYRBNA5QROhvtU4DfGfnmpQZ9s+8WKsqMSdhMC5QIz NbgunPzNCayr3WcLXIE88KsTi6hQmh2rVAm+xabYEsEO8ctE4zpzZUqCe3v+AancK7 iF2bKuvGtRdywDRYOJGmVaFIHm1OrKAvWdYpwndOSzgJRU9VwXfkIymwlNzgrLaPGA //kgkgOJeScJw== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH v2 2/3] kconfig: m/nconf: remove dead code to display value of bool choice Date: Fri, 10 May 2024 19:23:22 +0900 Message-Id: <20240510102323.2948886-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240510102323.2948886-1-masahiroy@kernel.org> References: <20240510102323.2948886-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Previously, optional bool choices met the following conditions simultaneously: - sym_is_choice(sym) - sym_is_changeable(sym) - type == S_BOOLEAN It no longer occurs since 6a1215888e23 ("kconfig: remove 'optional' property support"). Remove the dead code. Signed-off-by: Masahiro Yamada --- (no changes since v1) scripts/kconfig/mconf.c | 17 +++++------------ scripts/kconfig/nconf.c | 26 +++++++++----------------- 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 8de4af43e865..90cd59a96aac 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -525,19 +525,12 @@ static void build_conf(struct menu *menu) val = sym_get_tristate_value(sym); if (sym_is_changeable(sym)) { - switch (type) { - case S_BOOLEAN: - item_make("[%c]", val == no ? ' ' : '*'); - break; - case S_TRISTATE: - switch (val) { - case yes: ch = '*'; break; - case mod: ch = 'M'; break; - default: ch = ' '; break; - } - item_make("<%c>", ch); - break; + switch (val) { + case yes: ch = '*'; break; + case mod: ch = 'M'; break; + default: ch = ' '; break; } + item_make("<%c>", ch); item_set_tag('t'); item_set_data(menu); } else { diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index bf460233a4cc..93047cd28f3f 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c @@ -826,26 +826,18 @@ static void build_conf(struct menu *menu) val = sym_get_tristate_value(sym); if (sym_is_changeable(sym)) { - switch (type) { - case S_BOOLEAN: - item_make(menu, 't', "[%c]", - val == no ? ' ' : '*'); + switch (val) { + case yes: + ch = '*'; break; - case S_TRISTATE: - switch (val) { - case yes: - ch = '*'; - break; - case mod: - ch = 'M'; - break; - default: - ch = ' '; - break; - } - item_make(menu, 't', "<%c>", ch); + case mod: + ch = 'M'; + break; + default: + ch = ' '; break; } + item_make(menu, 't', "<%c>", ch); } else { item_make(menu, def_menu ? 't' : ':', " "); } From patchwork Fri May 10 10:23:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13661263 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 7A4FD16C863; Fri, 10 May 2024 10:24:44 +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=1715336684; cv=none; b=JrWez9pjnDSb5mX6r6XGpFuGieJ8GHVNW+S2zaYGDqM8hDyAYaDePXggg4ts7Q4QmmuXwEMSsnIo+j3ZpCZXBvotCxGmOF8QzAeq8dmG8k9l0ggIZu9IsfU4Ig4NNqKIULb+qq5sW/myba2SGF1w1amVHcHio1bRSh9XNRj9S+c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715336684; c=relaxed/simple; bh=7Cou4XrABzcgomDRnVTRkEhZ2jNwhltEsvMLKE86NHE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ffttCf/EVnUHhEUcOCUHleeOXzf3nQFUCq5SkF5dKY/DfOyGDzKZwny5CfP68v+bobu+4pC5C6a7QJxYKECUGloTOhxAENZT9s9w243M0LT6heo1zXiEHB6tgYA3Fls9lOOH16sA6azRgl4/j4xk3qwFNhZ9jqSFltRG6TfrwgQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LKEfKsON; 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="LKEfKsON" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 974D7C4AF0A; Fri, 10 May 2024 10:24:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715336684; bh=7Cou4XrABzcgomDRnVTRkEhZ2jNwhltEsvMLKE86NHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LKEfKsONXvhUv0mbcnoZLGZGDLpLEF9LW9lxxSVmA+ZHUrdRXfe4bikOdjdUgVW5C CsrhCe01qI4UezBi2xF0CPSrKzx4zYHgeCUUl2Gu4JPORGo2bPCYuluSMXrLHmHluN SrVKMGYvxlLaTpuSF9l93cuHXChu8h5pq9D5G0jGQ7qiKZWEu61gE4NmDej5LmapuW Xqk+53odc9oAqyNeh53dkwwRS9AuhLAUrnFBkl8FTEoCNlR9JsxGl7QoP9VCb+Llpi Sd1UkijAiPldDl8ltWTZmN1xckidmVaXKyyqZ39Z6TDI8nekaOFChCHBTLRH65Y+IK as8jF+j0chSqA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH v2 3/3] kconfig: m/nconf: merge two item_add_str() calls Date: Fri, 10 May 2024 19:23:23 +0900 Message-Id: <20240510102323.2948886-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240510102323.2948886-1-masahiroy@kernel.org> References: <20240510102323.2948886-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Just trivial cleanups. Signed-off-by: Masahiro Yamada --- (no changes since v1) scripts/kconfig/mconf.c | 6 ++---- scripts/kconfig/nconf.c | 7 ++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 90cd59a96aac..d6a61ca1a984 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -541,10 +541,8 @@ static void build_conf(struct menu *menu) item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(menu)); if (val == yes) { - if (def_menu) { - item_add_str(" (%s)", menu_get_prompt(def_menu)); - item_add_str(" --->"); - } + if (def_menu) + item_add_str(" (%s) --->", menu_get_prompt(def_menu)); return; } } else { diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index 93047cd28f3f..e1cb09418cbe 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c @@ -845,11 +845,8 @@ static void build_conf(struct menu *menu) item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(menu)); if (val == yes) { - if (def_menu) { - item_add_str(" (%s)", - menu_get_prompt(def_menu)); - item_add_str(" --->"); - } + if (def_menu) + item_add_str(" (%s) --->", menu_get_prompt(def_menu)); return; } } else {