linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] kconfig: remove unneeded 'optional' property support
@ 2024-04-22 16:41 Masahiro Yamada
  2024-04-22 16:41 ` [PATCH v2 1/2] sh: Convert the last use of 'optional' property in Kconfig Masahiro Yamada
  2024-04-22 16:41 ` [PATCH v2 2/2] kconfig: remove 'optional' property support Masahiro Yamada
  0 siblings, 2 replies; 6+ messages in thread
From: Masahiro Yamada @ 2024-04-22 16:41 UTC (permalink / raw)
  To: linux-kbuild
  Cc: linux-kernel, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, linux-sh, Masahiro Yamada,
	Jonathan Corbet, Nathan Chancellor, Nicolas Schier, linux-doc


Kconfig support 'optional' for choice blocks, but it is unneeded.

Currently, it is only used in arch/sh/Kconfig.

Covert it (add a place-holder option, CONFIG_CMDLINE_NO_MODIFY) and
clean up the Kconfig code.

(Ack from the sh maintainer is appreciated)


Masahiro Yamada (2):
  sh: Convert the last use of 'optional' property in Kconfig
  kconfig: remove 'optional' property support

 Documentation/kbuild/kconfig-language.rst     |  3 ---
 arch/sh/Kconfig                               |  6 ++++-
 arch/sh/configs/apsh4a3a_defconfig            |  1 +
 arch/sh/configs/apsh4ad0a_defconfig           |  1 +
 arch/sh/configs/edosk7705_defconfig           |  1 +
 arch/sh/configs/hp6xx_defconfig               |  1 +
 arch/sh/configs/landisk_defconfig             |  1 +
 arch/sh/configs/magicpanelr2_defconfig        |  1 +
 arch/sh/configs/rsk7264_defconfig             |  1 +
 arch/sh/configs/rsk7269_defconfig             |  1 +
 arch/sh/configs/se7619_defconfig              |  1 +
 arch/sh/configs/se7705_defconfig              |  1 +
 arch/sh/configs/se7722_defconfig              |  1 +
 arch/sh/configs/se7750_defconfig              |  1 +
 arch/sh/configs/secureedge5410_defconfig      |  1 +
 arch/sh/configs/sh7710voipgw_defconfig        |  1 +
 arch/sh/configs/sh7724_generic_defconfig      |  1 +
 arch/sh/configs/sh7770_generic_defconfig      |  1 +
 arch/sh/configs/sh7785lcr_32bit_defconfig     |  1 +
 arch/sh/configs/sh7785lcr_defconfig           |  1 +
 arch/sh/configs/urquell_defconfig             |  1 +
 scripts/kconfig/confdata.c                    |  5 +---
 scripts/kconfig/expr.h                        |  1 -
 scripts/kconfig/gconf.c                       |  2 --
 scripts/kconfig/lexer.l                       |  1 -
 scripts/kconfig/lkc.h                         |  5 ----
 scripts/kconfig/menu.c                        | 12 +++------
 scripts/kconfig/parser.y                      |  9 -------
 scripts/kconfig/tests/choice/Kconfig          | 26 -------------------
 .../tests/choice/allmod_expected_config       |  4 ---
 .../tests/choice/allyes_expected_config       |  4 ---
 .../tests/choice/oldask0_expected_stdout      |  2 --
 scripts/kconfig/tests/choice/oldask1_config   |  1 -
 .../tests/choice/oldask1_expected_stdout      |  6 -----
 34 files changed, 29 insertions(+), 77 deletions(-)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/2] sh: Convert the last use of 'optional' property in Kconfig
  2024-04-22 16:41 [PATCH v2 0/2] kconfig: remove unneeded 'optional' property support Masahiro Yamada
