kconfig: Replace some single-symbol 'if's with 'depends on'

I think people might be reading differences into 'if' and 'depends on'
that aren't there, like maybe 'if' being needed to "hide" a symbol,
while 'depends on' just adds a dependency.

There are no differences between 'if' and 'depends on'. 'if' is just a
shorthand for 'depends on'. They work the same when it comes to creating
implicit menus too.

The way symbols get "hidden" is through their dependencies not being
satisfied ('if'/'depends on' get copied up as a dependency on the
prompt).

Since 'if' and 'depends on' are the same, an 'if' with just a single
symbol in it can be replaced with a 'depends on'. IMO, it's best to
avoid 'if' there as a style choice too, because it confuses people into
thinking there's deep Kconfig magic going on that requires 'if'.

Going for 'depends on' can also remove some nested 'if's, which
generates nicer symbol information and docs, because nested 'if's really
are so simple/dumb that they just add the dependencies from both 'if's
to all symbols within.

Replace a bunch of single-symbol 'if's with 'depends on' to despam the
Kconfig files a bit and make it clearer how things work. Also do some
other minor related dependency refactoring.

The replacement isn't complete. Will fix up the rest later. Splitting it
a bit to make it more manageable.

(Everything above is true for choices, menus, and comments as well.)

Detected by tweaking the Kconfiglib parsing code. It's impossible to
detect after parsing, because 'if' turns into 'depends on'.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
This commit is contained in:
Ulf Magnusson
2020-02-08 03:45:50 +01:00
committed by Anas Nashif
parent 1f0089ff45
commit eddd98f811
53 changed files with 90 additions and 272 deletions

View File

@@ -10,11 +10,10 @@ config CLOCK_CONTROL_NRF_FORCE_ALT
This option can be enabled to force an alternative implementation
of the clock control driver.
if !CLOCK_CONTROL_NRF_FORCE_ALT
menuconfig CLOCK_CONTROL_NRF
bool "NRF Clock controller support"
depends on SOC_COMPATIBLE_NRF
depends on !CLOCK_CONTROL_NRF_FORCE_ALT
default y
help
Enable support for the Nordic Semiconductor nRFxx series SoC clock
@@ -130,5 +129,3 @@ config CLOCK_CONTROL_NRF_K32SRC_20PPM
endchoice
endif # CLOCK_CONTROL_NRF
endif #!CLOCK_CONTROL_NRF_FORCE_ALT

View File

@@ -4,17 +4,15 @@
# Copyright (c) 2017 RnDity Sp. z o.o.
# SPDX-License-Identifier: Apache-2.0
if SOC_FAMILY_STM32
menuconfig CLOCK_CONTROL_STM32_CUBE
bool "STM32 Reset & Clock Control"
depends on SOC_FAMILY_STM32
select USE_STM32_LL_UTILS
select USE_STM32_LL_RCC if SOC_SERIES_STM32MP1X
help
Enable driver for Reset & Clock Control subsystem found
in STM32 family of MCUs
if CLOCK_CONTROL_STM32_CUBE
config CLOCK_CONTROL_STM32_DEVICE_INIT_PRIORITY
@@ -274,4 +272,3 @@ config CLOCK_STM32_MCO2_DIV
allowed values: 1, 2, 3, 4, 5
endif # CLOCK_CONTROL_STM32_CUBE
endif # SOC_FAMILY_STM32

View File

@@ -3,12 +3,9 @@
# Copyright (c) 2016 Linaro Limited
# SPDX-License-Identifier: Apache-2.0
if SOC_FAMILY_ARM
config TIMER_DTMR_CMSDK_APB
bool "ARM CMSDK (Cortex-M System Design Kit) DTMR Timer driver"
depends on SOC_FAMILY_ARM
help
The dualtimer (DTMR) present in the platform is used as a timer.
This option enables the support for the timer.
endif # SOC_FAMILY_ARM

View File

