Skip to content

Commit b9d7321

Browse files
committed
treewide: change conditional prompt for choices to 'depends on'
While Documentation/kbuild/kconfig-language.rst provides a brief explanation, there are recurring confusions regarding the usage of a prompt followed by 'if <expr>'. This conditional controls _only_ the prompt. A typical usage is as follows: menuconfig BLOCK bool "Enable the block layer" if EXPERT default y When EXPERT=n, the prompt is hidden, but this config entry is still active, and BLOCK is set to its default value 'y'. This is reasonable because you are likely want to enable the block device support. When EXPERT=y, the prompt is shown, allowing you to toggle BLOCK. Please note that it is different from 'depends on EXPERT', which would enable and disable the entire config entry. However, this conditional prompt has never worked in a choice block. The following two work in the same way: when EXPERT is disabled, the choice block is entirely disabled. [Test Code 1] choice prompt "choose" if EXPERT config A bool "A" config B bool "B" endchoice [Test Code 2] choice prompt "choose" depends on EXPERT config A bool "A" config B bool "B" endchoice I believe the first case should hide only the prompt, producing the default: CONFIG_A=y # CONFIG_B is not set The next commit will change (fix) the behavior of the conditional prompt in choice blocks. I see several choice blocks wrongly using a conditional prompt, where 'depends on' makes more sense. To preserve the current behavior, this commit converts such misuses. I did not touch the following entry in arch/x86/Kconfig: choice prompt "Memory split" if EXPERT default VMSPLIT_3G This is truly the correct use of the conditional prompt; when EXPERT=n, this choice block should silently select the reasonable VMSPLIT_3G, although the resulting PAGE_OFFSET will not be affected anyway. Presumably, the one in fs/jffs2/Kconfig is also correct, but I converted it to 'depends on' to avoid any potential behavioral change. Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 7c9bb07 commit b9d7321

File tree

6 files changed

+16
-8
lines changed

6 files changed

+16
-8
lines changed

arch/arm/Kconfig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,8 @@ config ARM_ATAG_DTB_COMPAT
14821482
from the ATAG list and store it at run time into the appended DTB.
14831483

14841484
choice
1485-
prompt "Kernel command line type" if ARM_ATAG_DTB_COMPAT
1485+
prompt "Kernel command line type"
1486+
depends on ARM_ATAG_DTB_COMPAT
14861487
default ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER
14871488

14881489
config ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER
@@ -1511,7 +1512,8 @@ config CMDLINE
15111512
memory size and the root device (e.g., mem=64M root=/dev/nfs).
15121513

15131514
choice
1514-
prompt "Kernel command line type" if CMDLINE != ""
1515+
prompt "Kernel command line type"
1516+
depends on CMDLINE != ""
15151517
default CMDLINE_FROM_BOOTLOADER
15161518

15171519
config CMDLINE_FROM_BOOTLOADER

arch/arm64/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2302,7 +2302,8 @@ config CMDLINE
23022302
root device (e.g. root=/dev/nfs).
23032303

23042304
choice
2305-
prompt "Kernel command line type" if CMDLINE != ""
2305+
prompt "Kernel command line type"
2306+
depends on CMDLINE != ""
23062307
default CMDLINE_FROM_BOOTLOADER
23072308
help
23082309
Choose how the kernel will handle the provided default kernel

arch/mips/Kconfig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2924,7 +2924,8 @@ config BUILTIN_DTB
29242924
bool
29252925

29262926
choice
2927-
prompt "Kernel appended dtb support" if USE_OF
2927+
prompt "Kernel appended dtb support"
2928+
depends on USE_OF
29282929
default MIPS_NO_APPENDED_DTB
29292930

29302931
config MIPS_NO_APPENDED_DTB
@@ -2965,7 +2966,8 @@ choice
29652966
endchoice
29662967

29672968
choice
2968-
prompt "Kernel command line type" if !CMDLINE_OVERRIDE
2969+
prompt "Kernel command line type"
2970+
depends on !CMDLINE_OVERRIDE
29692971
default MIPS_CMDLINE_FROM_DTB if USE_OF && !ATH79 && !MACH_INGENIC && \
29702972
!MACH_LOONGSON64 && !MIPS_MALTA && \
29712973
!CAVIUM_OCTEON_SOC

arch/powerpc/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,8 @@ config CMDLINE
965965
most cases you will need to specify the root device here.
966966

967967
choice
968-
prompt "Kernel command line type" if CMDLINE != ""
968+
prompt "Kernel command line type"
969+
depends on CMDLINE != ""
969970
default CMDLINE_FROM_BOOTLOADER
970971

971972
config CMDLINE_FROM_BOOTLOADER

arch/riscv/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,8 @@ config CMDLINE
914914
line here and choose how the kernel should use it later on.
915915

916916
choice
917-
prompt "Built-in command line usage" if CMDLINE != ""
917+
prompt "Built-in command line usage"
918+
depends on CMDLINE != ""
918919
default CMDLINE_FALLBACK
919920
help
920921
Choose how the kernel will handle the provided built-in command

fs/jffs2/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,9 @@ config JFFS2_RUBIN
151151
RUBINMIPS and DYNRUBIN compressors. Say 'N' if unsure.
152152

153153
choice
154-
prompt "JFFS2 default compression mode" if JFFS2_COMPRESSION_OPTIONS
154+
prompt "JFFS2 default compression mode"
155155
default JFFS2_CMODE_PRIORITY
156+
depends on JFFS2_COMPRESSION_OPTIONS
156157
depends on JFFS2_FS
157158
help
158159
You can set here the default compression mode of JFFS2 from

0 commit comments

Comments
 (0)