@ 2024-04-22 16:41 ` Masahiro Yamada
  2024-04-24  7:14   ` John Paul Adrian Glaubitz
  2024-04-22 16:41 ` [PATCH v2 2/2] kconfig: remove 'optional' property support Masahiro Yamada
  1 sibling, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2024-04-22 16:41 UTC (permalink / raw)
  To: linux-kbuild
  Cc: linux-kernel, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, linux-sh, Masahiro Yamada

The 'choice' statement is primarily used to exclusively select one
option, but the 'optional' property allows all entries to be disabled.

This feature is rarely used. In fact, it is only used in arch/sh/Kconfig
because the equivalent outcome can be achieved by inserting one more
entry as a place-holder.

The 'optional' property support will be removed from Kconfig.

This commit replaces the 'optional' property with a dummy option,
CMDLINE_FROM_BOOTLOADER, as seen in some other architectures.

Note:
 The 'default CMDLINE_OVERWRITE' statement does not work as intended
 in combination with 'optional'. If neither CONFIG_CMDLINE_OVERWRITE
 nor CONFIG_CMDLINE_EXTEND is specified in a defconfig file, both of
 them are disabled. This is a bug. To maintain the current behavior,
 I added CONFIG_CMDLINE_FROM_BOOTLOADER=y to those defconfig files.

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

Changes in v2:
 - Rename CONFIG_CMDLINE_NO_MODIFY to CONFIG_CMDLINE_FROM_BOOTLOADER
 - Capitalize the first work of the subject

 arch/sh/Kconfig                           | 6 +++++-
 arch/sh/configs/apsh4a3a_defconfig        | 1 +
 arch/sh/configs/apsh4ad0a_defconfig       | 1 +
 arch/sh/configs/edosk7705_defconfig       | 1 +
 arch/sh/configs/hp6xx_defconfig           | 1 +
 arch/sh/configs/landisk_defconfig         | 1 +
 arch/sh/configs/magicpanelr2_defconfig    | 1 +
 arch/sh/configs/rsk7264_defconfig         | 1 +
 arch/sh/configs/rsk7269_defconfig         | 1 +
 arch/sh/configs/se7619_defconfig          | 1 +
 arch/sh/configs/se7705_defconfig          | 1 +
 arch/sh/configs/se7722_defconfig          | 1 +
 arch/sh/configs/se7750_defconfig          | 1 +
 arch/sh/configs/secureedge5410_defconfig  | 1 +
 arch/sh/configs/sh7710voipgw_defconfig    | 1 +
 arch/sh/configs/sh7724_generic_defconfig  | 1 +
 arch/sh/configs/sh7770_generic_defconfig  | 1 +
 arch/sh/configs/sh7785lcr_32bit_defconfig | 1 +
 arch/sh/configs/sh7785lcr_defconfig       | 1 +
 arch/sh/configs/urquell_defconfig         | 1 +
 20 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 2ad3e29f0ebe..8b64ca76aa4b 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -709,7 +709,6 @@ config ROMIMAGE_MMCIF
 
 choice
 	prompt "Kernel command line"
-	optional
 	default CMDLINE_OVERWRITE
 	help
 	  Setting this option allows the kernel command line arguments
@@ -727,6 +726,11 @@ config CMDLINE_EXTEND
 	  Given string will be concatenated with arguments passed in
 	  by a bootloader.
 
+config CMDLINE_FROM_BOOTLOADER
+	bool "Use bootloader kernel arguments"
+	help
+	  Uses the command-line options passed by the boot loader.
+
 endchoice
 
 config CMDLINE
diff --git a/arch/sh/configs/apsh4a3a_defconfig b/arch/sh/configs/apsh4a3a_defconfig
index cc909f347877..9c2644443c4d 100644
--- a/arch/sh/configs/apsh4a3a_defconfig
+++ b/arch/sh/configs/apsh4a3a_defconfig
@@ -15,6 +15,7 @@ CONFIG_MEMORY_START=0x0C000000
 CONFIG_FLATMEM_MANUAL=y
 CONFIG_SH_STORE_QUEUES=y
 CONFIG_SH_APSH4A3A=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_HIGH_RES_TIMERS=y
 CONFIG_KEXEC=y
 CONFIG_PREEMPT=y
diff --git a/arch/sh/configs/apsh4ad0a_defconfig b/arch/sh/configs/apsh4ad0a_defconfig
index 64558bf60e10..05d21d91f41d 100644
--- a/arch/sh/configs/apsh4ad0a_defconfig
+++ b/arch/sh/configs/apsh4ad0a_defconfig
@@ -42,6 +42,7 @@ CONFIG_SECCOMP=y
 CONFIG_PREEMPT=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 CONFIG_BINFMT_MISC=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_PM=y
 CONFIG_PM_DEBUG=y
 CONFIG_PM=y
diff --git a/arch/sh/configs/edosk7705_defconfig b/arch/sh/configs/edosk7705_defconfig
index 9ee35269bee2..57c79da1ff8e 100644
--- a/arch/sh/configs/edosk7705_defconfig
+++ b/arch/sh/configs/edosk7705_defconfig
@@ -19,6 +19,7 @@
 CONFIG_CPU_SUBTYPE_SH7705=y
 CONFIG_SH_EDOSK7705=y
 CONFIG_SH_PCLK_FREQ=31250000
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 # CONFIG_INPUT is not set
 # CONFIG_SERIO is not set
diff --git a/arch/sh/configs/hp6xx_defconfig b/arch/sh/configs/hp6xx_defconfig
index 0c45f2a0f9bd..77e3185f63e4 100644
--- a/arch/sh/configs/hp6xx_defconfig
+++ b/arch/sh/configs/hp6xx_defconfig
@@ -15,6 +15,7 @@ CONFIG_SH_DMA_API=y
 CONFIG_HD64461_ENABLER=y
 CONFIG_PCCARD=y
 CONFIG_PM=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_APM_EMULATION=y
 # CONFIG_STANDALONE is not set
 CONFIG_BLK_DEV_SD=y
diff --git a/arch/sh/configs/landisk_defconfig b/arch/sh/configs/landisk_defconfig
index 541082090918..0311380160f4 100644
--- a/arch/sh/configs/landisk_defconfig
+++ b/arch/sh/configs/landisk_defconfig
@@ -15,6 +15,7 @@ CONFIG_KEXEC=y
 CONFIG_PCI=y
 CONFIG_PCCARD=y
 CONFIG_YENTA=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
diff --git a/arch/sh/configs/magicpanelr2_defconfig b/arch/sh/configs/magicpanelr2_defconfig
index 52937f9cc2ab..8d443749550e 100644
--- a/arch/sh/configs/magicpanelr2_defconfig
+++ b/arch/sh/configs/magicpanelr2_defconfig
@@ -22,6 +22,7 @@ CONFIG_SH_PCLK_FREQ=24000000
 CONFIG_SH_DMA=y
 CONFIG_SH_DMA_API=y
 CONFIG_HEARTBEAT=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
diff --git a/arch/sh/configs/rsk7264_defconfig b/arch/sh/configs/rsk7264_defconfig
index a88cb3b77957..e4ef259425c4 100644
--- a/arch/sh/configs/rsk7264_defconfig
+++ b/arch/sh/configs/rsk7264_defconfig
@@ -21,6 +21,7 @@ CONFIG_MEMORY_START=0x0c000000
 CONFIG_FLATMEM_MANUAL=y
 CONFIG_CPU_BIG_ENDIAN=y
 CONFIG_SH_RSK=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 # CONFIG_SH_TIMER_MTU2 is not set
 CONFIG_BINFMT_FLAT=y
 CONFIG_NET=y
diff --git a/arch/sh/configs/rsk7269_defconfig b/arch/sh/configs/rsk7269_defconfig
index d9a7ce783c9b..e0d1560b2bfd 100644
--- a/arch/sh/configs/rsk7269_defconfig
+++ b/arch/sh/configs/rsk7269_defconfig
@@ -10,6 +10,7 @@ CONFIG_MEMORY_SIZE=0x02000000
 CONFIG_FLATMEM_MANUAL=y
 CONFIG_CPU_BIG_ENDIAN=y
 CONFIG_SH_RSK=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 # CONFIG_SH_TIMER_MTU2 is not set
 CONFIG_SH_PCLK_FREQ=66700000
 CONFIG_BINFMT_FLAT=y
diff --git a/arch/sh/configs/se7619_defconfig b/arch/sh/configs/se7619_defconfig
index 14d0f5ead502..6b25e9713e77 100644
--- a/arch/sh/configs/se7619_defconfig
+++ b/arch/sh/configs/se7619_defconfig
@@ -14,6 +14,7 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_CPU_BIG_ENDIAN=y
 CONFIG_SH_7619_SOLUTION_ENGINE=y
 CONFIG_HZ_100=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_BINFMT_FLAT=y
 CONFIG_BINFMT_ZFLAT=y
 # CONFIG_STANDALONE is not set
diff --git a/arch/sh/configs/se7705_defconfig b/arch/sh/configs/se7705_defconfig
index 16a0f72f0822..1752ddc2694a 100644
--- a/arch/sh/configs/se7705_defconfig
+++ b/arch/sh/configs/se7705_defconfig
@@ -13,6 +13,7 @@ CONFIG_FLATMEM_MANUAL=y
 # CONFIG_SH_ADC is not set
 CONFIG_SH_SOLUTION_ENGINE=y
 CONFIG_HEARTBEAT=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_PREEMPT=y
 CONFIG_NET=y
 CONFIG_PACKET=y
diff --git a/arch/sh/configs/se7722_defconfig b/arch/sh/configs/se7722_defconfig
index 09e455817447..5327a2f70980 100644
--- a/arch/sh/configs/se7722_defconfig
+++ b/arch/sh/configs/se7722_defconfig
@@ -17,6 +17,7 @@ CONFIG_SH_7722_SOLUTION_ENGINE=y
 CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
 CONFIG_HEARTBEAT=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_KEXEC=y
 CONFIG_PREEMPT=y
 CONFIG_NET=y
diff --git a/arch/sh/configs/se7750_defconfig b/arch/sh/configs/se7750_defconfig
index 5fa6239ae4ea..a1e25d7de8a6 100644
--- a/arch/sh/configs/se7750_defconfig
+++ b/arch/sh/configs/se7750_defconfig
@@ -15,6 +15,7 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_SH_SOLUTION_ENGINE=y
 CONFIG_SH_PCLK_FREQ=33333333
 CONFIG_HEARTBEAT=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
diff --git a/arch/sh/configs/secureedge5410_defconfig b/arch/sh/configs/secureedge5410_defconfig
index 120176afe3f6..2f77b60e9540 100644
--- a/arch/sh/configs/secureedge5410_defconfig
+++ b/arch/sh/configs/secureedge5410_defconfig
@@ -10,6 +10,7 @@ CONFIG_SH_SECUREEDGE5410=y
 CONFIG_SH_DMA=y
 CONFIG_SH_DMA_API=y
 CONFIG_PCI=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_NET=y
 CONFIG_INET=y
 # CONFIG_INET_XFRM_MODE_TRANSPORT is not set
diff --git a/arch/sh/configs/sh7710voipgw_defconfig b/arch/sh/configs/sh7710voipgw_defconfig
index 7f742729df69..99a5d0760532 100644
--- a/arch/sh/configs/sh7710voipgw_defconfig
+++ b/arch/sh/configs/sh7710voipgw_defconfig
@@ -15,6 +15,7 @@ CONFIG_MEMORY_SIZE=0x00800000
 CONFIG_FLATMEM_MANUAL=y
 # CONFIG_SH_ADC is not set
 CONFIG_SH_PCLK_FREQ=32768000
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
diff --git a/arch/sh/configs/sh7724_generic_defconfig b/arch/sh/configs/sh7724_generic_defconfig
index cbc9389a89a8..5440bd0ca4ed 100644
--- a/arch/sh/configs/sh7724_generic_defconfig
+++ b/arch/sh/configs/sh7724_generic_defconfig
@@ -12,6 +12,7 @@ CONFIG_CPU_FREQ=y
 CONFIG_SH_CPU_FREQ=y
 CONFIG_KEXEC=y
 CONFIG_KEXEC_JUMP=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_HIBERNATION=y
 CONFIG_CPU_IDLE=y
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
diff --git a/arch/sh/configs/sh7770_generic_defconfig b/arch/sh/configs/sh7770_generic_defconfig
index ee2357deba0f..4338af8d02d0 100644
--- a/arch/sh/configs/sh7770_generic_defconfig
+++ b/arch/sh/configs/sh7770_generic_defconfig
@@ -14,6 +14,7 @@ CONFIG_SH_CPU_FREQ=y
 CONFIG_KEXEC=y
 CONFIG_KEXEC_JUMP=y
 CONFIG_PM=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_HIBERNATION=y
 CONFIG_CPU_IDLE=y
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
diff --git a/arch/sh/configs/sh7785lcr_32bit_defconfig b/arch/sh/configs/sh7785lcr_32bit_defconfig
index 59262f42abe6..44f9b2317f09 100644
--- a/arch/sh/configs/sh7785lcr_32bit_defconfig
+++ b/arch/sh/configs/sh7785lcr_32bit_defconfig
@@ -32,6 +32,7 @@ CONFIG_PREEMPT=y
 CONFIG_INTC_USERIMASK=y
 CONFIG_PCI=y
 CONFIG_PCI_DEBUG=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_PM=y
 CONFIG_CPU_IDLE=y
 CONFIG_NET=y
diff --git a/arch/sh/configs/sh7785lcr_defconfig b/arch/sh/configs/sh7785lcr_defconfig
index 94381f8268ff..aec74b0e7003 100644
--- a/arch/sh/configs/sh7785lcr_defconfig
+++ b/arch/sh/configs/sh7785lcr_defconfig
@@ -17,6 +17,7 @@ CONFIG_HEARTBEAT=y
 CONFIG_KEXEC=y
 CONFIG_PREEMPT=y
 CONFIG_PCI=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
diff --git a/arch/sh/configs/urquell_defconfig b/arch/sh/configs/urquell_defconfig
index 445bb451a5ec..00ef62133b04 100644
--- a/arch/sh/configs/urquell_defconfig
+++ b/arch/sh/configs/urquell_defconfig
@@ -34,6 +34,7 @@ CONFIG_PCIEPORTBUS=y
 CONFIG_PCIEASPM_DEBUG=y
 CONFIG_PCI_DEBUG=y
 CONFIG_BINFMT_MISC=y
+CONFIG_CMDLINE_FROM_BOOTLOADER=y
 CONFIG_PM=y
 CONFIG_CPU_IDLE=y
 CONFIG_NET=y
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] kconfig: remove 'optional' property support
  2024-04-22 16:41 [PATCH v2 0/2] kconfig: remove unneeded 'optional' property support Masahiro Yamada
  2024-04-22 16:41 ` [PATCH v2 1/2] sh: Convert the last use of 'optional' property in Kconfig Masahiro Yamada