@@ -51,24 +51,15 @@ config COUNTER_RTC2
select COUNTER_NRF_RTC
# Internal flag which detects if PPI wrap feature is enabled for any instance
if ($(dt_node_has_bool_prop,rtc-0,ppi-wrap) && COUNTER_RTC0) || \
($(dt_node_has_bool_prop,rtc-1,ppi-wrap) && COUNTER_RTC1) || \
($(dt_node_has_bool_prop,rtc-2,ppi-wrap) && COUNTER_RTC2)
config COUNTER_RTC_WITH_PPI_WRAP
bool
default y
def_bool ($(dt_node_has_bool_prop,rtc-0,ppi-wrap) && COUNTER_RTC0) || \
($(dt_node_has_bool_prop,rtc-1,ppi-wrap) && COUNTER_RTC1) || \
($(dt_node_has_bool_prop,rtc-2,ppi-wrap) && COUNTER_RTC2)
select NRFX_PPI if HAS_HW_NRF_PPI
select NRFX_DPPI if HAS_HW_NRF_DPPIC
endif
# Internal flag which detects if fixed top feature is enabled for any instance
if (!$(dt_node_has_bool_prop,rtc-0,fixed-top) && COUNTER_RTC0) || \
(!$(dt_node_has_bool_prop,rtc-1,fixed-top) && COUNTER_RTC1) || \
(!$(dt_node_has_bool_prop,rtc-2,fixed-top) && COUNTER_RTC2)
config COUNTER_RTC_CUSTOM_TOP_SUPPORT
bool
default y
endif
def_bool (!$(dt_node_has_bool_prop,rtc-0,fixed-top) && COUNTER_RTC0) || \
(!$(dt_node_has_bool_prop,rtc-1,fixed-top) && COUNTER_RTC1) || \
(!$(dt_node_has_bool_prop,rtc-2,fixed-top) && COUNTER_RTC2)

View File

@@ -3,12 +3,9 @@
# Copyright (c) 2016 Linaro Limited
# SPDX-License-Identifier: Apache-2.0
if SOC_FAMILY_ARM
config TIMER_TMR_CMSDK_APB
bool "ARM CMSDK (Cortex-M System Design Kit) Timer driver"
depends on SOC_FAMILY_ARM
help
The timers (TMR) present in the platform are used as timers.
This option enables the support for the timers.
endif # SOC_FAMILY_ARM

View File

@@ -11,13 +11,10 @@ menuconfig CRYPTO_STM32
help
Enable STM32 HAL-based Cryptographic Accelerator driver.
if CRYPTO_STM32
config CRYPTO_STM32_MAX_SESSION
int "Maximum of sessions STM32 crypto driver can handle"
default 2
depends on CRYPTO_STM32
help
This can be used to tweak the amount of sessions the driver
can handle in parallel.
endif # CRYPTO_STM32

View File

@@ -12,15 +12,12 @@ config MICROBIT_DISPLAY
Enable this to be able to display images and text on the 5x5
LED matrix display on the BBC micro:bit.
if MICROBIT_DISPLAY
config MICROBIT_DISPLAY_STR_MAX
int "Maximum length of strings that can be shown on the display"
range 3 255
default 40
depends on MICROBIT_DISPLAY
help
This value specifies the maximum length of strings that can
be displayed using the mb_display_string() and mb_display_print()
APIs.
endif # MICROBIT_DISPLAY

View File

@@ -9,11 +9,10 @@ menuconfig ST7789V
help
Enable driver for ST7789V display driver.
if ST7789V
choice ST7789V_PIXEL_FORMAT
prompt "Color pixel format"
default ST7789V_RGB565
depends on ST7789V
help
Specify the color pixel format for the ST7789V display controller.
@@ -24,5 +23,3 @@ config ST7789V_RGB565
bool "RGB565"
endchoice
endif # ST7789V

View File

