Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <masahiroy@kernel.org>

+16 -8
+4 -2
arch/arm/Kconfig
··· 1482 1482 from the ATAG list and store it at run time into the appended DTB. 1483 1483 1484 1484 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 1486 1487 default ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER 1487 1488 1488 1489 config ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER ··· 1512 1511 memory size and the root device (e.g., mem=64M root=/dev/nfs). 1513 1512 1514 1513 choice 1515 - prompt "Kernel command line type" if CMDLINE != "" 1514 + prompt "Kernel command line type" 1515 + depends on CMDLINE != "" 1516 1516 default CMDLINE_FROM_BOOTLOADER 1517 1517 1518 1518 config CMDLINE_FROM_BOOTLOADER
+2 -1
arch/arm64/Kconfig
··· 2302 2302 root device (e.g. root=/dev/nfs). 2303 2303 2304 2304 choice 2305 - prompt "Kernel command line type" if CMDLINE != "" 2305 + prompt "Kernel command line type" 2306 + depends on CMDLINE != "" 2306 2307 default CMDLINE_FROM_BOOTLOADER 2307 2308 help 2308 2309 Choose how the kernel will handle the provided default kernel
+4 -2
arch/mips/Kconfig
··· 2924 2924 bool 2925 2925 2926 2926 choice 2927 - prompt "Kernel appended dtb support" if USE_OF 2927 + prompt "Kernel appended dtb support" 2928 + depends on USE_OF 2928 2929 default MIPS_NO_APPENDED_DTB 2929 2930 2930 2931 config MIPS_NO_APPENDED_DTB ··· 2966 2965 endchoice 2967 2966 2968 2967 choice 2969 - prompt "Kernel command line type" if !CMDLINE_OVERRIDE 2968 + prompt "Kernel command line type" 2969 + depends on !CMDLINE_OVERRIDE 2970 2970 default MIPS_CMDLINE_FROM_DTB if USE_OF && !ATH79 && !MACH_INGENIC && \ 2971 2971 !MACH_LOONGSON64 && !MIPS_MALTA && \ 2972 2972 !CAVIUM_OCTEON_SOC
+2 -1
arch/powerpc/Kconfig
··· 965 965 most cases you will need to specify the root device here. 966 966 967 967 choice 968 - prompt "Kernel command line type" if CMDLINE != "" 968 + prompt "Kernel command line type" 969 + depends on CMDLINE != "" 969 970 default CMDLINE_FROM_BOOTLOADER 970 971 971 972 config CMDLINE_FROM_BOOTLOADER
+2 -1
arch/riscv/Kconfig
··· 914 914 line here and choose how the kernel should use it later on. 915 915 916 916 choice 917 - prompt "Built-in command line usage" if CMDLINE != "" 917 + prompt "Built-in command line usage" 918 + depends on CMDLINE != "" 918 919 default CMDLINE_FALLBACK 919 920 help 920 921 Choose how the kernel will handle the provided built-in command
+2 -1
fs/jffs2/Kconfig
··· 151 151 RUBINMIPS and DYNRUBIN compressors. Say 'N' if unsure. 152 152 153 153 choice 154 - prompt "JFFS2 default compression mode" if JFFS2_COMPRESSION_OPTIONS 154 + prompt "JFFS2 default compression mode" 155 155 default JFFS2_CMODE_PRIORITY 156 + depends on JFFS2_COMPRESSION_OPTIONS 156 157 depends on JFFS2_FS 157 158 help 158 159 You can set here the default compression mode of JFFS2 from