@ 2024-04-22 16:41 ` Masahiro Yamada
  2024-04-24 12:24   ` Nicolas Schier
  1 sibling, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2024-04-22 16:41 UTC (permalink / raw)
  To: linux-kbuild
  Cc: linux-kernel, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, linux-sh, Masahiro Yamada,
	Jonathan Corbet, Nathan Chancellor, Nicolas Schier, linux-doc

The 'choice' statement is primarily used to exclusively select one
option, but the 'optional' property allows all entries to be disabled.

In the following example, both A and B can be disabled simultaneously:

    choice
            prompt "choose A, B, or nothing"
            optional

    config A
            bool "A"

    config B
            bool "B"

    endchoice

You can achieve the equivalent outcome by other means.

A common solution is to add another option to guard the choice block.
In the following example, you can set ENABLE_A_B_CHOICE=n to disable
the entire choice block:

    choice
            prompt "choose A or B"
            depends on ENABLE_A_B_CHOICE

    config A
            bool "A"

    config B
            bool "B"

    endchoice

Another approach is to insert one more entry as a place-holder:

    choice
            prompt "choose A, B, or disable both"

    config A
            bool "A"

    config B
            bool "B"

    config DISABLE_A_AND_B
            bool "choose this to disable both A and B"

    endchoice

Some real examples are DEBUG_INFO_NONE, INITRAMFS_COMPRESSION_NONE,
LTO_NONE, etc.

The 'optional' property is even more unnecessary for a tristate choice.

Without the 'optional' property, you can disable A and B; you can set
'm' in the choice prompt, and disable A and B individually:

    choice
            prompt "choose one built-in or make them modular"

    config A
            tristate "A"

    config B
            tristate "B"

    endchoice

In conclusion, the 'optional' property was unneeded.

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

(no changes since v1)

 Documentation/kbuild/kconfig-language.rst     |  3 ---
 scripts/kconfig/confdata.c                    |  5 +---
 scripts/kconfig/expr.h                        |  1 -
 scripts/kconfig/gconf.c                       |  2 --
 scripts/kconfig/lexer.l                       |  1 -
 scripts/kconfig/lkc.h                         |  5 ----
 scripts/kconfig/menu.c                        | 12 +++------
 scripts/kconfig/parser.y                      |  9 -------
 scripts/kconfig/tests/choice/Kconfig          | 26 -------------------
 .../tests/choice/allmod_expected_config       |  4 ---
 .../tests/choice/allyes_expected_config       |  4 ---
 .../tests/choice/oldask0_expected_stdout      |  2 --
 scripts/kconfig/tests/choice/oldask1_config   |  1 -
 .../tests/choice/oldask1_expected_stdout      |  6 -----
 14 files changed, 5 insertions(+), 76 deletions(-)

