Skip to contentSkip to conversation

kconfig: m/nconf: remove dead code to display children of choice members

PATCH Superseded Masahiro Yamada 1 participant 3 messages May 7, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 kconfig: m/nconf: remove dead code to display children of choice members

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.

---

 scripts/kconfig/mconf.c | 5 -----
 scripts/kconfig/nconf.c | 5 -----
 2 files changed, 10 deletions(-)
scripts/kconfig/mconf.c +0 -5
index c0969097447d..b33335eba460 100644
@@ -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;
 		}
scripts/kconfig/nconf.c +0 -5
index 9d22b0f3197b..b5b3232f592a 100644
@@ -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;
 		}
Signature · 1 line
2.40.1
#1 lore raw

PATCH 2/3 kconfig: m/nconf: remove dead code to display value of bool choice

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.

---

 scripts/kconfig/mconf.c | 17 +++++------------
 scripts/kconfig/nconf.c | 26 +++++++++-----------------
 2 files changed, 14 insertions(+), 29 deletions(-)
scripts/kconfig/mconf.c +5 -12
index b33335eba460..64bf373f7921 100644
@@ -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 {
scripts/kconfig/nconf.c +9 -17
index b5b3232f592a..715e156fdbb1 100644
@@ -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' : ':', "   ");
 		}
Signature · 1 line
2.40.1
#2 lore raw

PATCH 3/3 kconfig: m/nconf: merge two item_add_str() calls

In reply to Masahiro Yamada

Just trivial cleanups.

---

 scripts/kconfig/mconf.c | 6 ++----
 scripts/kconfig/nconf.c | 7 ++-----
 2 files changed, 4 insertions(+), 9 deletions(-)
scripts/kconfig/mconf.c +2 -4
index 64bf373f7921..33929b0b5ca8 100644
@@ -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 {
scripts/kconfig/nconf.c +2 -5
index 715e156fdbb1..a9ef2ced7d7a 100644
@@ -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 {
Signature · 1 line
2.40.1