From: Nicolas Schier <n.schier@avm.de>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
Yoshinori Sato <ysato@users.sourceforge.jp>,
Rich Felker <dalias@libc.org>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
linux-sh@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
Nathan Chancellor <nathan@kernel.org>,
linux-doc@vger.kernel.org
Subject: Re: [PATCH v2 2/2] kconfig: remove 'optional' property support
Date: Wed, 24 Apr 2024 14:24:03 +0200 [thread overview]
Message-ID: <Zij545f6JVmmbcoj@buildd.core.avm.de> (raw)
In-Reply-To: <20240422164104.2869507-3-masahiroy@kernel.org>
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/
next prev parent reply other threads:[~2024-04-24 12:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-22 16:41 [PATCH v2 0/2] kconfig: remove unneeded 'optional' property support Masahiro Yamada
2024-04-22 16:41 ` [PATCH v2 2/2] kconfig: remove " Masahiro Yamada
2024-04-24 12:24 ` Nicolas Schier [this message]
2024-04-26 15:04 ` Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zij545f6JVmmbcoj@buildd.core.avm.de \
--to=n.schier@avm.de \
--cc=corbet@lwn.net \
--cc=dalias@libc.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).