Re: [TRIVIAL RFC PATCH] Kconfigs - reduce use of "depends on EXPERT"

From: Masahiro Yamada
Date: Thu Aug 02 2018 - 12:04:54 EST


2018-07-29 7:13 GMT+09:00 Joe Perches <joe@xxxxxxxxxxx>:
> Most uses of EXPERT are in the form
>
> bool "something" if EXPERT
>
> but some are
>
> depends on EXPERT
>
> The difference is the the 'depends on' use makes it
> easier to select the CONFIG_EXPERT option.


I could not understand why
'if EXPERT' is preferred to 'depends on EXPERT'



'depends on EXPERT' hides the symbol.
'<prompt> if EXPERT' keeps the symbol visible,
but forbid users from changing the value.

Both have appropriate usage.





> $ git grep "if EXPERT" -- "*/Kconfig*" | wc -l
> 155
> $ git grep "depends on.*EXPERT" -- "*/Kconfig*" | wc -l
> 26
>
> Some of the 'depends on' uses with EXPERT are more menus
> or complex logic with || and can not easily be modified,
> but it's perhaps reasonable to modify the simpler ones
> to the "if EXPERT" form.
> ---
> arch/x86/Kconfig.debug | 3 +--
> drivers/char/Kconfig | 4 ++--
> drivers/gpu/drm/i915/Kconfig.debug | 3 +--
> drivers/gpu/drm/msm/Kconfig | 4 ++--
> drivers/net/wireless/intel/iwlwifi/Kconfig | 4 ++--
> drivers/ssb/Kconfig | 4 ++--
> drivers/video/fbdev/Kconfig | 4 ++--
> init/Kconfig | 10 ++++------
> kernel/power/Kconfig | 7 +++----
> net/wireless/Kconfig | 3 +--
> security/Kconfig | 3 +--
> 11 files changed, 21 insertions(+), 28 deletions(-)
>
> diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
> index c6dd1d980081..f175c00c3786 100644
> --- a/arch/x86/Kconfig.debug
> +++ b/arch/x86/Kconfig.debug
> @@ -393,8 +393,7 @@ config UNWINDER_FRAME_POINTER
> reliable stack trace (CONFIG_HAVE_RELIABLE_STACKTRACE).
>
> config UNWINDER_GUESS
> - bool "Guess unwinder"
> - depends on EXPERT
> + bool "Guess unwinder" if EXPERT
> depends on !STACKDEPOT
> ---help---
> This option enables the "guess" unwinder for unwinding kernel stack
> diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
> index ce277ee0a28a..c1c231a32521 100644
> --- a/drivers/char/Kconfig
> +++ b/drivers/char/Kconfig
> @@ -52,8 +52,8 @@ source "drivers/tty/serial/Kconfig"
> source "drivers/tty/serdev/Kconfig"
>
> config TTY_PRINTK
> - tristate "TTY driver to output user messages via printk"
> - depends on EXPERT && TTY
> + tristate "TTY driver to output user messages via printk" if EXPERT
> + depends on TTY
> default n
> ---help---
> If you say Y here, the support for writing user messages (i.e.
> diff --git a/drivers/gpu/drm/i915/Kconfig.debug b/drivers/gpu/drm/i915/Kconfig.debug
> index 459f8f88a34c..cbf61c0d3917 100644
> --- a/drivers/gpu/drm/i915/Kconfig.debug
> +++ b/drivers/gpu/drm/i915/Kconfig.debug
> @@ -1,8 +1,7 @@
> config DRM_I915_WERROR
> - bool "Force GCC to throw an error instead of a warning when compiling"
> + bool "Force GCC to throw an error instead of a warning when compiling" if EXPERT
> # As this may inadvertently break the build, only allow the user
> # to shoot oneself in the foot iff they aim really hard
> - depends on EXPERT
> # We use the dependency on !COMPILE_TEST to not be enabled in
> # allmodconfig or allyesconfig configurations
> depends on !COMPILE_TEST
> diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
> index 843a9d40c05e..4fe57693005f 100644
> --- a/drivers/gpu/drm/msm/Kconfig
> +++ b/drivers/gpu/drm/msm/Kconfig
> @@ -30,8 +30,8 @@ config DRM_MSM_REGISTER_LOGGING
> logging can be switched on via msm.reglog=y module param.
>
> config DRM_MSM_GPU_SUDO
> - bool "Enable SUDO flag on submits"
> - depends on DRM_MSM && EXPERT
> + bool "Enable SUDO flag on submits" if EXPERT
> + depends on DRM_MSM
> default n
> help
> Enable userspace that has CAP_SYS_RAWIO to submit GPU commands
> diff --git a/drivers/net/wireless/intel/iwlwifi/Kconfig b/drivers/net/wireless/intel/iwlwifi/Kconfig
> index e5a2fc738ac3..d82d0bdd837e 100644
> --- a/drivers/net/wireless/intel/iwlwifi/Kconfig
> +++ b/drivers/net/wireless/intel/iwlwifi/Kconfig
> @@ -89,8 +89,8 @@ config IWLWIFI_BCAST_FILTERING
> expect incoming broadcasts for their normal operations.
>
> config IWLWIFI_PCIE_RTPM
> - bool "Enable runtime power management mode for PCIe devices"
> - depends on IWLMVM && PM && EXPERT
> + bool "Enable runtime power management mode for PCIe devices" if EXPERT
> + depends on IWLMVM && PM
> help
> Say Y here to enable runtime power management for PCIe
> devices. If enabled, the device will go into low power mode
> diff --git a/drivers/ssb/Kconfig b/drivers/ssb/Kconfig
> index c574dd210500..e6036784c260 100644
> --- a/drivers/ssb/Kconfig
> +++ b/drivers/ssb/Kconfig
> @@ -90,8 +90,8 @@ config SSB_HOST_SOC
> If unsure, say N
>
> config SSB_SILENT
> - bool "No SSB kernel messages"
> - depends on SSB && EXPERT
> + bool "No SSB kernel messages" if EXPERT
> + depends on SSB
> help
> This option turns off all Sonics Silicon Backplane printks.
> Note that you won't be able to identify problems, once
> diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
> index 591a13a59787..371c6c6ac414 100644
> --- a/drivers/video/fbdev/Kconfig
> +++ b/drivers/video/fbdev/Kconfig
> @@ -1076,8 +1076,8 @@ config FB_CARILLO_RANCH
> This driver supports the LE80578 (Carillo Ranch) board
>
> config FB_INTEL
> - tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support"
> - depends on FB && PCI && X86 && AGP_INTEL && EXPERT
> + tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support" if EXPERT
> + depends on FB && PCI && X86 && AGP_INTEL
> select FB_MODE_HELPERS
> select FB_CFB_FILLRECT
> select FB_CFB_COPYAREA
> diff --git a/init/Kconfig b/init/Kconfig
> index 3f44cae1f88c..fe17a3261a8f 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -1086,9 +1086,8 @@ config HAVE_LD_DEAD_CODE_DATA_ELIMINATION
> is used to distinguish them from label names / C identifiers.
>
> config LD_DEAD_CODE_DATA_ELIMINATION
> - bool "Dead code and data elimination (EXPERIMENTAL)"
> + bool "Dead code and data elimination (EXPERIMENTAL)" if EXPERT
> depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION
> - depends on EXPERT
> help
> Enable this if you want to do dead code and data elimination with
> the linker by compiling with -ffunction-sections -fdata-sections,
> @@ -1626,8 +1625,7 @@ config SLUB
> a slab allocator.
>
> config SLOB
> - depends on EXPERT
> - bool "SLOB (Simple Allocator)"
> + bool "SLOB (Simple Allocator)" if EXPERT
> help
> SLOB replaces the stock allocator with a drastically simpler
> allocator. SLOB is generally more space efficient but
> @@ -1679,8 +1677,8 @@ config SLUB_CPU_PARTIAL
> Typically one would choose no for a realtime system.
>
> config MMAP_ALLOW_UNINITIALIZED
> - bool "Allow mmapped anonymous memory to be uninitialized"
> - depends on EXPERT && !MMU
> + bool "Allow mmapped anonymous memory to be uninitialized" if EXPERT
> + depends on !MMU
> default n
> help
> Normally, and according to the Linux spec, anonymous memory obtained
> diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
> index e880ca22c5a5..d684fcdeaa89 100644
> --- a/kernel/power/Kconfig
> +++ b/kernel/power/Kconfig
> @@ -19,9 +19,8 @@ config SUSPEND_FREEZER
> Turning OFF this setting is NOT recommended! If in doubt, say Y.
>
> config SUSPEND_SKIP_SYNC
> - bool "Skip kernel's sys_sync() on suspend to RAM/standby"
> + bool "Skip kernel's sys_sync() on suspend to RAM/standby" if EXPERT
> depends on SUSPEND
> - depends on EXPERT
> help
> Skip the kernel sys_sync() before freezing user processes.
> Some systems prefer not to pay this cost on every invocation
> @@ -185,8 +184,8 @@ config PM_SLEEP_DEBUG
> depends on PM_DEBUG && PM_SLEEP
>
> config DPM_WATCHDOG
> - bool "Device suspend/resume watchdog"
> - depends on PM_DEBUG && PSTORE && EXPERT
> + bool "Device suspend/resume watchdog" if EXPERT
> + depends on PM_DEBUG && PSTORE
> ---help---
> Sets up a watchdog timer to capture drivers that are
> locked up attempting to suspend/resume a device.
> diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
> index 41722046b937..50bcd75cc881 100644
> --- a/net/wireless/Kconfig
> +++ b/net/wireless/Kconfig
> @@ -67,8 +67,7 @@ config CFG80211_DEVELOPER_WARNINGS
>
>
> config CFG80211_CERTIFICATION_ONUS
> - bool "cfg80211 certification onus"
> - depends on EXPERT
> + bool "cfg80211 certification onus" if EXPERT
> default n
> ---help---
> You should disable this option unless you are both capable
> diff --git a/security/Kconfig b/security/Kconfig
> index afa91c6f06bb..b017771a3012 100644
> --- a/security/Kconfig
> +++ b/security/Kconfig
> @@ -179,9 +179,8 @@ config HARDENED_USERCOPY_FALLBACK
> this setting.
>
> config HARDENED_USERCOPY_PAGESPAN
> - bool "Refuse to copy allocations that span multiple pages"
> + bool "Refuse to copy allocations that span multiple pages" if EXPERT
> depends on HARDENED_USERCOPY
> - depends on EXPERT
> help
> When a multi-page allocation is done without __GFP_COMP,
> hardened usercopy will reject attempts to copy it. There are,
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html



--
Best Regards
Masahiro Yamada