@@ -57,10 +57,9 @@ config EEPROM_SIMULATOR
help
Enable Simulated EEPROM driver.
if EEPROM_SIMULATOR
config EEPROM_SIMULATOR_SIMULATE_TIMING
bool "Enable hardware timing simulation"
depends on EEPROM_SIMULATOR
help
Enable Simulated hardware timing.
@@ -80,6 +79,4 @@ config EEPROM_SIMULATOR_MIN_WRITE_TIME_US
endif # EEPROM_SIMULATOR_SIMULATE_TIMING
endif # EEPROM_SIMULATOR
endif # EEPROM

View File

@@ -40,19 +40,16 @@ config ESPI_VWIRE_CHANNEL
help
eSPI Controller supports virtual wires channel.
if ESPI_VWIRE_CHANNEL
config ESPI_AUTOMATIC_WARNING_ACKNOWLEDGE
bool "Automatic acknowledge for eSPI HOST warnings"
default y
depends on ESPI_VWIRE_CHANNEL
help
Enable automatic acknowledge from eSPI slave towards eSPI host
whenever it receives suspend or reset warning.
If this is disabled, it means the app wants to be give the opportunity
to prepare for either HOST suspend or reset.
endif # ESPI_VWIRE_CHANNEL
config ESPI_OOB_CHANNEL
bool "eSPI Out-of-band channel"
help

View File

@@ -7,11 +7,10 @@ config FLASH_NRF_FORCE_ALT
This option can be enabled to force an alternative implementation
of the flash driver.
if !FLASH_NRF_FORCE_ALT
menuconfig SOC_FLASH_NRF
bool "Nordic Semiconductor nRF flash driver"
depends on SOC_FAMILY_NRF
depends on !FLASH_NRF_FORCE_ALT
select FLASH_HAS_PAGE_LAYOUT
select FLASH_HAS_DRIVER_ENABLED
select NRFX_NVMC
@@ -19,26 +18,27 @@ menuconfig SOC_FLASH_NRF
help
Enables Nordic Semiconductor nRF flash driver.
if SOC_FLASH_NRF
config SOC_FLASH_NRF_RADIO_SYNC
bool "Nordic nRFx flash driver synchronized with radio"
depends on SOC_FLASH_NRF && BT_CTLR
default y
depends on BT_CTLR
help
Enable synchronization between flash memory driver and radio.
config SOC_FLASH_NRF_UICR
bool "Access to UICR"
depends on SOC_FLASH_NRF && !TRUSTED_EXECUTION_NONSECURE
depends on !TRUSTED_EXECUTION_NONSECURE
help
Enable operations on UICR. Once enabled UICR are written or read as
ordinary flash memory. Erase is possible for whole UICR at once.
config SOC_FLASH_NRF_EMULATE_ONE_BYTE_WRITE_ACCESS
bool "8-bit write block size emulation"
depends on SOC_FLASH_NRF
help
When this option is enabled writing chunks less than minimal write
block size parameter (imposed by manufacturer) is possible but operation
is more complex and requires basic user knowledge about NVMC controller.
endif #!FLASH_NRF_FORCE_ALT
endif # SOC_FLASH_NRF

View File

@@ -3,15 +3,12 @@
# Copyright (c) 2018 Aurelien Jarno
# SPDX-License-Identifier: Apache-2.0
if SOC_FAMILY_SAM
config SOC_FLASH_SAM
bool "Atmel SAM flash driver"
default y
select FLASH_HAS_PAGE_LAYOUT
select FLASH_HAS_DRIVER_ENABLED
depends on SOC_FAMILY_SAM
depends on SOC_SERIES_SAME70
help
Enable the Atmel SAM series internal flash driver.
endif

View File

@@ -3,11 +3,10 @@
# Copyright (c) 2018 Google LLC.
# SPDX-License-Identifier: Apache-2.0
if SOC_FAMILY_SAM0
menuconfig SOC_FLASH_SAM0
bool "Atmel SAM0 flash driver"
default y
depends on SOC_FAMILY_SAM0
select FLASH_HAS_PAGE_LAYOUT
select FLASH_HAS_DRIVER_ENABLED
help
@@ -19,5 +18,3 @@ config SOC_FLASH_SAM0_EMULATE_BYTE_PAGES
help
Emulate a device with byte-sized pages by doing a
read/modify/erase/write.
endif

