linux/Documentation/kbuild
Masahiro Yamada 6a1215888e kconfig: remove 'optional' property support
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:

    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>
Reviewed-by: Nicolas Schier <n.schier@avm.de>
2024-05-02 19:48:26 +09:00
..
gcc-plugins.rst docs/core-api: expand Fedora instructions for GCC plugins 2022-09-27 13:21:44 -06:00
headers_install.rst Kbuild updates for v5.3 2019-07-12 16:03:16 -07:00
index.rst Kbuild updates for v5.7 2020-03-31 16:03:39 -07:00
issues.rst docs: kbuild: fix build with pdf and fix some minor issues 2019-07-15 11:03:04 -03:00
kbuild.rst docs: kbuild: add INSTALL_DTBS_PATH 2023-10-18 17:16:09 +09:00
kconfig-language.rst kconfig: remove 'optional' property support 2024-05-02 19:48:26 +09:00
kconfig-macro-language.rst kconfig: doc: fix $(fileno) to $(filename) 2020-12-21 16:01:44 +09:00
Kconfig.recursion-issue-01 docs: kconfig: Fix grammar and formatting 2024-02-15 06:55:47 +09:00
Kconfig.recursion-issue-02 docs: use the lore redirector everywhere 2021-10-12 13:58:19 -06:00
kconfig.rst docs: kbuild/kconfig: reformat/cleanup 2024-02-19 18:20:39 +09:00
Kconfig.select-break kbuild: document recursive dependency limitation / resolution 2015-10-08 15:36:16 +02:00
llvm.rst Documentation/llvm: Note s390 LLVM=1 support with LLVM 18.1.0 and newer 2024-03-31 21:09:50 +09:00
makefiles.rst Kbuild updates for v6.7 2023-11-04 08:07:19 -10:00
modules.rst kbuild: doc: replace arch/$(ARCH)/ with arch/$(SRCARCH)/ 2020-12-21 13:56:58 +09:00
reproducible-builds.rst Documentation: kbuild: Add description of git for reproducible builds 2022-10-28 00:16:29 +09:00