diff --git a/Documentation/kbuild/kconfig-language.rst b/Documentation/kbuild/kconfig-language.rst
index 79ac2e8184f6..555c2f839969 100644
--- a/Documentation/kbuild/kconfig-language.rst
+++ b/Documentation/kbuild/kconfig-language.rst
@@ -410,9 +410,6 @@ to be set to 'm'. This can be used if multiple drivers for a single
 hardware exists and only a single driver can be compiled/loaded into
 the kernel, but all drivers can be compiled as modules.
 
-A choice accepts another option "optional", which allows to set the
-choice to 'n' and no entry needs to be selected.
-
 comment::
 
 	"comment" <prompt>
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index a86e71bab5fa..bcce87658998 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -810,9 +810,6 @@ int conf_write_defconfig(const char *filename)
 			/*
 			 * If symbol is a choice value and equals to the
 			 * default for a choice - skip.
-			 * But only if value is bool and equal to "y" and
-			 * choice is not "optional".
-			 * (If choice is "optional" then all values can be "n")
 			 */
 			if (sym_is_choice_value(sym)) {
 				struct symbol *cs;
@@ -820,7 +817,7 @@ int conf_write_defconfig(const char *filename)
 
 				cs = prop_get_symbol(sym_get_choice_prop(sym));
 				ds = sym_choice_default(cs);
-				if (!sym_is_optional(cs) && sym == ds) {
+				if (sym == ds) {
 					if ((sym->type == S_BOOLEAN) &&
 					    sym_get_tristate_value(sym) == yes)
 						continue;
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 68b3dd65cb08..f646a98de006 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -132,7 +132,6 @@ struct symbol {
 #define SYMBOL_CHECK      0x0008  /* used during dependency checking */
 #define SYMBOL_CHOICEVAL  0x0020  /* used as a value in a choice block */
 #define SYMBOL_VALID      0x0080  /* set when symbol.curr is calculated */
-#define SYMBOL_OPTIONAL   0x0100  /* choice is optional - values can be 'n' */
 #define SYMBOL_WRITE      0x0200  /* write symbol to file (KCONFIG_CONFIG) */
 #define SYMBOL_CHANGED    0x0400  /* ? */
 #define SYMBOL_WRITTEN    0x0800  /* track info to avoid double-write to .config */
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 74f193272a00..13e2449ac83f 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -87,8 +87,6 @@ static const char *dbg_sym_flags(int val)
 		strcat(buf, "choiceval/");
 	if (val & SYMBOL_VALID)
 		strcat(buf, "valid/");
-	if (val & SYMBOL_OPTIONAL)
-		strcat(buf, "optional/");
 	if (val & SYMBOL_WRITE)
 		strcat(buf, "write/");
 	if (val & SYMBOL_CHANGED)
diff --git a/scripts/kconfig/lexer.l b/scripts/kconfig/lexer.l
index 89544c3a1a29..8dd597c4710d 100644
--- a/scripts/kconfig/lexer.l
+++ b/scripts/kconfig/lexer.l
@@ -120,7 +120,6 @@ n	[A-Za-z0-9_-]
 "menuconfig"		return T_MENUCONFIG;
 "modules"		return T_MODULES;
 "on"			return T_ON;
-"optional"		return T_OPTIONAL;
 "prompt"		return T_PROMPT;
 "range"			return T_RANGE;
 "select"		return T_SELECT;
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 5e27432e4939..64dfc354dd5c 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -138,11 +138,6 @@ static inline bool sym_is_choice_value(struct symbol *sym)
 	return sym->flags & SYMBOL_CHOICEVAL ? true : false;
 }
 
-static inline bool sym_is_optional(struct symbol *sym)
-{
-	return sym->flags & SYMBOL_OPTIONAL ? true : false;
-}
-
 static inline bool sym_has_value(struct symbol *sym)
 {
 	return sym->flags & SYMBOL_DEF_USER ? true : false;
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index fe6af8700622..e01b9ee87c05 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -593,15 +593,11 @@ static void _menu_finalize(struct menu *parent, bool inside_choice)
 	}
 
 	/*
-	 * For non-optional choices, add a reverse dependency (corresponding to
-	 * a select) of '<visibility> && m'. This prevents the user from
-	 * setting the choice mode to 'n' when the choice is visible.
-	 *
-	 * This would also work for non-choice symbols, but only non-optional
-	 * choices clear SYMBOL_OPTIONAL as of writing. Choices are implemented
-	 * as a type of symbol.
+	 * For choices, add a reverse dependency (corresponding to a select) of
+	 * '<visibility> && m'. This prevents the user from setting the choice
+	 * mode to 'n' when the choice is visible.
 	 */
-	if (sym && !sym_is_optional(sym) && parent->prompt) {
+	if (sym && sym_is_choice(sym) && parent->prompt) {
 		sym->rev_dep.expr = expr_alloc_or(sym->rev_dep.expr,
 				expr_alloc_and(parent->prompt->visible.expr,
 					expr_alloc_symbol(&symbol_mod)));
diff --git a/scripts/kconfig/parser.y b/scripts/kconfig/parser.y
index b95993ff3837..69dc0c098acb 100644
--- a/scripts/kconfig/parser.y
+++ b/scripts/kconfig/parser.y
@@ -69,7 +69,6 @@ struct menu *current_menu, *current_entry;
 %token T_MODULES
 %token T_ON
 %token T_OPEN_PAREN
-%token T_OPTIONAL
 %token T_PLUS_EQUAL
 %token T_PROMPT
 %token T_RANGE
@@ -140,7 +139,6 @@ stmt_list_in_choice:
 
 config_entry_start: T_CONFIG nonconst_symbol T_EOL
 {
-	$2->flags |= SYMBOL_OPTIONAL;
 	menu_add_entry($2);
 	printd(DEBUG_PARSE, "%s:%d:config %s\n", cur_filename, cur_lineno, $2->name);
 };
@@ -152,7 +150,6 @@ config_stmt: config_entry_start config_option_list
 
 menuconfig_entry_start: T_MENUCONFIG nonconst_symbol T_EOL
 {
-	$2->flags |= SYMBOL_OPTIONAL;
 	menu_add_entry($2);
 	printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", cur_filename, cur_lineno, $2->name);
 };
@@ -272,12 +269,6 @@ choice_option: logic_type prompt_stmt_opt T_EOL
 	printd(DEBUG_PARSE, "%s:%d:type(%u)\n", cur_filename, cur_lineno, $1);
 };
 
-choice_option: T_OPTIONAL T_EOL
-{
-	current_entry->sym->flags |= SYMBOL_OPTIONAL;
-	printd(DEBUG_PARSE, "%s:%d:optional\n", cur_filename, cur_lineno);
-};
-
 choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL
 {
 	menu_add_symbol(P_DEFAULT, $2, $3);
diff --git a/scripts/kconfig/tests/choice/Kconfig b/scripts/kconfig/tests/choice/Kconfig
index 0930eb65e932..8cdda40868a1 100644
--- a/scripts/kconfig/tests/choice/Kconfig
+++ b/scripts/kconfig/tests/choice/Kconfig
@@ -17,19 +17,6 @@ config BOOL_CHOICE1
 
 endchoice
 
-choice
-	prompt "optional boolean choice"
-	optional
-	default OPT_BOOL_CHOICE1
-
-config OPT_BOOL_CHOICE0
-	bool "choice 0"
-
-config OPT_BOOL_CHOICE1
-	bool "choice 1"
-
-endchoice
-
 choice
 	prompt "tristate choice"
 	default TRI_CHOICE1
@@ -41,16 +28,3 @@ config TRI_CHOICE1
 	tristate "choice 1"
 
 endchoice
-
-choice
-	prompt "optional tristate choice"
-	optional
-	default OPT_TRI_CHOICE1
-
-config OPT_TRI_CHOICE0
-	tristate "choice 0"
-
-config OPT_TRI_CHOICE1
-	tristate "choice 1"
-
-endchoice
diff --git a/scripts/kconfig/tests/choice/allmod_expected_config b/scripts/kconfig/tests/choice/allmod_expected_config
index f1f5dcdb7923..d1f51651740c 100644
--- a/scripts/kconfig/tests/choice/allmod_expected_config
+++ b/scripts/kconfig/tests/choice/allmod_expected_config
@@ -1,9 +1,5 @@
 CONFIG_MODULES=y
 # CONFIG_BOOL_CHOICE0 is not set
 CONFIG_BOOL_CHOICE1=y
-# CONFIG_OPT_BOOL_CHOICE0 is not set
-CONFIG_OPT_BOOL_CHOICE1=y
 CONFIG_TRI_CHOICE0=m
 CONFIG_TRI_CHOICE1=m
-CONFIG_OPT_TRI_CHOICE0=m
-CONFIG_OPT_TRI_CHOICE1=m
diff --git a/scripts/kconfig/tests/choice/allyes_expected_config b/scripts/kconfig/tests/choice/allyes_expected_config
index e5a062a1157c..8a76c1816893 100644
--- a/scripts/kconfig/tests/choice/allyes_expected_config
+++ b/scripts/kconfig/tests/choice/allyes_expected_config
@@ -1,9 +1,5 @@
 CONFIG_MODULES=y
 # CONFIG_BOOL_CHOICE0 is not set
 CONFIG_BOOL_CHOICE1=y
-# CONFIG_OPT_BOOL_CHOICE0 is not set
-CONFIG_OPT_BOOL_CHOICE1=y
 # CONFIG_TRI_CHOICE0 is not set
 CONFIG_TRI_CHOICE1=y
-# CONFIG_OPT_TRI_CHOICE0 is not set
-CONFIG_OPT_TRI_CHOICE1=y
diff --git a/scripts/kconfig/tests/choice/oldask0_expected_stdout b/scripts/kconfig/tests/choice/oldask0_expected_stdout
index b251bba9698b..d2257db46423 100644
--- a/scripts/kconfig/tests/choice/oldask0_expected_stdout
+++ b/scripts/kconfig/tests/choice/oldask0_expected_stdout
@@ -3,8 +3,6 @@ boolean choice
   1. choice 0 (BOOL_CHOICE0) (NEW)
 > 2. choice 1 (BOOL_CHOICE1) (NEW)
 choice[1-2?]: 
-optional boolean choice [N/y/?] (NEW) 
 tristate choice [M/y/?] (NEW) 
   choice 0 (TRI_CHOICE0) [N/m/?] (NEW) 
   choice 1 (TRI_CHOICE1) [N/m/?] (NEW) 
-optional tristate choice [N/m/y/?] (NEW) 
diff --git a/scripts/kconfig/tests/choice/oldask1_config b/scripts/kconfig/tests/choice/oldask1_config
index b67bfe3c641f..0f417856c81c 100644
--- a/scripts/kconfig/tests/choice/oldask1_config
+++ b/scripts/kconfig/tests/choice/oldask1_config
@@ -1,2 +1 @@
 # CONFIG_MODULES is not set
-CONFIG_OPT_BOOL_CHOICE0=y
diff --git a/scripts/kconfig/tests/choice/oldask1_expected_stdout b/scripts/kconfig/tests/choice/oldask1_expected_stdout
index c2125e9bf96a..ffa20ad7f38e 100644
--- a/scripts/kconfig/tests/choice/oldask1_expected_stdout
+++ b/scripts/kconfig/tests/choice/oldask1_expected_stdout
@@ -3,13 +3,7 @@ boolean choice
   1. choice 0 (BOOL_CHOICE0) (NEW)
 > 2. choice 1 (BOOL_CHOICE1) (NEW)
 choice[1-2?]: 
-optional boolean choice [Y/n/?] (NEW) 
-optional boolean choice
-> 1. choice 0 (OPT_BOOL_CHOICE0)
-  2. choice 1 (OPT_BOOL_CHOICE1) (NEW)
-choice[1-2?]: 
 tristate choice
   1. choice 0 (TRI_CHOICE0) (NEW)
 > 2. choice 1 (TRI_CHOICE1) (NEW)
 choice[1-2?]: 
-optional tristate choice [N/y/?] 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] sh: Convert the last use of 'optional' property in Kconfig
  2024-04-22 16:41 ` [PATCH v2 1/2] sh: Convert the last use of 'optional' property in Kconfig Masahiro Yamada
@ 2024-04-24  7:14   ` John Paul Adrian Glaubitz
  0 siblings, 0 replies; 6+ messages in thread
From: John Paul Adrian Glaubitz @ 2024-04-24  7:14 UTC (permalink / raw)
  To: Masahiro Yamada, linux-kbuild
  Cc: linux-kernel, Yoshinori Sato, Rich Felker, linux-sh

On Tue, 2024-04-23 at 01:41 +0900, Masahiro Yamada wrote:
> The 'choice' statement is primarily used to exclusively select one
> option, but the 'optional' property allows all entries to be disabled.
> 
> This feature is rarely used. In fact, it is only used in arch/sh/Kconfig
> because the equivalent outcome can be achieved by inserting one more
> entry as a place-holder.
> 
> The 'optional' property support will be removed from Kconfig.
> 
> This commit replaces the 'optional' property with a dummy option,
> CMDLINE_FROM_BOOTLOADER, as seen in some other architectures.
> 
> Note:
>  The 'default CMDLINE_OVERWRITE' statement does not work as intended
>  in combination with 'optional'. If neither CONFIG_CMDLINE_OVERWRITE
>  nor CONFIG_CMDLINE_EXTEND is specified in a defconfig file, both of
>  them are disabled. This is a bug. To maintain the current behavior,
>  I added CONFIG_CMDLINE_FROM_BOOTLOADER=y to those defconfig files.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
> Changes in v2:
>  - Rename CONFIG_CMDLINE_NO_MODIFY to CONFIG_CMDLINE_FROM_BOOTLOADER
>  - Capitalize the first work of the subject
> 
>  arch/sh/Kconfig                           | 6 +++++-
>  arch/sh/configs/apsh4a3a_defconfig        | 1 +
>  arch/sh/configs/apsh4ad0a_defconfig       | 1 +
>  arch/sh/configs/edosk7705_defconfig       | 1 +
>  arch/sh/configs/hp6xx_defconfig           | 1 +
>  arch/sh/configs/landisk_defconfig         | 1 +
>  arch/sh/configs/magicpanelr2_defconfig    | 1 +
>  arch/sh/configs/rsk7264_defconfig         | 1 +
>  arch/sh/configs/rsk7269_defconfig         | 1 +
>  arch/sh/configs/se7619_defconfig          | 1 +
>  arch/sh/configs/se7705_defconfig          | 1 +
>  arch/sh/configs/se7722_defconfig          | 1 +
>  arch/sh/configs/se7750_defconfig          | 1 +
>  arch/sh/configs/secureedge5410_defconfig  | 1 +
>  arch/sh/configs/sh7710voipgw_defconfig    | 1 +
>  arch/sh/configs/sh7724_generic_defconfig  | 1 +
>  arch/sh/configs/sh7770_generic_defconfig  | 1 +
>  arch/sh/configs/sh7785lcr_32bit_defconfig | 1 +
>  arch/sh/configs/sh7785lcr_defconfig       | 1 +
>  arch/sh/configs/urquell_defconfig         | 1 +
>  20 files changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index 2ad3e29f0ebe..8b64ca76aa4b 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -709,7 +709,6 @@ config ROMIMAGE_MMCIF
>  
>  choice
>  	prompt "Kernel command line"
> -	optional
>  	default CMDLINE_OVERWRITE
>  	help
>  	  Setting this option allows the kernel command line arguments
> @@ -727,6 +726,11 @@ config CMDLINE_EXTEND
>  	  Given string will be concatenated with arguments passed in
>  	  by a bootloader.
>  
> +config CMDLINE_FROM_BOOTLOADER
> +	bool "Use bootloader kernel arguments"
> +	help
> +	  Uses the command-line options passed by the boot loader.
> +
>  endchoice
>  
>  config CMDLINE
> diff --git a/arch/sh/configs/apsh4a3a_defconfig b/arch/sh/configs/apsh4a3a_defconfig
> index cc909f347877..9c2644443c4d 100644
> --- a/arch/sh/configs/apsh4a3a_defconfig
> +++ b/arch/sh/configs/apsh4a3a_defconfig
> @@ -15,6 +15,7 @@ CONFIG_MEMORY_START=0x0C000000
>  CONFIG_FLATMEM_MANUAL=y
>  CONFIG_SH_STORE_QUEUES=y
>  CONFIG_SH_APSH4A3A=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_HIGH_RES_TIMERS=y
>  CONFIG_KEXEC=y
>  CONFIG_PREEMPT=y
> diff --git a/arch/sh/configs/apsh4ad0a_defconfig b/arch/sh/configs/apsh4ad0a_defconfig
> index 64558bf60e10..05d21d91f41d 100644
> --- a/arch/sh/configs/apsh4ad0a_defconfig
> +++ b/arch/sh/configs/apsh4ad0a_defconfig
> @@ -42,6 +42,7 @@ CONFIG_SECCOMP=y
>  CONFIG_PREEMPT=y
>  # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
>  CONFIG_BINFMT_MISC=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_PM=y
>  CONFIG_PM_DEBUG=y
>  CONFIG_PM=y
> diff --git a/arch/sh/configs/edosk7705_defconfig b/arch/sh/configs/edosk7705_defconfig
> index 9ee35269bee2..57c79da1ff8e 100644
> --- a/arch/sh/configs/edosk7705_defconfig
> +++ b/arch/sh/configs/edosk7705_defconfig
> @@ -19,6 +19,7 @@
>  CONFIG_CPU_SUBTYPE_SH7705=y
>  CONFIG_SH_EDOSK7705=y
>  CONFIG_SH_PCLK_FREQ=31250000
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  # CONFIG_PREVENT_FIRMWARE_BUILD is not set
>  # CONFIG_INPUT is not set
>  # CONFIG_SERIO is not set
> diff --git a/arch/sh/configs/hp6xx_defconfig b/arch/sh/configs/hp6xx_defconfig
> index 0c45f2a0f9bd..77e3185f63e4 100644
> --- a/arch/sh/configs/hp6xx_defconfig
> +++ b/arch/sh/configs/hp6xx_defconfig
> @@ -15,6 +15,7 @@ CONFIG_SH_DMA_API=y
>  CONFIG_HD64461_ENABLER=y
>  CONFIG_PCCARD=y
>  CONFIG_PM=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_APM_EMULATION=y
>  # CONFIG_STANDALONE is not set
>  CONFIG_BLK_DEV_SD=y
> diff --git a/arch/sh/configs/landisk_defconfig b/arch/sh/configs/landisk_defconfig
> index 541082090918..0311380160f4 100644
> --- a/arch/sh/configs/landisk_defconfig
> +++ b/arch/sh/configs/landisk_defconfig
> @@ -15,6 +15,7 @@ CONFIG_KEXEC=y
>  CONFIG_PCI=y
>  CONFIG_PCCARD=y
>  CONFIG_YENTA=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_NET=y
>  CONFIG_PACKET=y
>  CONFIG_UNIX=y
> diff --git a/arch/sh/configs/magicpanelr2_defconfig b/arch/sh/configs/magicpanelr2_defconfig
> index 52937f9cc2ab..8d443749550e 100644
> --- a/arch/sh/configs/magicpanelr2_defconfig
> +++ b/arch/sh/configs/magicpanelr2_defconfig
> @@ -22,6 +22,7 @@ CONFIG_SH_PCLK_FREQ=24000000
>  CONFIG_SH_DMA=y
>  CONFIG_SH_DMA_API=y
>  CONFIG_HEARTBEAT=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_NET=y
>  CONFIG_PACKET=y
>  CONFIG_UNIX=y
> diff --git a/arch/sh/configs/rsk7264_defconfig b/arch/sh/configs/rsk7264_defconfig
> index a88cb3b77957..e4ef259425c4 100644
> --- a/arch/sh/configs/rsk7264_defconfig
> +++ b/arch/sh/configs/rsk7264_defconfig
> @@ -21,6 +21,7 @@ CONFIG_MEMORY_START=0x0c000000
>  CONFIG_FLATMEM_MANUAL=y
>  CONFIG_CPU_BIG_ENDIAN=y
>  CONFIG_SH_RSK=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  # CONFIG_SH_TIMER_MTU2 is not set
>  CONFIG_BINFMT_FLAT=y
>  CONFIG_NET=y
> diff --git a/arch/sh/configs/rsk7269_defconfig b/arch/sh/configs/rsk7269_defconfig
> index d9a7ce783c9b..e0d1560b2bfd 100644
> --- a/arch/sh/configs/rsk7269_defconfig
> +++ b/arch/sh/configs/rsk7269_defconfig
> @@ -10,6 +10,7 @@ CONFIG_MEMORY_SIZE=0x02000000
>  CONFIG_FLATMEM_MANUAL=y
>  CONFIG_CPU_BIG_ENDIAN=y
>  CONFIG_SH_RSK=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  # CONFIG_SH_TIMER_MTU2 is not set
>  CONFIG_SH_PCLK_FREQ=66700000
>  CONFIG_BINFMT_FLAT=y
> diff --git a/arch/sh/configs/se7619_defconfig b/arch/sh/configs/se7619_defconfig
> index 14d0f5ead502..6b25e9713e77 100644
> --- a/arch/sh/configs/se7619_defconfig
> +++ b/arch/sh/configs/se7619_defconfig
> @@ -14,6 +14,7 @@ CONFIG_FLATMEM_MANUAL=y
>  CONFIG_CPU_BIG_ENDIAN=y
>  CONFIG_SH_7619_SOLUTION_ENGINE=y
>  CONFIG_HZ_100=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_BINFMT_FLAT=y
>  CONFIG_BINFMT_ZFLAT=y
>  # CONFIG_STANDALONE is not set
> diff --git a/arch/sh/configs/se7705_defconfig b/arch/sh/configs/se7705_defconfig
> index 16a0f72f0822..1752ddc2694a 100644
> --- a/arch/sh/configs/se7705_defconfig
> +++ b/arch/sh/configs/se7705_defconfig
> @@ -13,6 +13,7 @@ CONFIG_FLATMEM_MANUAL=y
>  # CONFIG_SH_ADC is not set
>  CONFIG_SH_SOLUTION_ENGINE=y
>  CONFIG_HEARTBEAT=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_PREEMPT=y
>  CONFIG_NET=y
>  CONFIG_PACKET=y
> diff --git a/arch/sh/configs/se7722_defconfig b/arch/sh/configs/se7722_defconfig
> index 09e455817447..5327a2f70980 100644
> --- a/arch/sh/configs/se7722_defconfig
> +++ b/arch/sh/configs/se7722_defconfig
> @@ -17,6 +17,7 @@ CONFIG_SH_7722_SOLUTION_ENGINE=y
>  CONFIG_NO_HZ=y
>  CONFIG_HIGH_RES_TIMERS=y
>  CONFIG_HEARTBEAT=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_KEXEC=y
>  CONFIG_PREEMPT=y
>  CONFIG_NET=y
> diff --git a/arch/sh/configs/se7750_defconfig b/arch/sh/configs/se7750_defconfig
> index 5fa6239ae4ea..a1e25d7de8a6 100644
> --- a/arch/sh/configs/se7750_defconfig
> +++ b/arch/sh/configs/se7750_defconfig
> @@ -15,6 +15,7 @@ CONFIG_FLATMEM_MANUAL=y
>  CONFIG_SH_SOLUTION_ENGINE=y
>  CONFIG_SH_PCLK_FREQ=33333333
>  CONFIG_HEARTBEAT=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_NET=y
>  CONFIG_PACKET=y
>  CONFIG_UNIX=y
> diff --git a/arch/sh/configs/secureedge5410_defconfig b/arch/sh/configs/secureedge5410_defconfig
> index 120176afe3f6..2f77b60e9540 100644
> --- a/arch/sh/configs/secureedge5410_defconfig
> +++ b/arch/sh/configs/secureedge5410_defconfig
> @@ -10,6 +10,7 @@ CONFIG_SH_SECUREEDGE5410=y
>  CONFIG_SH_DMA=y
>  CONFIG_SH_DMA_API=y
>  CONFIG_PCI=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_NET=y
>  CONFIG_INET=y
>  # CONFIG_INET_XFRM_MODE_TRANSPORT is not set
> diff --git a/arch/sh/configs/sh7710voipgw_defconfig b/arch/sh/configs/sh7710voipgw_defconfig
> index 7f742729df69..99a5d0760532 100644
> --- a/arch/sh/configs/sh7710voipgw_defconfig
> +++ b/arch/sh/configs/sh7710voipgw_defconfig
> @@ -15,6 +15,7 @@ CONFIG_MEMORY_SIZE=0x00800000
>  CONFIG_FLATMEM_MANUAL=y
>  # CONFIG_SH_ADC is not set
>  CONFIG_SH_PCLK_FREQ=32768000
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_NET=y
>  CONFIG_PACKET=y
>  CONFIG_UNIX=y
> diff --git a/arch/sh/configs/sh7724_generic_defconfig b/arch/sh/configs/sh7724_generic_defconfig
> index cbc9389a89a8..5440bd0ca4ed 100644
> --- a/arch/sh/configs/sh7724_generic_defconfig
> +++ b/arch/sh/configs/sh7724_generic_defconfig
> @@ -12,6 +12,7 @@ CONFIG_CPU_FREQ=y
>  CONFIG_SH_CPU_FREQ=y
>  CONFIG_KEXEC=y
>  CONFIG_KEXEC_JUMP=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_HIBERNATION=y
>  CONFIG_CPU_IDLE=y
>  # CONFIG_PREVENT_FIRMWARE_BUILD is not set
> diff --git a/arch/sh/configs/sh7770_generic_defconfig b/arch/sh/configs/sh7770_generic_defconfig
> index ee2357deba0f..4338af8d02d0 100644
> --- a/arch/sh/configs/sh7770_generic_defconfig
> +++ b/arch/sh/configs/sh7770_generic_defconfig
> @@ -14,6 +14,7 @@ CONFIG_SH_CPU_FREQ=y
>  CONFIG_KEXEC=y
>  CONFIG_KEXEC_JUMP=y
>  CONFIG_PM=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_HIBERNATION=y
>  CONFIG_CPU_IDLE=y
>  # CONFIG_PREVENT_FIRMWARE_BUILD is not set
> diff --git a/arch/sh/configs/sh7785lcr_32bit_defconfig b/arch/sh/configs/sh7785lcr_32bit_defconfig
> index 59262f42abe6..44f9b2317f09 100644
> --- a/arch/sh/configs/sh7785lcr_32bit_defconfig
> +++ b/arch/sh/configs/sh7785lcr_32bit_defconfig
> @@ -32,6 +32,7 @@ CONFIG_PREEMPT=y
>  CONFIG_INTC_USERIMASK=y
>  CONFIG_PCI=y
>  CONFIG_PCI_DEBUG=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_PM=y
>  CONFIG_CPU_IDLE=y
>  CONFIG_NET=y
> diff --git a/arch/sh/configs/sh7785lcr_defconfig b/arch/sh/configs/sh7785lcr_defconfig
> index 94381f8268ff..aec74b0e7003 100644
> --- a/arch/sh/configs/sh7785lcr_defconfig
> +++ b/arch/sh/configs/sh7785lcr_defconfig
> @@ -17,6 +17,7 @@ CONFIG_HEARTBEAT=y
>  CONFIG_KEXEC=y
>  CONFIG_PREEMPT=y
>  CONFIG_PCI=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_NET=y
>  CONFIG_PACKET=y
>  CONFIG_UNIX=y
> diff --git a/arch/sh/configs/urquell_defconfig b/arch/sh/configs/urquell_defconfig
> index 445bb451a5ec..00ef62133b04 100644
> --- a/arch/sh/configs/urquell_defconfig
> +++ b/arch/sh/configs/urquell_defconfig
> @@ -34,6 +34,7 @@ CONFIG_PCIEPORTBUS=y
>  CONFIG_PCIEASPM_DEBUG=y
>  CONFIG_PCI_DEBUG=y
>  CONFIG_BINFMT_MISC=y
> +CONFIG_CMDLINE_FROM_BOOTLOADER=y
>  CONFIG_PM=y
>  CONFIG_CPU_IDLE=y
>  CONFIG_NET=y

Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] kconfig: remove 'optional' property support
  2024-04-22 16:41 ` [PATCH v2 2/2] kconfig: remove 'optional' property support Masahiro Yamada
@ 2024-04-24 12:24   ` Nicolas Schier
  2024-04-26 15:04     ` Masahiro Yamada
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Schier @ 2024-04-24 12:24 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, linux-kernel, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, linux-sh, Jonathan Corbet,
	Nathan Chancellor, linux-doc

On Tue, Apr 23, 2024 at 01:41:04AM +0900, Masahiro Yamada wrote:
> The 'choice' statement is primarily used to exclusively select one
> option, but the 'optional' property allows all entries to be disabled.
> 
> In the following example, both A and B can be disabled simultaneously:
> 
>     choice
>             prompt "choose A, B, or nothing"
>             optional
> 
>     config A
>             bool "A"
> 
>     config B
>             bool "B"
> 
>     endchoice
> 
> You can achieve the equivalent outcome by other means.
> 
> A common solution is to add another option to guard the choice block.
> In the following example, you can set ENABLE_A_B_CHOICE=n to disable
> the entire choice block:
> 
>     choice
>             prompt "choose A or B"
>             depends on ENABLE_A_B_CHOICE
> 
>     config A
>             bool "A"
> 
>     config B
>             bool "B"
> 
>     endchoice
> 
> Another approach is to insert one more entry as a place-holder:
> 
>     choice
>             prompt "choose A, B, or disable both"
> 
>     config A
>             bool "A"
> 
>     config B
>             bool "B"
> 
>     config DISABLE_A_AND_B
>             bool "choose this to disable both A and B"
> 
>     endchoice
> 
> Some real examples are DEBUG_INFO_NONE, INITRAMFS_COMPRESSION_NONE,
> LTO_NONE, etc.
> 
> The 'optional' property is even more unnecessary for a tristate choice.
> 
> Without the 'optional' property, you can disable A and B; you can set
> 'm' in the choice prompt, and disable A and B individually:
> 
>     choice
>             prompt "choose one built-in or make them modular"
> 
>     config A
>             tristate "A"
> 
>     config B
>             tristate "B"
> 
>     endchoice
> 
> In conclusion, the 'optional' property was unneeded.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
> (no changes since v1)

thanks for the patch!

I found just one small remnant that probably should be removed as well:

diff --git a/scripts/kconfig/tests/choice/__init__.py b/scripts/kconfig/tests/choice/__init__.py
index 4318fce05912f..05e162220085c 100644
--- a/scripts/kconfig/tests/choice/__init__.py
+++ b/scripts/kconfig/tests/choice/__init__.py
@@ -8,4 +8,2 @@ The behavior of 'y' choice is intuitive.  If choice values are tristate,
 the choice can be 'm' where each value can be enabled independently.
-Also, if a choice is marked as 'optional', the whole choice can be
-invisible.
 """

Reviewed-by: Nicolas Schier <n.schier@avm.de>

Kind regards,
Nicolas


PS: For other reviewers, this patch (set) depends on
https://lore.kernel.org/linux-kbuild/20240422161054.2867285-1-masahiroy@kernel.org/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] kconfig: remove 'optional' property support
  2024-04-24 12:24   ` Nicolas Schier
@ 2024-04-26 15:04     ` Masahiro Yamada
  0 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2024-04-26 15:04 UTC (permalink / raw)
  To: Nicolas Schier
  Cc: linux-kbuild, linux-kernel, Yoshinori Sato, Rich Felker,
	John Paul Adrian Glaubitz, linux-sh, Jonathan Corbet,
	Nathan Chancellor, linux-doc

On Wed, Apr 24, 2024 at 9:24 PM Nicolas Schier <n.schier@avm.de> wrote:
>
> On Tue, Apr 23, 2024 at 01:41:04AM +0900, Masahiro Yamada wrote:
> > The 'choice' statement is primarily used to exclusively select one
> > option, but the 'optional' property allows all entries to be disabled.
> >
> > In the following example, both A and B can be disabled simultaneously:
> >
> >     choice
> >             prompt "choose A, B, or nothing"
> >             optional
> >
> >     config A
> >             bool "A"
> >
> >     config B
> >             bool "B"
> >
> >     endchoice
> >
> > You can achieve the equivalent outcome by other means.
> >
> > A common solution is to add another option to guard the choice block.
> > In the following example, you can set ENABLE_A_B_CHOICE=n to disable
> > the entire choice block:
> >
> >     choice
> >             prompt "choose A or B"
> >             depends on ENABLE_A_B_CHOICE
> >
> >     config A
> >             bool "A"
> >
> >     config B
> >             bool "B"
> >
> >     endchoice
> >
> > Another approach is to insert one more entry as a place-holder:
> >
> >     choice
> >             prompt "choose A, B, or disable both"
> >
> >     config A
> >             bool "A"
> >
> >     config B
> >             bool "B"
> >
> >     config DISABLE_A_AND_B
> >             bool "choose this to disable both A and B"
> >
> >     endchoice
> >
> > Some real examples are DEBUG_INFO_NONE, INITRAMFS_COMPRESSION_NONE,
> > LTO_NONE, etc.
> >
> > The 'optional' property is even more unnecessary for a tristate choice.
> >
> > Without the 'optional' property, you can disable A and B; you can set
> > 'm' in the choice prompt, and disable A and B individually:
> >
> >     choice
> >             prompt "choose one built-in or make them modular"
> >
> >     config A
> >             tristate "A"
> >
> >     config B
> >             tristate "B"
> >
> >     endchoice
> >
> > In conclusion, the 'optional' property was unneeded.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> >
> > (no changes since v1)
>
> thanks for the patch!
>
> I found just one small remnant that probably should be removed as well:
>
> diff --git a/scripts/kconfig/tests/choice/__init__.py b/scripts/kconfig/tests/choice/__init__.py
> index 4318fce05912f..05e162220085c 100644
> --- a/scripts/kconfig/tests/choice/__init__.py
> +++ b/scripts/kconfig/tests/choice/__init__.py
> @@ -8,4 +8,2 @@ The behavior of 'y' choice is intuitive.  If choice values are tristate,
>  the choice can be 'm' where each value can be enabled independently.
> -Also, if a choice is marked as 'optional', the whole choice can be
> -invisible.
>  """


Thanks. I will fold this.




>
> Reviewed-by: Nicolas Schier <n.schier@avm.de>
>
> Kind regards,
> Nicolas
>
>
> PS: For other reviewers, this patch (set) depends on
> https://lore.kernel.org/linux-kbuild/20240422161054.2867285-1-masahiroy@kernel.org/



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-26 15:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-22 16:41 [PATCH v2 0/2] kconfig: remove unneeded 'optional' property support Masahiro Yamada
2024-04-22 16:41 ` [PATCH v2 1/2] sh: Convert the last use of 'optional' property in Kconfig Masahiro Yamada
2024-04-24  7:14   ` John Paul Adrian Glaubitz
2024-04-22 16:41 ` [PATCH v2 2/2] kconfig: remove 'optional' property support Masahiro Yamada
2024-04-24 12:24   ` Nicolas Schier
2024-04-26 15:04     ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).