View File

@@ -4,10 +4,9 @@
# Copyright (c) 2017 BayLibre, SAS
# SPDX-License-Identifier: Apache-2.0
if SOC_FAMILY_STM32
config SOC_FLASH_STM32
bool "STM32 flash driver"
depends on SOC_FAMILY_STM32
depends on (SOC_SERIES_STM32F0X || SOC_SERIES_STM32F1X || SOC_SERIES_STM32F3X || SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X || SOC_SERIES_STM32L4X || SOC_SERIES_STM32WBX || SOC_SERIES_STM32G0X || SOC_SERIES_STM32G4X)
select FLASH_HAS_DRIVER_ENABLED
default y
@@ -32,5 +31,3 @@ config SOC_FLASH_STM32
help
Enable STM32F0x, STM32F3x, STM32F4x, STM32F7x, STM32L4x, STM32WBx,
STM32G0x or STM32G4x series flash driver.
endif

View File

@@ -7,10 +7,7 @@ menuconfig KSCAN_FT5336
help
Enable driver for the FT5336 capacitive touch panel controller.
if KSCAN_FT5336
config KSCAN_FT5336_PERIOD
int "Sample period (ms)"
default 10
endif # KSCAN_FT5336
depends on KSCAN_FT5336

View File

@@ -14,11 +14,10 @@ menuconfig WS2812_STRIP
Enable LED strip driver for daisy chains of WS2812-ish
(or WS2812B, WS2813, SK6812, or compatible) devices.
if WS2812_STRIP
choice WS2812_STRIP_DRIVER
prompt "Driver backend"
default WS2812_STRIP_SPI
prompt "Driver backend"
default WS2812_STRIP_SPI
depends on WS2812_STRIP
config WS2812_STRIP_SPI
bool "Enable the SPI driver"
@@ -37,5 +36,3 @@ config WS2812_STRIP_GPIO
and is not available on all SoCs.
endchoice
endif

View File

@@ -9,10 +9,7 @@ menuconfig PINMUX_SIFIVE
help
Enable driver for the SiFive Freedom SOC pinmux driver
if PINMUX_SIFIVE
config PINMUX_SIFIVE_0_NAME
string "SIFIVE pinmux 0 driver name"
default "pinmux0"
endif # PINMUX_SIFIVE
depends on PINMUX_SIFIVE

View File

@@ -9,12 +9,9 @@ menuconfig AMS_IAQ_CORE
help
Enable driver for iAQ-core Digital VOC sensor.
if AMS_IAQ_CORE
config IAQ_CORE_MAX_READ_RETRIES
int "Number of read retries"
default 4
depends on AMS_IAQ_CORE
help
Number of retries when reading failed or device not ready.
endif # AMS_IAQ_CORE

View File

@@ -203,15 +203,12 @@ menuconfig FXOS8700_MOTION
help
Enable motion detection
if FXOS8700_MOTION
config FXOS8700_MOTION_INT1
bool "Motion interrupt to INT1 pin"
depends on FXOS8700_MOTION
help
Say Y to route motion interrupt to INT1 pin. Say N to route to INT2 pin.
endif # FXOS8700_MOTION
endif # FXOS8700_TRIGGER
endif # FXOS8700

View File

@@ -8,13 +8,10 @@ menuconfig LPS22HB
Enable driver for LPS22HB I2C-based pressure and temperature
sensor.
if LPS22HB
config LPS22HB_SAMPLING_RATE
int "Output data rate"
default 25
depends on LPS22HB
help
Sensor output data rate expressed in samples per second.
Data rates supported by the chip are 1, 10, 25, 50, 75.
endif # LPS22HB

Some files were not shown because too many files have changed in this diff Show More