subsys: storage: flash_map: enable only if any flash driver is enable

It was possible to have enable flash module while no flash driver
implementation was enabled. This cause coverity issues and unnecessary
initialization call.

This pat introduce FLASH_HAS_DRIVER_ENABLED Kconfig keyword which is
selected once any flash driver is enabled. flash_map switch its
dependency to this keyword.


Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This commit is contained in:
Andrzej Puzdrowski 2018-03-07 14:31:56 +01:00 committed by Carles Cufí
commit 80a99fa450
4 changed files with 14 additions and 1 deletions

View file

@ -9,6 +9,12 @@
#
# Flash driver
#
config FLASH_HAS_DRIVER_ENABLED
bool
default n
help
This option is enabled when any flash driver is enabled.
menuconfig FLASH
bool
prompt "Flash hardware support"
@ -26,6 +32,7 @@ config FLASH_PAGE_LAYOUT
config SPI_FLASH_W25QXXDV
bool
prompt "SPI NOR Flash Winbond W25QXXDV"
select FLASH_HAS_DRIVER_ENABLED
depends on SPI && FLASH
config SPI_FLASH_W25QXXDV_SPI_NAME
@ -84,6 +91,7 @@ config SOC_FLASH_QMSI
bool
prompt "QMSI flash driver"
depends on QMSI && FLASH
select FLASH_HAS_DRIVER_ENABLED
default n
help
Enable QMSI Quark flash driver.
@ -128,6 +136,7 @@ config SOC_FLASH_NRF5
depends on FLASH && SOC_FAMILY_NRF5
default n
select FLASH_HAS_PAGE_LAYOUT
select FLASH_HAS_DRIVER_ENABLED
help
Enables Nordic Semiconductor nRF5X flash driver.
@ -142,6 +151,7 @@ config SOC_FLASH_MCUX
bool "MCUX flash shim driver"
depends on FLASH && HAS_MCUX
select FLASH_HAS_PAGE_LAYOUT
select FLASH_HAS_DRIVER_ENABLED
default n
help
Enables the MCUX flash shim driver.
@ -154,6 +164,7 @@ config SOC_FLASH_NIOS2_QSPI
bool "Nios-II QSPI flash driver"
depends on FLASH && HAS_ALTERA_HAL
default n
select FLASH_HAS_DRIVER_ENABLED
help
Enables the Nios-II QSPI flash driver.

View file

@ -10,6 +10,7 @@ menuconfig SOC_FLASH_SAM0
prompt "Atmel SAM0 flash driver"
default n
select FLASH_HAS_PAGE_LAYOUT
select FLASH_HAS_DRIVER_ENABLED
help
Enable the Atmel SAM0 series internal flash driver.

View file

@ -12,6 +12,7 @@ menuconfig SOC_FLASH_STM32
bool
prompt "STM32 flash driver"
depends on (SOC_SERIES_STM32F0X || SOC_SERIES_STM32F3X || SOC_SERIES_STM32F4X || SOC_SERIES_STM32L4X)
select FLASH_HAS_DRIVER_ENABLED
default y
select FLASH_PAGE_LAYOUT if SOC_SERIES_STM32F0X
select FLASH_PAGE_LAYOUT if SOC_SERIES_STM32F4X

View file

@ -13,7 +13,7 @@ menuconfig FLASH_MAP
bool
prompt "Flash map abstraction module"
default n
depends on FLASH
depends on FLASH_HAS_DRIVER_ENABLED
help
Enable support of flash map abstraction.