drivers: remove unnecessary use of DEVICE_AND_API_INIT

For drivers that support CONFIG_DEVICE_POWER_MANAGEMENT there are some
cases that look like:

  #ifdef CONFIG_DEVICE_POWER_MANAGEMENT
    DEVICE_DEFINE()
  #else
    DEVICE_AND_API_INIT()
  #endif

There is no need to special case this as the pm_control_fn argument to
DEVICE_DEFINE will just be ignored in the
!CONFIG_DEVICE_POWER_MANAGEMENT case.  So we can cleanup the code a
little and remove the #else cases for the drivers that do this.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2020-11-05 06:43:42 -06:00 committed by Maureen Helm
commit b4a3880a75
8 changed files with 2 additions and 85 deletions

View file

@ -329,7 +329,6 @@ static const struct spi_driver_api spi_cc13xx_cc26xx_driver_api = {
} while (0)
#endif
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
#define SPI_CC13XX_CC26XX_DEVICE_INIT(n) \
DEVICE_DEFINE(spi_cc13xx_cc26xx_##n, DT_INST_LABEL(n), \
spi_cc13xx_cc26xx_init_##n, \
@ -338,18 +337,12 @@ static const struct spi_driver_api spi_cc13xx_cc26xx_driver_api = {
POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \
&spi_cc13xx_cc26xx_driver_api)
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
#define SPI_CC13XX_CC26XX_INIT_PM_STATE \
do { \
get_dev_data(dev)->pm_state = DEVICE_PM_ACTIVE_STATE; \
} while (0)
#else
#define SPI_CC13XX_CC26XX_DEVICE_INIT(n) \
DEVICE_AND_API_INIT(spi_cc13xx_cc26xx_##n, DT_INST_LABEL(n), \
spi_cc13xx_cc26xx_init_##n, &spi_cc13xx_cc26xx_data_##n,\
&spi_cc13xx_cc26xx_config_##n, POST_KERNEL, \
CONFIG_SPI_INIT_PRIORITY, \
&spi_cc13xx_cc26xx_driver_api)
#define SPI_CC13XX_CC26XX_INIT_PM_STATE
#endif