diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2024-04-23 01:41:04 +0900 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2024-05-02 19:48:26 +0900 |
commit | 6a1215888e23aa9fbc514086402f04708c84f454 (patch) | |
tree | 354f1463af09a8daa3dd80b459265148f183a414 /scripts/kconfig/expr.h | |
parent | d9a1dab65aa2d4de7244731c97c70491997225f2 (diff) |
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>
Diffstat (limited to 'scripts/kconfig/expr.h')
-rw-r--r-- | scripts/kconfig/expr.h | 1 |
1 files changed, 0 insertions, 1 deletions
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 */ |