diff --git a/boards/arm/frdm_k64f/pinmux.c b/boards/arm/frdm_k64f/pinmux.c index 97950f255ca..0ebe2c6f1a9 100644 --- a/boards/arm/frdm_k64f/pinmux.c +++ b/boards/arm/frdm_k64f/pinmux.c @@ -123,7 +123,7 @@ static int frdm_k64f_pinmux_init(struct device *dev) #endif #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(ftm3)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm) pinmux_pin_set(portc, 8, PORT_PCR_MUX(kPORT_MuxAlt3)); pinmux_pin_set(portc, 9, PORT_PCR_MUX(kPORT_MuxAlt3)); #endif diff --git a/boards/arm/frdm_k82f/pinmux.c b/boards/arm/frdm_k82f/pinmux.c index 697fc853acc..970e9ee926c 100644 --- a/boards/arm/frdm_k82f/pinmux.c +++ b/boards/arm/frdm_k82f/pinmux.c @@ -34,7 +34,7 @@ static int frdm_k82f_pinmux_init(struct device *dev) #endif #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(ftm3)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm) /* Red, green, blue LEDs as PWM channels */ pinmux_pin_set(portc, 8, PORT_PCR_MUX(kPORT_MuxAlt3)); pinmux_pin_set(portc, 9, PORT_PCR_MUX(kPORT_MuxAlt3)); diff --git a/boards/arm/hexiwear_k64/pinmux.c b/boards/arm/hexiwear_k64/pinmux.c index 6e9e49ab759..696c3a249c9 100644 --- a/boards/arm/hexiwear_k64/pinmux.c +++ b/boards/arm/hexiwear_k64/pinmux.c @@ -31,7 +31,7 @@ static int hexiwear_k64_pinmux_init(struct device *dev) #endif #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(ftm3)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm) /* Red, green, blue LEDs as PWM channels */ pinmux_pin_set(portc, 8, PORT_PCR_MUX(kPORT_MuxAlt3)); pinmux_pin_set(portc, 9, PORT_PCR_MUX(kPORT_MuxAlt3)); diff --git a/boards/arm/lpcxpresso54114/pinmux.c b/boards/arm/lpcxpresso54114/pinmux.c index 9a23c04e698..9ec6966d4ea 100644 --- a/boards/arm/lpcxpresso54114/pinmux.c +++ b/boards/arm/lpcxpresso54114/pinmux.c @@ -24,7 +24,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev) #endif #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm0)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm0), nxp_lpc_usart) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm0), nxp_lpc_usart) /* USART0 RX, TX */ const u32_t port0_pin0_config = ( IOCON_PIO_FUNC1 | @@ -109,7 +109,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev) #endif #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm4)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm4), nxp_lpc_i2c) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c) /* PORT0 PIN25 is configured as FC4_RTS_SCL_SSEL1 */ pinmux_pin_set(port0, 25, IOCON_PIO_FUNC1 | IOCON_PIO_I2CSLEW_I2C | @@ -130,7 +130,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev) #endif #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm5)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm5), nxp_lpc_spi) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm5), nxp_lpc_spi) /* PORT0 PIN18 is configured as FC5_TXD_SCL_MISO */ pinmux_pin_set(port0, 18, IOCON_PIO_FUNC1 | IOCON_PIO_MODE_PULLUP | diff --git a/boards/arm/lpcxpresso55s16/pinmux.c b/boards/arm/lpcxpresso55s16/pinmux.c index 407d0856dad..6e186f09cc8 100644 --- a/boards/arm/lpcxpresso55s16/pinmux.c +++ b/boards/arm/lpcxpresso55s16/pinmux.c @@ -96,7 +96,7 @@ static int lpcxpresso_55s16_pinmux_init(struct device *dev) #endif #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm0)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm0), nxp_lpc_usart) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm0), nxp_lpc_usart) /* USART0 RX, TX */ const u32_t port0_pin29_config = ( IOCON_PIO_FUNC1 | @@ -119,7 +119,7 @@ static int lpcxpresso_55s16_pinmux_init(struct device *dev) #endif #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm4)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm4), nxp_lpc_i2c) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c) /* PORT1 PIN20 is configured as FC4_TXD_SCL_MISO_WS */ pinmux_pin_set(port1, 20, IOCON_PIO_FUNC5 | IOCON_PIO_MODE_INACT | diff --git a/boards/arm/lpcxpresso55s69/pinmux.c b/boards/arm/lpcxpresso55s69/pinmux.c index 57442fb1461..abdfc714330 100644 --- a/boards/arm/lpcxpresso55s69/pinmux.c +++ b/boards/arm/lpcxpresso55s69/pinmux.c @@ -24,7 +24,7 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev) #endif #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm0)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm0), nxp_lpc_usart) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm0), nxp_lpc_usart) /* USART0 RX, TX */ const u32_t port0_pin29_config = ( IOCON_PIO_FUNC1 | @@ -90,7 +90,7 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev) #endif #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm4)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm4), nxp_lpc_i2c) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c) /* PORT1 PIN20 is configured as FC4_TXD_SCL_MISO_WS */ pinmux_pin_set(port1, 20, IOCON_PIO_FUNC5 | IOCON_PIO_MODE_INACT | diff --git a/boards/arm/twr_ke18f/pinmux.c b/boards/arm/twr_ke18f/pinmux.c index 7b99a7ccab9..deb93115e88 100644 --- a/boards/arm/twr_ke18f/pinmux.c +++ b/boards/arm/twr_ke18f/pinmux.c @@ -35,7 +35,7 @@ static int twr_ke18f_pinmux_init(struct device *dev) #endif #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(ftm0)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(ftm0), nxp_kinetis_ftm_pwm) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm0), nxp_kinetis_ftm_pwm) /* Tri-color LED as PWM */ pinmux_pin_set(portb, 5, PORT_PCR_MUX(kPORT_MuxAlt2)); pinmux_pin_set(portd, 15, PORT_PCR_MUX(kPORT_MuxAlt2)); @@ -48,7 +48,7 @@ static int twr_ke18f_pinmux_init(struct device *dev) #endif #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(ftm3)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm) /* User LEDs as PWM */ pinmux_pin_set(portc, 10, PORT_PCR_MUX(kPORT_MuxAlt2)); pinmux_pin_set(portc, 11, PORT_PCR_MUX(kPORT_MuxAlt2)); diff --git a/doc/guides/dts/howtos.rst b/doc/guides/dts/howtos.rst index 8725a15d251..3ce5b2eb4cd 100644 --- a/doc/guides/dts/howtos.rst +++ b/doc/guides/dts/howtos.rst @@ -386,10 +386,10 @@ enabled instance. Currently, this looks like this: &my_dev_data_##inst, \ &my_dev_cfg_##inst, \ MY_DEV_INIT_LEVEL, MY_DEV_INIT_PRIORITY, \ - &my_api_funcs) + &my_api_funcs); /* Call the device creation macro for every compatible node: */ - DT_INST_FOREACH(CREATE_MY_DEVICE); + DT_INST_FOREACH_STATUS_OKAY(CREATE_MY_DEVICE) Notice the use of :c:func:`DT_INST_PROP` and :c:func:`DT_INST_FOREACH`. These are helpers which rely on ``DT_DRV_COMPAT`` to choose devicetree nodes diff --git a/drivers/adc/adc_lmp90xxx.c b/drivers/adc/adc_lmp90xxx.c index 8b0f2349a2f..f3eeaf167db 100644 --- a/drivers/adc/adc_lmp90xxx.c +++ b/drivers/adc/adc_lmp90xxx.c @@ -1116,55 +1116,55 @@ static const struct adc_driver_api lmp90xxx_adc_api = { /* * LMP90077: 16 bit, 2 diff/4 se (4 channels), 0 currents */ -#if DT_HAS_COMPAT(ti_lmp90077) +#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90077) LMP90XXX_DEVICE(90077, 0, 16, 4); #endif /* * LMP90078: 16 bit, 2 diff/4 se (4 channels), 2 currents */ -#if DT_HAS_COMPAT(ti_lmp90078) +#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90078) LMP90XXX_DEVICE(90078, 0, 16, 4); #endif /* * LMP90079: 16 bit, 4 diff/7 se (7 channels), 0 currents, has VIN3-5 */ -#if DT_HAS_COMPAT(ti_lmp90079) +#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90079) LMP90XXX_DEVICE(90079, 0, 16, 7); #endif /* * LMP90080: 16 bit, 4 diff/7 se (7 channels), 2 currents, has VIN3-5 */ -#if DT_HAS_COMPAT(ti_lmp90080) +#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90080) LMP90XXX_DEVICE(90080, 0, 16, 7); #endif /* * LMP90097: 24 bit, 2 diff/4 se (4 channels), 0 currents */ -#if DT_HAS_COMPAT(ti_lmp90097) +#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90097) LMP90XXX_DEVICE(90097, 0, 24, 4); #endif /* * LMP90098: 24 bit, 2 diff/4 se (4 channels), 2 currents */ -#if DT_HAS_COMPAT(ti_lmp90098) +#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90098) LMP90XXX_DEVICE(90098, 0, 24, 4); #endif /* * LMP90099: 24 bit, 4 diff/7 se (7 channels), 0 currents, has VIN3-5 */ -#if DT_HAS_COMPAT(ti_lmp90099) +#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90099) LMP90XXX_DEVICE(90099, 0, 24, 7); #endif /* * LMP90100: 24 bit, 4 diff/7 se (7 channels), 2 currents, has VIN3-5 */ -#if DT_HAS_COMPAT(ti_lmp90100) +#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90100) LMP90XXX_DEVICE(90100, 0, 24, 7); #endif diff --git a/drivers/adc/adc_mcp320x.c b/drivers/adc/adc_mcp320x.c index c097ef54ab4..9369ceecad6 100644 --- a/drivers/adc/adc_mcp320x.c +++ b/drivers/adc/adc_mcp320x.c @@ -365,8 +365,9 @@ static const struct adc_driver_api mcp320x_adc_api = { #define CALL_WITH_ARG(arg, expr) expr(arg); -#define INST_DT_MCP320X_FOREACH(t, inst_expr) \ - UTIL_LISTIFY(DT_NUM_INST(microchip_mcp##t), CALL_WITH_ARG, inst_expr) +#define INST_DT_MCP320X_FOREACH(t, inst_expr) \ + UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(microchip_mcp##t), \ + CALL_WITH_ARG, inst_expr) INST_DT_MCP320X_FOREACH(3204, MCP3204_DEVICE); INST_DT_MCP320X_FOREACH(3208, MCP3208_DEVICE); diff --git a/drivers/adc/adc_mcux_adc12.c b/drivers/adc/adc_mcux_adc12.c index 772cba8ce35..21743c03971 100644 --- a/drivers/adc/adc_mcux_adc12.c +++ b/drivers/adc/adc_mcux_adc12.c @@ -299,4 +299,4 @@ static const struct adc_driver_api mcux_adc12_driver_api = { irq_enable(DT_INST_IRQN(n)); \ } -DT_INST_FOREACH(ACD12_MCUX_INIT) +DT_INST_FOREACH_STATUS_OKAY(ACD12_MCUX_INIT) diff --git a/drivers/adc/adc_mcux_adc16.c b/drivers/adc/adc_mcux_adc16.c index fd1a500e8c1..49de71843dc 100644 --- a/drivers/adc/adc_mcux_adc16.c +++ b/drivers/adc/adc_mcux_adc16.c @@ -304,4 +304,4 @@ static const struct adc_driver_api mcux_adc16_driver_api = { irq_enable(DT_INST_IRQN(n)); \ } -DT_INST_FOREACH(ACD16_MCUX_INIT) +DT_INST_FOREACH_STATUS_OKAY(ACD16_MCUX_INIT) diff --git a/drivers/adc/adc_nrfx_adc.c b/drivers/adc/adc_nrfx_adc.c index 35785991e57..40de7efdcf5 100644 --- a/drivers/adc/adc_nrfx_adc.c +++ b/drivers/adc/adc_nrfx_adc.c @@ -296,4 +296,4 @@ static const struct adc_driver_api adc_nrfx_driver_api = { CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &adc_nrfx_driver_api); -DT_INST_FOREACH(ADC_INIT) +DT_INST_FOREACH_STATUS_OKAY(ADC_INIT) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index c5729b242c4..f67d52943ee 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -439,4 +439,4 @@ static const struct adc_driver_api adc_nrfx_driver_api = { CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &adc_nrfx_driver_api); -DT_INST_FOREACH(SAADC_INIT) +DT_INST_FOREACH_STATUS_OKAY(SAADC_INIT) diff --git a/drivers/adc/adc_sam0.c b/drivers/adc/adc_sam0.c index c4adc110dab..1bd92273346 100644 --- a/drivers/adc/adc_sam0.c +++ b/drivers/adc/adc_sam0.c @@ -617,4 +617,4 @@ do { \ ADC_SAM0_CONFIGURE(n); \ } -DT_INST_FOREACH(ADC_SAM0_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(ADC_SAM0_DEVICE) diff --git a/drivers/adc/adc_sam_afec.c b/drivers/adc/adc_sam_afec.c index d8ea44fae3e..e3c11336e7d 100644 --- a/drivers/adc/adc_sam_afec.c +++ b/drivers/adc/adc_sam_afec.c @@ -379,4 +379,4 @@ static void adc_sam_isr(void *arg) irq_enable(DT_INST_IRQN(n)); \ } -DT_INST_FOREACH(ADC_SAM_INIT) +DT_INST_FOREACH_STATUS_OKAY(ADC_SAM_INIT) diff --git a/drivers/adc/adc_shell.c b/drivers/adc/adc_shell.c index 755a6196b3c..76298de0789 100644 --- a/drivers/adc/adc_shell.c +++ b/drivers/adc/adc_shell.c @@ -10,21 +10,21 @@ #include #include -#if DT_HAS_COMPAT(atmel_sam_afec) +#if DT_HAS_COMPAT_STATUS_OKAY(atmel_sam_afec) #define DT_DRV_COMPAT atmel_sam_afec -#elif DT_HAS_COMPAT(atmel_sam0_adc) +#elif DT_HAS_COMPAT_STATUS_OKAY(atmel_sam0_adc) #define DT_DRV_COMPAT atmel_sam0_adc -#elif DT_HAS_COMPAT(microchip_xec_adc) +#elif DT_HAS_COMPAT_STATUS_OKAY(microchip_xec_adc) #define DT_DRV_COMPAT microchip_xec_adc -#elif DT_HAS_COMPAT(nordic_nrf_adc) +#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_adc) #define DT_DRV_COMPAT nordic_nrf_adc -#elif DT_HAS_COMPAT(nordic_nrf_saadc) +#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_saadc) #define DT_DRV_COMPAT nordic_nrf_saadc -#elif DT_HAS_COMPAT(nxp_kinetis_adc12) +#elif DT_HAS_COMPAT_STATUS_OKAY(nxp_kinetis_adc12) #define DT_DRV_COMPAT nxp_kinetis_adc12 -#elif DT_HAS_COMPAT(nxp_kinetis_adc16) +#elif DT_HAS_COMPAT_STATUS_OKAY(nxp_kinetis_adc16) #define DT_DRV_COMPAT nxp_kinetis_adc16 -#elif DT_HAS_COMPAT(st_stm32_adc) +#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_adc) #define DT_DRV_COMPAT st_stm32_adc #else #error No known devicetree compatible match for ADC shell diff --git a/drivers/adc/adc_stm32.c b/drivers/adc/adc_stm32.c index 64f14620031..000a783f8ce 100644 --- a/drivers/adc/adc_stm32.c +++ b/drivers/adc/adc_stm32.c @@ -738,4 +738,4 @@ static void adc_stm32_cfg_func_##index(void) \ irq_enable(DT_INST_IRQN(index)); \ } -DT_INST_FOREACH(STM32_ADC_INIT) +DT_INST_FOREACH_STATUS_OKAY(STM32_ADC_INIT) diff --git a/drivers/audio/mpxxdtyy-i2s.c b/drivers/audio/mpxxdtyy-i2s.c index ae4e130dd60..1626e98be35 100644 --- a/drivers/audio/mpxxdtyy-i2s.c +++ b/drivers/audio/mpxxdtyy-i2s.c @@ -13,7 +13,7 @@ #include LOG_MODULE_DECLARE(mpxxdtyy); -#if DT_ANY_INST_ON_BUS(i2s) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2s) #define NUM_RX_BLOCKS 4 #define PDM_BLOCK_MAX_SIZE_BYTES 512 @@ -140,4 +140,4 @@ int mpxxdtyy_i2s_configure(struct device *dev, struct dmic_cfg *cfg) data->state = DMIC_STATE_CONFIGURED; return 0; } -#endif /* DT_ANY_INST_ON_BUS(i2s) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2s) */ diff --git a/drivers/audio/mpxxdtyy.c b/drivers/audio/mpxxdtyy.c index 727b41b418b..3dd304d8a9d 100644 --- a/drivers/audio/mpxxdtyy.c +++ b/drivers/audio/mpxxdtyy.c @@ -141,11 +141,11 @@ int sw_filter_lib_run(TPDMFilter_InitStruct *pdm_filter, } static const struct _dmic_ops mpxxdtyy_driver_api = { -#if DT_ANY_INST_ON_BUS(i2s) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2s) .configure = mpxxdtyy_i2s_configure, .trigger = mpxxdtyy_i2s_trigger, .read = mpxxdtyy_i2s_read, -#endif /* DT_ANY_INST_ON_BUS(i2s) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2s) */ }; static int mpxxdtyy_initialize(struct device *dev) diff --git a/drivers/audio/mpxxdtyy.h b/drivers/audio/mpxxdtyy.h index 657cb7bd85c..11f9632e451 100644 --- a/drivers/audio/mpxxdtyy.h +++ b/drivers/audio/mpxxdtyy.h @@ -37,12 +37,12 @@ int sw_filter_lib_run(TPDMFilter_InitStruct *pdm_filter, void *pdm_block, void *pcm_block, size_t pdm_size, size_t pcm_size); -#if DT_ANY_INST_ON_BUS(i2s) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2s) int mpxxdtyy_i2s_read(struct device *dev, u8_t stream, void **buffer, size_t *size, s32_t timeout); int mpxxdtyy_i2s_trigger(struct device *dev, enum dmic_trigger cmd); int mpxxdtyy_i2s_configure(struct device *dev, struct dmic_cfg *cfg); -#endif /* DT_ANY_INST_ON_BUS(i2s) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2s) */ #ifdef __cplusplus } diff --git a/drivers/can/can_stm32.c b/drivers/can/can_stm32.c index 94d26a22418..0d0408931a3 100644 --- a/drivers/can/can_stm32.c +++ b/drivers/can/can_stm32.c @@ -21,9 +21,9 @@ LOG_MODULE_DECLARE(can_driver, CONFIG_CAN_LOG_LEVEL); #define CAN_INIT_TIMEOUT (10 * sys_clock_hw_cycles_per_sec() / MSEC_PER_SEC) #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(can1)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(can1), st_stm32_can) && \ + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can1), st_stm32_can) && \ DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(can2)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(can2), st_stm32_can) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can2), st_stm32_can) #error Simultaneous use of CAN_1 and CAN_2 not supported yet #endif @@ -1048,7 +1048,7 @@ static const struct can_driver_api can_api_funcs = { }; #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(can1)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(can1), st_stm32_can) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can1), st_stm32_can) static void config_can_1_irq(CAN_TypeDef *can); @@ -1138,7 +1138,7 @@ NET_DEVICE_INIT(socket_can_stm32_1, SOCKET_CAN_NAME_1, socket_can_init_1, #endif /* DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(can1)) */ #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(can2)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(can2), st_stm32_can) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can2), st_stm32_can) static void config_can_2_irq(CAN_TypeDef *can); diff --git a/drivers/clock_control/clock_control_mcux_pcc.c b/drivers/clock_control/clock_control_mcux_pcc.c index f418f175812..18fbee2b3a2 100644 --- a/drivers/clock_control/clock_control_mcux_pcc.c +++ b/drivers/clock_control/clock_control_mcux_pcc.c @@ -79,4 +79,4 @@ static const struct clock_control_driver_api mcux_pcc_api = { CONFIG_KERNEL_INIT_PRIORITY_OBJECTS, \ &mcux_pcc_api); -DT_INST_FOREACH(MCUX_PCC_INIT) +DT_INST_FOREACH_STATUS_OKAY(MCUX_PCC_INIT) diff --git a/drivers/clock_control/clock_control_rv32m1_pcc.c b/drivers/clock_control/clock_control_rv32m1_pcc.c index aeafe0f07e1..b45518a0cf2 100644 --- a/drivers/clock_control/clock_control_rv32m1_pcc.c +++ b/drivers/clock_control/clock_control_rv32m1_pcc.c @@ -72,4 +72,4 @@ static const struct clock_control_driver_api rv32m1_pcc_api = { CONFIG_KERNEL_INIT_PRIORITY_OBJECTS, \ &rv32m1_pcc_api); -DT_INST_FOREACH(RV32M1_PCC_INIT) +DT_INST_FOREACH_STATUS_OKAY(RV32M1_PCC_INIT) diff --git a/drivers/counter/counter_imx_epit.c b/drivers/counter/counter_imx_epit.c index 1149eda1fd1..4a3b9beac58 100644 --- a/drivers/counter/counter_imx_epit.c +++ b/drivers/counter/counter_imx_epit.c @@ -178,4 +178,4 @@ static int imx_epit_config_func_##idx(struct device *dev) \ return 0; \ } -DT_INST_FOREACH(COUNTER_IMX_EPIT_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(COUNTER_IMX_EPIT_DEVICE) diff --git a/drivers/counter/counter_mchp_xec.c b/drivers/counter/counter_mchp_xec.c index b2da6bcc5b1..35149422d56 100644 --- a/drivers/counter/counter_mchp_xec.c +++ b/drivers/counter/counter_mchp_xec.c @@ -347,4 +347,4 @@ static int counter_xec_init(struct device *dev) irq_enable(DT_INST_IRQN(inst)); \ } -DT_INST_FOREACH(COUNTER_XEC_INIT) +DT_INST_FOREACH_STATUS_OKAY(COUNTER_XEC_INIT) diff --git a/drivers/counter/counter_mcux_gpt.c b/drivers/counter/counter_mcux_gpt.c index 8cea41a5e5f..8315c234ea7 100644 --- a/drivers/counter/counter_mcux_gpt.c +++ b/drivers/counter/counter_mcux_gpt.c @@ -234,4 +234,4 @@ static const struct counter_driver_api mcux_gpt_driver_api = { return mcux_gpt_init(dev); \ } \ -DT_INST_FOREACH(GPT_DEVICE_INIT_MCUX) +DT_INST_FOREACH_STATUS_OKAY(GPT_DEVICE_INIT_MCUX) diff --git a/drivers/counter/counter_mcux_lptmr.c b/drivers/counter/counter_mcux_lptmr.c index 86306d9eeeb..933af990861 100644 --- a/drivers/counter/counter_mcux_lptmr.c +++ b/drivers/counter/counter_mcux_lptmr.c @@ -204,7 +204,7 @@ static const struct counter_driver_api mcux_lptmr_driver_api = { * This driver is single-instance. If the devicetree contains multiple * instances, this will fail and the driver needs to be revisited. */ -BUILD_ASSERT(DT_NUM_INST(DT_DRV_COMPAT) <= 1, +BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) <= 1, "unsupported lptmr instance"); #if DT_HAS_NODE_STATUS_OKAY(DT_DRV_INST(0)) diff --git a/drivers/counter/counter_sam0_tc32.c b/drivers/counter/counter_sam0_tc32.c index 2ff90db6dcd..c7abd983ddf 100644 --- a/drivers/counter/counter_sam0_tc32.c +++ b/drivers/counter/counter_sam0_tc32.c @@ -457,4 +457,4 @@ static const struct counter_driver_api counter_sam0_tc32_driver_api = { irq_enable(DT_INST_IRQN(n)); \ } -DT_INST_FOREACH(COUNTER_SAM0_TC32_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(COUNTER_SAM0_TC32_DEVICE) diff --git a/drivers/counter/timer_dtmr_cmsdk_apb.c b/drivers/counter/timer_dtmr_cmsdk_apb.c index 7608caacbd3..6e7dd4794f4 100644 --- a/drivers/counter/timer_dtmr_cmsdk_apb.c +++ b/drivers/counter/timer_dtmr_cmsdk_apb.c @@ -217,4 +217,4 @@ static int dtmr_cmsdk_apb_init(struct device *dev) irq_enable(DT_INST_IRQN(inst)); \ } -DT_INST_FOREACH(DTIMER_CMSDK_INIT) +DT_INST_FOREACH_STATUS_OKAY(DTIMER_CMSDK_INIT) diff --git a/drivers/counter/timer_tmr_cmsdk_apb.c b/drivers/counter/timer_tmr_cmsdk_apb.c index d20d7eab384..45cdfc48947 100644 --- a/drivers/counter/timer_tmr_cmsdk_apb.c +++ b/drivers/counter/timer_tmr_cmsdk_apb.c @@ -204,4 +204,4 @@ static int tmr_cmsdk_apb_init(struct device *dev) irq_enable(DT_INST_IRQN(inst)); \ } -DT_INST_FOREACH(TIMER_CMSDK_INIT) +DT_INST_FOREACH_STATUS_OKAY(TIMER_CMSDK_INIT) diff --git a/drivers/dac/dac_mcux_dac.c b/drivers/dac/dac_mcux_dac.c index 0fa1e9daa77..d5cbe620d16 100644 --- a/drivers/dac/dac_mcux_dac.c +++ b/drivers/dac/dac_mcux_dac.c @@ -110,4 +110,4 @@ static const struct dac_driver_api mcux_dac_driver_api = { POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,\ &mcux_dac_driver_api); -DT_INST_FOREACH(MCUX_DAC_INIT) +DT_INST_FOREACH_STATUS_OKAY(MCUX_DAC_INIT) diff --git a/drivers/dac/dac_mcux_dac32.c b/drivers/dac/dac_mcux_dac32.c index 221e9fb82c4..3ae90e62c77 100644 --- a/drivers/dac/dac_mcux_dac32.c +++ b/drivers/dac/dac_mcux_dac32.c @@ -113,4 +113,4 @@ static const struct dac_driver_api mcux_dac32_driver_api = { POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,\ &mcux_dac32_driver_api); -DT_INST_FOREACH(MCUX_DAC32_INIT) +DT_INST_FOREACH_STATUS_OKAY(MCUX_DAC32_INIT) diff --git a/drivers/dac/dac_stm32.c b/drivers/dac/dac_stm32.c index 5db82654d39..b9cadef315b 100644 --- a/drivers/dac/dac_stm32.c +++ b/drivers/dac/dac_stm32.c @@ -148,4 +148,4 @@ DEVICE_AND_API_INIT(dac_##index, DT_INST_LABEL(index), \ CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ &api_stm32_driver_api); -DT_INST_FOREACH(STM32_DAC_INIT) +DT_INST_FOREACH_STATUS_OKAY(STM32_DAC_INIT) diff --git a/drivers/dma/dma_dw.c b/drivers/dma/dma_dw.c index 5d0b9bc51af..039e77097c3 100644 --- a/drivers/dma/dma_dw.c +++ b/drivers/dma/dma_dw.c @@ -425,4 +425,4 @@ static const struct dma_driver_api dw_dma_driver_api = { irq_enable(DT_INST_IRQN(inst)); \ } -DT_INST_FOREACH(DW_DMAC_INIT) +DT_INST_FOREACH_STATUS_OKAY(DW_DMAC_INIT) diff --git a/drivers/dma/dmamux_stm32.c b/drivers/dma/dmamux_stm32.c index 4bdfbb62a47..5807e9c24c9 100644 --- a/drivers/dma/dmamux_stm32.c +++ b/drivers/dma/dmamux_stm32.c @@ -212,4 +212,4 @@ DEVICE_AND_API_INIT(dmamux_##index, DT_INST_LABEL(index), \ POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,\ &dma_funcs); -DT_INST_FOREACH(DMAMUX_INIT) +DT_INST_FOREACH_STATUS_OKAY(DMAMUX_INIT) diff --git a/drivers/eeprom/eeprom_at2x.c b/drivers/eeprom/eeprom_at2x.c index 892f20dc185..6b880ff55a1 100644 --- a/drivers/eeprom/eeprom_at2x.c +++ b/drivers/eeprom/eeprom_at2x.c @@ -602,7 +602,8 @@ static const struct eeprom_driver_api eeprom_at2x_api = { #define CALL_WITH_ARG(arg, expr) expr(arg); #define INST_DT_AT2X_FOREACH(t, inst_expr) \ - UTIL_LISTIFY(DT_NUM_INST(atmel_at##t), CALL_WITH_ARG, inst_expr) + UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(atmel_at##t), \ + CALL_WITH_ARG, inst_expr) #ifdef CONFIG_EEPROM_AT24 INST_DT_AT2X_FOREACH(24, EEPROM_AT24_DEVICE); diff --git a/drivers/gpio/gpio_cc32xx.c b/drivers/gpio/gpio_cc32xx.c index fed2ed994b4..2c107e8b858 100644 --- a/drivers/gpio/gpio_cc32xx.c +++ b/drivers/gpio/gpio_cc32xx.c @@ -312,4 +312,4 @@ static const struct gpio_driver_api api_funcs = { \ GPIO_CC32XX_DEVICE_INIT(n); -DT_INST_FOREACH(GPIO_CC32XX_INIT) +DT_INST_FOREACH_STATUS_OKAY(GPIO_CC32XX_INIT) diff --git a/drivers/gpio/gpio_cmsdk_ahb.c b/drivers/gpio/gpio_cmsdk_ahb.c index ba95b4ed08b..db5fff62e25 100644 --- a/drivers/gpio/gpio_cmsdk_ahb.c +++ b/drivers/gpio/gpio_cmsdk_ahb.c @@ -306,4 +306,4 @@ static int gpio_cmsdk_ahb_init(struct device *dev) irq_enable(DT_INST_IRQN(n)); \ } -DT_INST_FOREACH(CMSDK_AHB_GPIO_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(CMSDK_AHB_GPIO_DEVICE) diff --git a/drivers/gpio/gpio_gecko.c b/drivers/gpio/gpio_gecko.c index 7b8db2ae533..330667579ef 100644 --- a/drivers/gpio/gpio_gecko.c +++ b/drivers/gpio/gpio_gecko.c @@ -360,4 +360,4 @@ static int gpio_gecko_port##idx##_init(struct device *dev) \ return 0; \ } -DT_INST_FOREACH(GPIO_PORT_INIT) +DT_INST_FOREACH_STATUS_OKAY(GPIO_PORT_INIT) diff --git a/drivers/gpio/gpio_ht16k33.c b/drivers/gpio/gpio_ht16k33.c index c454e20c918..5dfb5a31c93 100644 --- a/drivers/gpio/gpio_ht16k33.c +++ b/drivers/gpio/gpio_ht16k33.c @@ -217,4 +217,4 @@ static const struct gpio_driver_api gpio_ht16k33_api = { CONFIG_GPIO_HT16K33_INIT_PRIORITY, \ &gpio_ht16k33_api); -DT_INST_FOREACH(GPIO_HT16K33_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(GPIO_HT16K33_DEVICE) diff --git a/drivers/gpio/gpio_imx.c b/drivers/gpio/gpio_imx.c index f3e0b2d35d1..398ae417982 100644 --- a/drivers/gpio/gpio_imx.c +++ b/drivers/gpio/gpio_imx.c @@ -277,4 +277,4 @@ static const struct gpio_driver_api imx_gpio_driver_api = { return 0; \ } -DT_INST_FOREACH(GPIO_IMX_INIT) +DT_INST_FOREACH_STATUS_OKAY(GPIO_IMX_INIT) diff --git a/drivers/gpio/gpio_intel_apl.c b/drivers/gpio/gpio_intel_apl.c index 112867feef2..1f757e9850a 100644 --- a/drivers/gpio/gpio_intel_apl.c +++ b/drivers/gpio/gpio_intel_apl.c @@ -602,4 +602,4 @@ DEVICE_AND_API_INIT(gpio_intel_apl_##n, \ &gpio_intel_apl_api); /* "sub" devices. no more than GPIO_INTEL_APL_NR_SUBDEVS of these! */ -DT_INST_FOREACH(GPIO_INTEL_APL_DEV_CFG_DATA) +DT_INST_FOREACH_STATUS_OKAY(GPIO_INTEL_APL_DEV_CFG_DATA) diff --git a/drivers/gpio/gpio_litex.c b/drivers/gpio/gpio_litex.c index 93229252b7e..86895d8e5d2 100644 --- a/drivers/gpio/gpio_litex.c +++ b/drivers/gpio/gpio_litex.c @@ -239,4 +239,4 @@ static const struct gpio_driver_api gpio_litex_driver_api = { &gpio_litex_driver_api \ ); -DT_INST_FOREACH(GPIO_LITEX_INIT) +DT_INST_FOREACH_STATUS_OKAY(GPIO_LITEX_INIT) diff --git a/drivers/gpio/gpio_lmp90xxx.c b/drivers/gpio/gpio_lmp90xxx.c index 4349abdc8a7..4c165109abe 100644 --- a/drivers/gpio/gpio_lmp90xxx.c +++ b/drivers/gpio/gpio_lmp90xxx.c @@ -185,4 +185,4 @@ BUILD_ASSERT(CONFIG_GPIO_LMP90XXX_INIT_PRIORITY > CONFIG_GPIO_LMP90XXX_INIT_PRIORITY, \ &gpio_lmp90xxx_api); -DT_INST_FOREACH(GPIO_LMP90XXX_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(GPIO_LMP90XXX_DEVICE) diff --git a/drivers/gpio/gpio_mcp23s17.c b/drivers/gpio/gpio_mcp23s17.c index a6ea0282671..6ea7f90e6f9 100644 --- a/drivers/gpio/gpio_mcp23s17.c +++ b/drivers/gpio/gpio_mcp23s17.c @@ -440,4 +440,4 @@ static int mcp23s17_init(struct device *dev) CONFIG_GPIO_MCP23S17_INIT_PRIORITY, \ &api_table); -DT_INST_FOREACH(MCP23S17_INIT) +DT_INST_FOREACH_STATUS_OKAY(MCP23S17_INIT) diff --git a/drivers/gpio/gpio_mcux.c b/drivers/gpio/gpio_mcux.c index e550e60dfcd..b32ea5ecb0f 100644 --- a/drivers/gpio/gpio_mcux.c +++ b/drivers/gpio/gpio_mcux.c @@ -318,4 +318,4 @@ static const struct gpio_driver_api gpio_mcux_driver_api = { return 0; \ } -DT_INST_FOREACH(GPIO_DEVICE_INIT_MCUX) +DT_INST_FOREACH_STATUS_OKAY(GPIO_DEVICE_INIT_MCUX) diff --git a/drivers/gpio/gpio_mcux_igpio.c b/drivers/gpio/gpio_mcux_igpio.c index ecc49fffc09..ded2123e72b 100644 --- a/drivers/gpio/gpio_mcux_igpio.c +++ b/drivers/gpio/gpio_mcux_igpio.c @@ -264,4 +264,4 @@ static const struct gpio_driver_api mcux_igpio_driver_api = { return 0; \ } -DT_INST_FOREACH(MCUX_IGPIO_INIT) +DT_INST_FOREACH_STATUS_OKAY(MCUX_IGPIO_INIT) diff --git a/drivers/gpio/gpio_pca95xx.c b/drivers/gpio/gpio_pca95xx.c index 92c3baed8ec..cfbcb8547b5 100644 --- a/drivers/gpio/gpio_pca95xx.c +++ b/drivers/gpio/gpio_pca95xx.c @@ -516,4 +516,4 @@ DEVICE_AND_API_INIT(gpio_pca95xx_##inst, \ POST_KERNEL, CONFIG_GPIO_PCA95XX_INIT_PRIORITY, \ &gpio_pca95xx_drv_api_funcs); -DT_INST_FOREACH(GPIO_PCA95XX_DEVICE_INSTANCE) +DT_INST_FOREACH_STATUS_OKAY(GPIO_PCA95XX_DEVICE_INSTANCE) diff --git a/drivers/gpio/gpio_rv32m1.c b/drivers/gpio/gpio_rv32m1.c index 7e08821d011..363be99e8bc 100644 --- a/drivers/gpio/gpio_rv32m1.c +++ b/drivers/gpio/gpio_rv32m1.c @@ -363,4 +363,4 @@ static const struct gpio_driver_api gpio_rv32m1_driver_api = { return 0; \ } -DT_INST_FOREACH(GPIO_RV32M1_INIT) +DT_INST_FOREACH_STATUS_OKAY(GPIO_RV32M1_INIT) diff --git a/drivers/gpio/gpio_sam.c b/drivers/gpio/gpio_sam.c index 2135eb6e5df..817f577eacb 100644 --- a/drivers/gpio/gpio_sam.c +++ b/drivers/gpio/gpio_sam.c @@ -357,4 +357,4 @@ int gpio_sam_init(struct device *dev) irq_enable(DT_INST_IRQN(n)); \ } -DT_INST_FOREACH(GPIO_SAM_INIT) +DT_INST_FOREACH_STATUS_OKAY(GPIO_SAM_INIT) diff --git a/drivers/gpio/gpio_stellaris.c b/drivers/gpio/gpio_stellaris.c index 34fa0582cd5..03b6c0fefb0 100644 --- a/drivers/gpio/gpio_stellaris.c +++ b/drivers/gpio/gpio_stellaris.c @@ -287,4 +287,4 @@ static const struct gpio_driver_api gpio_stellaris_driver_api = { irq_enable(DT_INST_IRQN(n)); \ } -DT_INST_FOREACH(STELLARIS_GPIO_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(STELLARIS_GPIO_DEVICE) diff --git a/drivers/i2c/i2c_gpio.c b/drivers/i2c/i2c_gpio.c index b7ec74efe64..111d73c563b 100644 --- a/drivers/i2c/i2c_gpio.c +++ b/drivers/i2c/i2c_gpio.c @@ -184,4 +184,4 @@ DEVICE_AND_API_INIT(i2c_gpio_##_num, DT_INST_LABEL(_num), \ &i2c_gpio_dev_cfg_##_num, \ PRE_KERNEL_2, CONFIG_I2C_INIT_PRIORITY, &api); -DT_INST_FOREACH(DEFINE_I2C_GPIO) +DT_INST_FOREACH_STATUS_OKAY(DEFINE_I2C_GPIO) diff --git a/drivers/i2c/i2c_imx.c b/drivers/i2c/i2c_imx.c index 75c94d1d172..1e90d15f4cc 100644 --- a/drivers/i2c/i2c_imx.c +++ b/drivers/i2c/i2c_imx.c @@ -387,4 +387,4 @@ static const struct i2c_driver_api i2c_imx_driver_api = { irq_enable(DT_INST_IRQN(n)); \ } -DT_INST_FOREACH(I2C_IMX_INIT) +DT_INST_FOREACH_STATUS_OKAY(I2C_IMX_INIT) diff --git a/drivers/i2c/i2c_litex.c b/drivers/i2c/i2c_litex.c index 21ce3936be3..6a854481a72 100644 --- a/drivers/i2c/i2c_litex.c +++ b/drivers/i2c/i2c_litex.c @@ -136,4 +136,4 @@ static const struct i2c_driver_api i2c_litex_driver_api = { &i2c_litex_driver_api \ ); -DT_INST_FOREACH(I2C_LITEX_INIT) +DT_INST_FOREACH_STATUS_OKAY(I2C_LITEX_INIT) diff --git a/drivers/i2c/i2c_mchp_xec.c b/drivers/i2c/i2c_mchp_xec.c index 098145dbb7f..e8666962837 100644 --- a/drivers/i2c/i2c_mchp_xec.c +++ b/drivers/i2c/i2c_mchp_xec.c @@ -429,4 +429,4 @@ static int i2c_xec_init(struct device *dev) POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ &i2c_xec_driver_api); -DT_INST_FOREACH(I2C_XEC_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(I2C_XEC_DEVICE) diff --git a/drivers/i2c/i2c_mcux.c b/drivers/i2c/i2c_mcux.c index ad92929dad1..8231a512214 100644 --- a/drivers/i2c/i2c_mcux.c +++ b/drivers/i2c/i2c_mcux.c @@ -232,4 +232,4 @@ static const struct i2c_driver_api i2c_mcux_driver_api = { irq_enable(DT_INST_IRQN(n)); \ } -DT_INST_FOREACH(I2C_DEVICE_INIT_MCUX) +DT_INST_FOREACH_STATUS_OKAY(I2C_DEVICE_INIT_MCUX) diff --git a/drivers/i2c/i2c_mcux_flexcomm.c b/drivers/i2c/i2c_mcux_flexcomm.c index 79a27541fc7..c14d3a2f293 100644 --- a/drivers/i2c/i2c_mcux_flexcomm.c +++ b/drivers/i2c/i2c_mcux_flexcomm.c @@ -225,4 +225,4 @@ static const struct i2c_driver_api mcux_flexcomm_driver_api = { irq_enable(DT_INST_IRQN(id)); \ } \ -DT_INST_FOREACH(I2C_MCUX_FLEXCOMM_DEVICE); +DT_INST_FOREACH_STATUS_OKAY(I2C_MCUX_FLEXCOMM_DEVICE) diff --git a/drivers/i2c/i2c_mcux_lpi2c.c b/drivers/i2c/i2c_mcux_lpi2c.c index f8ada07fae8..5019bf4d779 100644 --- a/drivers/i2c/i2c_mcux_lpi2c.c +++ b/drivers/i2c/i2c_mcux_lpi2c.c @@ -254,4 +254,4 @@ static const struct i2c_driver_api mcux_lpi2c_driver_api = { irq_enable(DT_INST_IRQN(n)); \ } -DT_INST_FOREACH(I2C_MCUX_LPI2C_INIT) +DT_INST_FOREACH_STATUS_OKAY(I2C_MCUX_LPI2C_INIT) diff --git a/drivers/i2c/i2c_rv32m1_lpi2c.c b/drivers/i2c/i2c_rv32m1_lpi2c.c index 32fa2120b17..2a483eeac2d 100644 --- a/drivers/i2c/i2c_rv32m1_lpi2c.c +++ b/drivers/i2c/i2c_rv32m1_lpi2c.c @@ -296,4 +296,4 @@ static const struct i2c_driver_api rv32m1_lpi2c_driver_api = { irq_enable(DT_INST_IRQN(id)); \ } \ -DT_INST_FOREACH(RV32M1_LPI2C_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(RV32M1_LPI2C_DEVICE) diff --git a/drivers/i2c/i2c_sam0.c b/drivers/i2c/i2c_sam0.c index 553a691d319..88956eef0b7 100644 --- a/drivers/i2c/i2c_sam0.c +++ b/drivers/i2c/i2c_sam0.c @@ -804,4 +804,4 @@ static const struct i2c_sam0_dev_config i2c_sam0_dev_config_##n = { \ &i2c_sam0_driver_api); \ I2C_SAM0_IRQ_HANDLER(n) -DT_INST_FOREACH(I2C_SAM0_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(I2C_SAM0_DEVICE) diff --git a/drivers/i2c/i2c_sam_twi.c b/drivers/i2c/i2c_sam_twi.c index f34264ad496..3ae1522f7d2 100644 --- a/drivers/i2c/i2c_sam_twi.c +++ b/drivers/i2c/i2c_sam_twi.c @@ -369,4 +369,4 @@ static const struct i2c_driver_api i2c_sam_twi_driver_api = { POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ &i2c_sam_twi_driver_api); -DT_INST_FOREACH(I2C_TWI_SAM_INIT) +DT_INST_FOREACH_STATUS_OKAY(I2C_TWI_SAM_INIT) diff --git a/drivers/i2c/i2c_sam_twihs.c b/drivers/i2c/i2c_sam_twihs.c index fee767bffc0..bfcfeb83c1d 100644 --- a/drivers/i2c/i2c_sam_twihs.c +++ b/drivers/i2c/i2c_sam_twihs.c @@ -356,4 +356,4 @@ static const struct i2c_driver_api i2c_sam_twihs_driver_api = { POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ &i2c_sam_twihs_driver_api); -DT_INST_FOREACH(I2C_TWIHS_SAM_INIT) +DT_INST_FOREACH_STATUS_OKAY(I2C_TWIHS_SAM_INIT) diff --git a/drivers/i2c/i2c_sbcon.c b/drivers/i2c/i2c_sbcon.c index 3d1f2034806..446a0c25523 100644 --- a/drivers/i2c/i2c_sbcon.c +++ b/drivers/i2c/i2c_sbcon.c @@ -122,4 +122,4 @@ DEVICE_AND_API_INIT(i2c_sbcon_##_num, DT_INST_LABEL(_num), \ &i2c_sbcon_dev_cfg_##_num, \ PRE_KERNEL_2, CONFIG_I2C_INIT_PRIORITY, &api); -DT_INST_FOREACH(DEFINE_I2C_SBCON) +DT_INST_FOREACH_STATUS_OKAY(DEFINE_I2C_SBCON) diff --git a/drivers/i2c/i2c_sifive.c b/drivers/i2c/i2c_sifive.c index e0d8f389d38..b7c9c4d01bb 100644 --- a/drivers/i2c/i2c_sifive.c +++ b/drivers/i2c/i2c_sifive.c @@ -338,4 +338,4 @@ static struct i2c_driver_api i2c_sifive_api = { CONFIG_I2C_INIT_PRIORITY, \ &i2c_sifive_api); -DT_INST_FOREACH(I2C_SIFIVE_INIT) +DT_INST_FOREACH_STATUS_OKAY(I2C_SIFIVE_INIT) diff --git a/drivers/i2c/slave/eeprom_slave.c b/drivers/i2c/slave/eeprom_slave.c index 7fbdb1c0d20..3727888b706 100644 --- a/drivers/i2c/slave/eeprom_slave.c +++ b/drivers/i2c/slave/eeprom_slave.c @@ -229,4 +229,4 @@ static int i2c_eeprom_slave_init(struct device *dev) CONFIG_I2C_SLAVE_INIT_PRIORITY, \ &api_funcs); -DT_INST_FOREACH(I2C_EEPROM_INIT) +DT_INST_FOREACH_STATUS_OKAY(I2C_EEPROM_INIT) diff --git a/drivers/ieee802154/ieee802154_rf2xx.c b/drivers/ieee802154/ieee802154_rf2xx.c index d30caefc2a1..ba51d8351a1 100644 --- a/drivers/ieee802154/ieee802154_rf2xx.c +++ b/drivers/ieee802154/ieee802154_rf2xx.c @@ -930,4 +930,4 @@ static struct ieee802154_radio_api rf2xx_radio_api = { (IEEE802154_RF2XX_RAW_DEVICE_INIT(inst);), \ (IEEE802154_RF2XX_NET_DEVICE_INIT(inst);)) -DT_INST_FOREACH(IEEE802154_RF2XX_INIT) +DT_INST_FOREACH_STATUS_OKAY(IEEE802154_RF2XX_INIT) diff --git a/drivers/interrupt_controller/intc_cavs.c b/drivers/interrupt_controller/intc_cavs.c index a4cd8ee834e..e03d97baa2b 100644 --- a/drivers/interrupt_controller/intc_cavs.c +++ b/drivers/interrupt_controller/intc_cavs.c @@ -152,4 +152,4 @@ static const struct irq_next_level_api cavs_apis = { DT_INST_IRQ(n, sense)); \ } -DT_INST_FOREACH(CAVS_ICTL_INIT) +DT_INST_FOREACH_STATUS_OKAY(CAVS_ICTL_INIT) diff --git a/drivers/led/ht16k33.c b/drivers/led/ht16k33.c index 21a1d785a4a..12888533abe 100644 --- a/drivers/led/ht16k33.c +++ b/drivers/led/ht16k33.c @@ -501,6 +501,6 @@ static const struct led_driver_api ht16k33_leds_api = { #define HT16K33_INSTANTIATE(id) \ COND_CODE_1(DT_INST_NODE_HAS_PROP(id, irq_gpios), \ (HT16K33_DEVICE_WITH_IRQ(id)), \ - (HT16K33_DEVICE(id))) + (HT16K33_DEVICE(id))); -DT_INST_FOREACH(HT16K33_INSTANTIATE); +DT_INST_FOREACH_STATUS_OKAY(HT16K33_INSTANTIATE) diff --git a/drivers/led_strip/ws2812_gpio.c b/drivers/led_strip/ws2812_gpio.c index b8ff3e6173d..059e2fd7d4f 100644 --- a/drivers/led_strip/ws2812_gpio.c +++ b/drivers/led_strip/ws2812_gpio.c @@ -240,4 +240,4 @@ static const struct led_strip_driver_api ws2812_gpio_api = { CONFIG_LED_STRIP_INIT_PRIORITY, \ &ws2812_gpio_api); -DT_INST_FOREACH(WS2812_GPIO_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(WS2812_GPIO_DEVICE) diff --git a/drivers/led_strip/ws2812_spi.c b/drivers/led_strip/ws2812_spi.c index 4740a1d6a0f..99b69896216 100644 --- a/drivers/led_strip/ws2812_spi.c +++ b/drivers/led_strip/ws2812_spi.c @@ -230,4 +230,4 @@ static const struct led_strip_driver_api ws2812_spi_api = { CONFIG_LED_STRIP_INIT_PRIORITY, \ &ws2812_spi_api); -DT_INST_FOREACH(WS2812_SPI_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(WS2812_SPI_DEVICE) diff --git a/drivers/pinmux/pinmux_rv32m1.c b/drivers/pinmux/pinmux_rv32m1.c index 4dbcb18c2b0..6215d523676 100644 --- a/drivers/pinmux/pinmux_rv32m1.c +++ b/drivers/pinmux/pinmux_rv32m1.c @@ -78,4 +78,4 @@ static const struct pinmux_driver_api pinmux_rv32m1_driver_api = { CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ &pinmux_rv32m1_driver_api); -DT_INST_FOREACH(PINMUX_RV32M1_INIT) +DT_INST_FOREACH_STATUS_OKAY(PINMUX_RV32M1_INIT) diff --git a/drivers/pwm/pwm_imx.c b/drivers/pwm/pwm_imx.c index ec4dda563ef..bdd4e07bc23 100644 --- a/drivers/pwm/pwm_imx.c +++ b/drivers/pwm/pwm_imx.c @@ -172,7 +172,7 @@ static const struct pwm_driver_api imx_pwm_driver_api = { CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &imx_pwm_driver_api); -#if DT_HAS_COMPAT(fsl_imx7d_pwm) +#if DT_HAS_COMPAT_STATUS_OKAY(fsl_imx7d_pwm) #define DT_DRV_COMPAT fsl_imx7d_pwm -DT_INST_FOREACH(PWM_IMX_INIT) +DT_INST_FOREACH_STATUS_OKAY(PWM_IMX_INIT) #endif diff --git a/drivers/pwm/pwm_litex.c b/drivers/pwm/pwm_litex.c index 6d51eefb9af..a6ab4c9cee1 100644 --- a/drivers/pwm/pwm_litex.c +++ b/drivers/pwm/pwm_litex.c @@ -113,4 +113,4 @@ static const struct pwm_driver_api pwm_litex_driver_api = { &pwm_litex_driver_api \ ); -DT_INST_FOREACH(PWM_LITEX_INIT) +DT_INST_FOREACH_STATUS_OKAY(PWM_LITEX_INIT) diff --git a/drivers/pwm/pwm_mchp_xec.c b/drivers/pwm/pwm_mchp_xec.c index bb084d43dac..2172c142479 100644 --- a/drivers/pwm/pwm_mchp_xec.c +++ b/drivers/pwm/pwm_mchp_xec.c @@ -396,4 +396,4 @@ static struct pwm_driver_api pwm_xec_api = { CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &pwm_xec_api); -DT_INST_FOREACH(XEC_INST_INIT) +DT_INST_FOREACH_STATUS_OKAY(XEC_INST_INIT) diff --git a/drivers/pwm/pwm_mcux.c b/drivers/pwm/pwm_mcux.c index 14c5db87d90..ea85892aa43 100644 --- a/drivers/pwm/pwm_mcux.c +++ b/drivers/pwm/pwm_mcux.c @@ -171,4 +171,4 @@ static const struct pwm_driver_api pwm_mcux_driver_api = { POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,\ &pwm_mcux_driver_api); -DT_INST_FOREACH(PWM_DEVICE_INIT_MCUX) +DT_INST_FOREACH_STATUS_OKAY(PWM_DEVICE_INIT_MCUX) diff --git a/drivers/pwm/pwm_mcux_ftm.c b/drivers/pwm/pwm_mcux_ftm.c index dbfd682efc7..d9e41bbf597 100644 --- a/drivers/pwm/pwm_mcux_ftm.c +++ b/drivers/pwm/pwm_mcux_ftm.c @@ -172,4 +172,4 @@ static const struct pwm_driver_api mcux_ftm_driver_api = { POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &mcux_ftm_driver_api); -DT_INST_FOREACH(FTM_DEVICE); +DT_INST_FOREACH_STATUS_OKAY(FTM_DEVICE) diff --git a/drivers/pwm/pwm_mcux_tpm.c b/drivers/pwm/pwm_mcux_tpm.c index d2c790a471a..99495bd5ea2 100644 --- a/drivers/pwm/pwm_mcux_tpm.c +++ b/drivers/pwm/pwm_mcux_tpm.c @@ -201,4 +201,4 @@ static const struct pwm_driver_api mcux_tpm_driver_api = { POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &mcux_tpm_driver_api); -DT_INST_FOREACH(TPM_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(TPM_DEVICE) diff --git a/drivers/pwm/pwm_rv32m1_tpm.c b/drivers/pwm/pwm_rv32m1_tpm.c index 481ad686da0..2cdf26a346f 100644 --- a/drivers/pwm/pwm_rv32m1_tpm.c +++ b/drivers/pwm/pwm_rv32m1_tpm.c @@ -200,4 +200,4 @@ static const struct pwm_driver_api rv32m1_tpm_driver_api = { POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &rv32m1_tpm_driver_api); -DT_INST_FOREACH(TPM_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(TPM_DEVICE) diff --git a/drivers/pwm/pwm_sam.c b/drivers/pwm/pwm_sam.c index f092f5fe3d8..0ef7233a743 100644 --- a/drivers/pwm/pwm_sam.c +++ b/drivers/pwm/pwm_sam.c @@ -113,4 +113,4 @@ static const struct pwm_driver_api sam_pwm_driver_api = { CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &sam_pwm_driver_api); -DT_INST_FOREACH(SAM_INST_INIT) +DT_INST_FOREACH_STATUS_OKAY(SAM_INST_INIT) diff --git a/drivers/pwm/pwm_sifive.c b/drivers/pwm/pwm_sifive.c index f7438b2375c..0139afd6e78 100644 --- a/drivers/pwm/pwm_sifive.c +++ b/drivers/pwm/pwm_sifive.c @@ -238,4 +238,4 @@ static const struct pwm_driver_api pwm_sifive_api = { CONFIG_PWM_SIFIVE_INIT_PRIORITY, \ &pwm_sifive_api); -DT_INST_FOREACH(PWM_SIFIVE_INIT) +DT_INST_FOREACH_STATUS_OKAY(PWM_SIFIVE_INIT) diff --git a/drivers/pwm/pwm_stm32.c b/drivers/pwm/pwm_stm32.c index d3964f2bc41..c6f1ccc87d4 100644 --- a/drivers/pwm/pwm_stm32.c +++ b/drivers/pwm/pwm_stm32.c @@ -275,4 +275,4 @@ static int pwm_stm32_init(struct device *dev) POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,\ &pwm_stm32_drv_api_funcs); -DT_INST_FOREACH(PWM_DEVICE_INIT_STM32) +DT_INST_FOREACH_STATUS_OKAY(PWM_DEVICE_INIT_STM32) diff --git a/drivers/sensor/bme280/bme280.c b/drivers/sensor/bme280/bme280.c index 80276341c71..6bcab39b16b 100644 --- a/drivers/sensor/bme280/bme280.c +++ b/drivers/sensor/bme280/bme280.c @@ -22,12 +22,12 @@ #define DT_DRV_COMPAT bosch_bme280 -#define BME280_BUS_SPI DT_ANY_INST_ON_BUS(spi) -#define BME280_BUS_I2C DT_ANY_INST_ON_BUS(i2c) +#define BME280_BUS_SPI DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) +#define BME280_BUS_I2C DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) LOG_MODULE_REGISTER(BME280, CONFIG_SENSOR_LOG_LEVEL); -#if DT_NUM_INST(DT_DRV_COMPAT) == 0 +#if DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 0 #warning "BME280 driver enabled without any devices" #endif @@ -595,7 +595,7 @@ done: &bme280_config_##inst, \ POST_KERNEL, \ CONFIG_SENSOR_INIT_PRIORITY, \ - &bme280_api_funcs) + &bme280_api_funcs); /* * Instantiation macros used when a device is on a SPI bus. @@ -676,4 +676,4 @@ done: (BME280_DEFINE_SPI(inst)), \ (BME280_DEFINE_I2C(inst))) -DT_INST_FOREACH(BME280_DEFINE); +DT_INST_FOREACH_STATUS_OKAY(BME280_DEFINE) diff --git a/drivers/sensor/bq274xx/bq274xx.c b/drivers/sensor/bq274xx/bq274xx.c index 36e203a0102..851f83683a1 100644 --- a/drivers/sensor/bq274xx/bq274xx.c +++ b/drivers/sensor/bq274xx/bq274xx.c @@ -630,4 +630,4 @@ static const struct sensor_driver_api bq274xx_battery_driver_api = { CONFIG_SENSOR_INIT_PRIORITY, \ &bq274xx_battery_driver_api); -DT_INST_FOREACH(BQ274XX_INIT) +DT_INST_FOREACH_STATUS_OKAY(BQ274XX_INIT) diff --git a/drivers/sensor/iis2dlpc/iis2dlpc.c b/drivers/sensor/iis2dlpc/iis2dlpc.c index 4113938c1a1..04b96d8ae7f 100644 --- a/drivers/sensor/iis2dlpc/iis2dlpc.c +++ b/drivers/sensor/iis2dlpc/iis2dlpc.c @@ -16,9 +16,9 @@ #include #include -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #include -#elif DT_ANY_INST_ON_BUS(i2c) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) #include #endif @@ -222,9 +222,9 @@ static int iis2dlpc_init_interface(struct device *dev) return -EINVAL; } -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) iis2dlpc_spi_init(dev); -#elif DT_ANY_INST_ON_BUS(i2c) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) iis2dlpc_i2c_init(dev); #else #error "BUS MACRO NOT DEFINED IN DTS" diff --git a/drivers/sensor/iis2dlpc/iis2dlpc_i2c.c b/drivers/sensor/iis2dlpc/iis2dlpc_i2c.c index a3e1875c76b..be8fef659d4 100644 --- a/drivers/sensor/iis2dlpc/iis2dlpc_i2c.c +++ b/drivers/sensor/iis2dlpc/iis2dlpc_i2c.c @@ -16,7 +16,7 @@ #include "iis2dlpc.h" -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) static u16_t iis2dlpc_i2c_slave_addr = DT_INST_REG_ADDR(0); @@ -50,4 +50,4 @@ int iis2dlpc_i2c_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(i2c) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ diff --git a/drivers/sensor/iis2dlpc/iis2dlpc_spi.c b/drivers/sensor/iis2dlpc/iis2dlpc_spi.c index c5db364f7b4..f6888eba6ff 100644 --- a/drivers/sensor/iis2dlpc/iis2dlpc_spi.c +++ b/drivers/sensor/iis2dlpc/iis2dlpc_spi.c @@ -15,7 +15,7 @@ #include "iis2dlpc.h" #include -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #define IIS2DLPC_SPI_READ (1 << 7) @@ -125,4 +125,4 @@ int iis2dlpc_spi_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(spi) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ diff --git a/drivers/sensor/iis2mdc/iis2mdc.c b/drivers/sensor/iis2mdc/iis2mdc.c index 9863bdea93e..b561518cd03 100644 --- a/drivers/sensor/iis2mdc/iis2mdc.c +++ b/drivers/sensor/iis2mdc/iis2mdc.c @@ -263,7 +263,7 @@ static const struct iis2mdc_config iis2mdc_dev_config = { .drdy_pin = DT_INST_GPIO_PIN(0, drdy_gpios), .drdy_flags = DT_INST_GPIO_FLAGS(0, drdy_gpios), #endif /* CONFIG_IIS2MDC_TRIGGER */ -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) .bus_init = iis2mdc_spi_init, .spi_conf.frequency = DT_INST_PROP(0, spi_max_frequency), .spi_conf.operation = (SPI_OP_MODE_MASTER | SPI_MODE_CPOL | @@ -278,7 +278,7 @@ static const struct iis2mdc_config iis2mdc_dev_config = { #else .spi_conf.cs = NULL, #endif -#elif DT_ANY_INST_ON_BUS(i2c) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) .bus_init = iis2mdc_i2c_init, .i2c_slv_addr = DT_INST_REG_ADDR(0), #else diff --git a/drivers/sensor/iis2mdc/iis2mdc.h b/drivers/sensor/iis2mdc/iis2mdc.h index a3e1e9e8507..048a1281fbb 100644 --- a/drivers/sensor/iis2mdc/iis2mdc.h +++ b/drivers/sensor/iis2mdc/iis2mdc.h @@ -35,15 +35,15 @@ struct iis2mdc_config { gpio_pin_t drdy_pin; gpio_dt_flags_t drdy_flags; #endif /* CONFIG_IIS2MDC_TRIGGER */ -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) u16_t i2c_slv_addr; -#elif DT_ANY_INST_ON_BUS(spi) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) struct spi_config spi_conf; #if DT_INST_SPI_DEV_HAS_CS_GPIOS(0) const char *gpio_cs_port; u8_t cs_gpio; #endif /* DT_INST_SPI_DEV_HAS_CS_GPIOS(0) */ -#endif /* DT_ANY_INST_ON_BUS(spi) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ }; /* Sensor data */ @@ -55,9 +55,9 @@ struct iis2mdc_data { stmdev_ctx_t *ctx; -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) stmdev_ctx_t ctx_i2c; -#elif DT_ANY_INST_ON_BUS(spi) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) stmdev_ctx_t ctx_spi; #endif diff --git a/drivers/sensor/iis2mdc/iis2mdc_i2c.c b/drivers/sensor/iis2mdc/iis2mdc_i2c.c index 1b756c45c18..b922a861476 100644 --- a/drivers/sensor/iis2mdc/iis2mdc_i2c.c +++ b/drivers/sensor/iis2mdc/iis2mdc_i2c.c @@ -16,7 +16,7 @@ #include "iis2mdc.h" -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) #define LOG_LEVEL CONFIG_SENSOR_LOG_LEVEL LOG_MODULE_DECLARE(IIS2MDC); @@ -53,4 +53,4 @@ int iis2mdc_i2c_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(i2c) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ diff --git a/drivers/sensor/iis2mdc/iis2mdc_spi.c b/drivers/sensor/iis2mdc/iis2mdc_spi.c index b36a4690f7b..25a08ba2fd5 100644 --- a/drivers/sensor/iis2mdc/iis2mdc_spi.c +++ b/drivers/sensor/iis2mdc/iis2mdc_spi.c @@ -14,7 +14,7 @@ #include "iis2mdc.h" #include -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #define IIS2MDC_SPI_READ (1 << 7) @@ -133,4 +133,4 @@ int iis2mdc_spi_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(spi) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ diff --git a/drivers/sensor/iis3dhhc/iis3dhhc.c b/drivers/sensor/iis3dhhc/iis3dhhc.c index 1150191e470..62d77b47ff1 100644 --- a/drivers/sensor/iis3dhhc/iis3dhhc.c +++ b/drivers/sensor/iis3dhhc/iis3dhhc.c @@ -232,7 +232,7 @@ static const struct iis3dhhc_config iis3dhhc_config = { .int_flags = DT_INST_GPIO_FLAGS_BY_IDX(0, irq_gpios, 1), #endif /* CONFIG_IIS3DHHC_DRDY_INT1 */ #endif /* CONFIG_IIS3DHHC_TRIGGER */ -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) .bus_init = iis3dhhc_spi_init, .spi_conf.frequency = DT_INST_PROP(0, spi_max_frequency), .spi_conf.operation = (SPI_OP_MODE_MASTER | SPI_MODE_CPOL | diff --git a/drivers/sensor/iis3dhhc/iis3dhhc.h b/drivers/sensor/iis3dhhc/iis3dhhc.h index 555cd44abd2..baebf90fb20 100644 --- a/drivers/sensor/iis3dhhc/iis3dhhc.h +++ b/drivers/sensor/iis3dhhc/iis3dhhc.h @@ -32,7 +32,7 @@ struct iis3dhhc_config { u8_t int_pin; u8_t int_flags; #endif -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) struct spi_config spi_conf; #if DT_INST_SPI_DEV_HAS_CS_GPIOS(0) const char *gpio_cs_port; @@ -47,7 +47,7 @@ struct iis3dhhc_data { stmdev_ctx_t *ctx; -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) stmdev_ctx_t ctx_spi; #endif diff --git a/drivers/sensor/iis3dhhc/iis3dhhc_spi.c b/drivers/sensor/iis3dhhc/iis3dhhc_spi.c index 4dd714be35f..8a50a944596 100644 --- a/drivers/sensor/iis3dhhc/iis3dhhc_spi.c +++ b/drivers/sensor/iis3dhhc/iis3dhhc_spi.c @@ -14,7 +14,7 @@ #include "iis3dhhc.h" #include -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #define IIS3DHHC_SPI_READ (1 << 7) @@ -124,4 +124,4 @@ int iis3dhhc_spi_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(spi) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ diff --git a/drivers/sensor/ism330dhcx/ism330dhcx.c b/drivers/sensor/ism330dhcx/ism330dhcx.c index 41fced3a358..543551686b2 100644 --- a/drivers/sensor/ism330dhcx/ism330dhcx.c +++ b/drivers/sensor/ism330dhcx/ism330dhcx.c @@ -752,7 +752,7 @@ static struct ism330dhcx_data ism330dhcx_data; static const struct ism330dhcx_config ism330dhcx_config = { .bus_name = DT_INST_BUS_LABEL(0), -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) .bus_init = ism330dhcx_spi_init, .spi_conf.frequency = DT_INST_PROP(0, spi_max_frequency), .spi_conf.operation = (SPI_OP_MODE_MASTER | SPI_MODE_CPOL | @@ -767,7 +767,7 @@ static const struct ism330dhcx_config ism330dhcx_config = { #else .spi_conf.cs = NULL, #endif -#elif DT_ANY_INST_ON_BUS(i2c) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) .bus_init = ism330dhcx_i2c_init, .i2c_slv_addr = DT_INST_REG_ADDR(0), #else diff --git a/drivers/sensor/ism330dhcx/ism330dhcx.h b/drivers/sensor/ism330dhcx/ism330dhcx.h index ce680224352..eccccd60443 100644 --- a/drivers/sensor/ism330dhcx/ism330dhcx.h +++ b/drivers/sensor/ism330dhcx/ism330dhcx.h @@ -100,15 +100,15 @@ struct ism330dhcx_config { u8_t int_gpio_flags; u8_t int_pin; #endif /* CONFIG_ISM330DHCX_TRIGGER */ -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) u16_t i2c_slv_addr; -#elif DT_ANY_INST_ON_BUS(spi) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) struct spi_config spi_conf; #if DT_INST_SPI_DEV_HAS_CS_GPIOS(0) const char *gpio_cs_port; u8_t cs_gpio; #endif /* DT_INST_SPI_DEV_HAS_CS_GPIOS(0) */ -#endif /* DT_ANY_INST_ON_BUS(i2c) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ }; union samples { @@ -159,9 +159,9 @@ struct ism330dhcx_data { stmdev_ctx_t *ctx; - #if DT_ANY_INST_ON_BUS(i2c) + #if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) stmdev_ctx_t ctx_i2c; - #elif DT_ANY_INST_ON_BUS(spi) + #elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) stmdev_ctx_t ctx_spi; #endif diff --git a/drivers/sensor/ism330dhcx/ism330dhcx_i2c.c b/drivers/sensor/ism330dhcx/ism330dhcx_i2c.c index 44250f8bf65..513c45c2f4e 100644 --- a/drivers/sensor/ism330dhcx/ism330dhcx_i2c.c +++ b/drivers/sensor/ism330dhcx/ism330dhcx_i2c.c @@ -16,7 +16,7 @@ #include "ism330dhcx.h" -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) LOG_MODULE_DECLARE(ISM330DHCX, CONFIG_SENSOR_LOG_LEVEL); @@ -52,4 +52,4 @@ int ism330dhcx_i2c_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(i2c) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ diff --git a/drivers/sensor/ism330dhcx/ism330dhcx_spi.c b/drivers/sensor/ism330dhcx/ism330dhcx_spi.c index 03d7fcff2c5..adb0be6bfb2 100644 --- a/drivers/sensor/ism330dhcx/ism330dhcx_spi.c +++ b/drivers/sensor/ism330dhcx/ism330dhcx_spi.c @@ -14,7 +14,7 @@ #include "ism330dhcx.h" #include -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #define ISM330DHCX_SPI_READ (1 << 7) @@ -125,4 +125,4 @@ int ism330dhcx_spi_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(spi) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ diff --git a/drivers/sensor/lis2dh/lis2dh.c b/drivers/sensor/lis2dh/lis2dh.c index f3192aeca9f..aaaa445f7bf 100644 --- a/drivers/sensor/lis2dh/lis2dh.c +++ b/drivers/sensor/lis2dh/lis2dh.c @@ -350,7 +350,7 @@ static struct lis2dh_data lis2dh_data; static const struct lis2dh_config lis2dh_config = { .bus_name = DT_INST_BUS_LABEL(0), -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) .bus_init = lis2dh_spi_init, .spi_conf.frequency = DT_INST_PROP(0, spi_max_frequency), .spi_conf.operation = (SPI_OP_MODE_MASTER | SPI_MODE_CPOL | @@ -364,7 +364,7 @@ static const struct lis2dh_config lis2dh_config = { #else .spi_conf.cs = NULL, #endif -#elif DT_ANY_INST_ON_BUS(i2c) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) .bus_init = lis2dh_i2c_init, .i2c_slv_addr = DT_INST_REG_ADDR(0), #else diff --git a/drivers/sensor/lis2dh/lis2dh.h b/drivers/sensor/lis2dh/lis2dh.h index d994b4b2b08..79498d16fb9 100644 --- a/drivers/sensor/lis2dh/lis2dh.h +++ b/drivers/sensor/lis2dh/lis2dh.h @@ -21,7 +21,7 @@ #define LIS2DH_REG_WAI 0x0f #define LIS2DH_CHIP_ID 0x33 -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #include #define LIS2DH_SPI_READ_BIT BIT(7) @@ -31,7 +31,7 @@ /* LIS2DH supports only SPI mode 0, word size 8 bits, MSB first */ #define LIS2DH_SPI_CFG SPI_WORD_SET(8) -#elif DT_ANY_INST_ON_BUS(i2c) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) #include #else #error "define bus type (I2C/SPI)" @@ -200,15 +200,15 @@ union lis2dh_sample { struct lis2dh_config { char *bus_name; int (*bus_init)(struct device *dev); -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) u16_t i2c_slv_addr; -#elif DT_ANY_INST_ON_BUS(spi) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) struct spi_config spi_conf; #if DT_INST_SPI_DEV_HAS_CS_GPIOS(0) const char *gpio_cs_port; u8_t cs_gpio; #endif /* DT_INST_SPI_DEV_HAS_CS_GPIOS(0) */ -#endif /* DT_ANY_INST_ON_BUS(spi) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ }; @@ -259,7 +259,7 @@ struct lis2dh_data { #endif /* DT_SPI_DEV_HAS_CS_GPIOS(DT_INST(0, st_lis2mdl)) */ }; -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) int lis2dh_spi_access(struct lis2dh_data *ctx, u8_t cmd, void *data, size_t length); #endif diff --git a/drivers/sensor/lis2dh/lis2dh_i2c.c b/drivers/sensor/lis2dh/lis2dh_i2c.c index 34758cdd555..b544e5d6603 100644 --- a/drivers/sensor/lis2dh/lis2dh_i2c.c +++ b/drivers/sensor/lis2dh/lis2dh_i2c.c @@ -16,7 +16,7 @@ #include "lis2dh.h" -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) LOG_MODULE_DECLARE(lis2dh, CONFIG_SENSOR_LOG_LEVEL); @@ -91,4 +91,4 @@ int lis2dh_i2c_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(i2c) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ diff --git a/drivers/sensor/lis2dh/lis2dh_spi.c b/drivers/sensor/lis2dh/lis2dh_spi.c index 0d02125b217..52bc906e66a 100644 --- a/drivers/sensor/lis2dh/lis2dh_spi.c +++ b/drivers/sensor/lis2dh/lis2dh_spi.c @@ -14,7 +14,7 @@ #include "lis2dh.h" #include -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) LOG_MODULE_DECLARE(lis2dh, CONFIG_SENSOR_LOG_LEVEL); @@ -172,4 +172,4 @@ int lis2dh_spi_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(spi) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ diff --git a/drivers/sensor/lis2ds12/lis2ds12.c b/drivers/sensor/lis2ds12/lis2ds12.c index 5f0d98f1cb6..0255c454df5 100644 --- a/drivers/sensor/lis2ds12/lis2ds12.c +++ b/drivers/sensor/lis2ds12/lis2ds12.c @@ -27,9 +27,9 @@ static struct lis2ds12_data lis2ds12_data; static struct lis2ds12_config lis2ds12_config = { .comm_master_dev_name = DT_INST_BUS_LABEL(0), -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) .bus_init = lis2ds12_spi_init, -#elif DT_ANY_INST_ON_BUS(i2c) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) .bus_init = lis2ds12_i2c_init, #else #error "BUS MACRO NOT DEFINED IN DTS" diff --git a/drivers/sensor/lis2ds12/lis2ds12_i2c.c b/drivers/sensor/lis2ds12/lis2ds12_i2c.c index 5d09f778520..8da349c3665 100644 --- a/drivers/sensor/lis2ds12/lis2ds12_i2c.c +++ b/drivers/sensor/lis2ds12/lis2ds12_i2c.c @@ -16,7 +16,7 @@ #include "lis2ds12.h" -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) static u16_t lis2ds12_i2c_slave_addr = DT_INST_REG_ADDR(0); @@ -73,4 +73,4 @@ int lis2ds12_i2c_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(i2c) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ diff --git a/drivers/sensor/lis2ds12/lis2ds12_spi.c b/drivers/sensor/lis2ds12/lis2ds12_spi.c index 90dffc94533..48d162752b0 100644 --- a/drivers/sensor/lis2ds12/lis2ds12_spi.c +++ b/drivers/sensor/lis2ds12/lis2ds12_spi.c @@ -16,7 +16,7 @@ #include "lis2ds12.h" #include -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #define LIS2DS12_SPI_READ (1 << 7) @@ -178,4 +178,4 @@ int lis2ds12_spi_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(spi) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ diff --git a/drivers/sensor/lis2dw12/lis2dw12.c b/drivers/sensor/lis2dw12/lis2dw12.c index 783abe33f15..75c71207e51 100644 --- a/drivers/sensor/lis2dw12/lis2dw12.c +++ b/drivers/sensor/lis2dw12/lis2dw12.c @@ -16,9 +16,9 @@ #include #include -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #include -#elif DT_ANY_INST_ON_BUS(i2c) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) #include #endif @@ -222,9 +222,9 @@ static int lis2dw12_init_interface(struct device *dev) return -EINVAL; } -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) lis2dw12_spi_init(dev); -#elif DT_ANY_INST_ON_BUS(i2c) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) lis2dw12_i2c_init(dev); #else #error "BUS MACRO NOT DEFINED IN DTS" diff --git a/drivers/sensor/lis2dw12/lis2dw12_i2c.c b/drivers/sensor/lis2dw12/lis2dw12_i2c.c index fc76a499c3d..d7e9c297a4a 100644 --- a/drivers/sensor/lis2dw12/lis2dw12_i2c.c +++ b/drivers/sensor/lis2dw12/lis2dw12_i2c.c @@ -16,7 +16,7 @@ #include "lis2dw12.h" -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) static u16_t lis2dw12_i2c_slave_addr = DT_INST_REG_ADDR(0); @@ -50,4 +50,4 @@ int lis2dw12_i2c_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(i2c) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ diff --git a/drivers/sensor/lis2dw12/lis2dw12_spi.c b/drivers/sensor/lis2dw12/lis2dw12_spi.c index 87c760b889b..69881a1f09c 100644 --- a/drivers/sensor/lis2dw12/lis2dw12_spi.c +++ b/drivers/sensor/lis2dw12/lis2dw12_spi.c @@ -15,7 +15,7 @@ #include "lis2dw12.h" #include -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #define LIS2DW12_SPI_READ (1 << 7) @@ -125,4 +125,4 @@ int lis2dw12_spi_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(spi) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ diff --git a/drivers/sensor/lis2mdl/lis2mdl.c b/drivers/sensor/lis2mdl/lis2mdl.c index ad6613520d5..5d9fe5ed5db 100644 --- a/drivers/sensor/lis2mdl/lis2mdl.c +++ b/drivers/sensor/lis2mdl/lis2mdl.c @@ -263,7 +263,7 @@ static const struct lis2mdl_config lis2mdl_dev_config = { .gpio_pin = DT_INST_GPIO_PIN(0, irq_gpios), .gpio_flags = DT_INST_GPIO_FLAGS(0, irq_gpios), #endif /* CONFIG_LIS2MDL_TRIGGER */ -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) .bus_init = lis2mdl_spi_init, .spi_conf.frequency = DT_INST_PROP(0, spi_max_frequency), .spi_conf.operation = (SPI_OP_MODE_MASTER | SPI_MODE_CPOL | @@ -278,7 +278,7 @@ static const struct lis2mdl_config lis2mdl_dev_config = { #else .spi_conf.cs = NULL, #endif -#elif DT_ANY_INST_ON_BUS(i2c) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) .bus_init = lis2mdl_i2c_init, .i2c_slv_addr = DT_INST_REG_ADDR(0), #else diff --git a/drivers/sensor/lis2mdl/lis2mdl.h b/drivers/sensor/lis2mdl/lis2mdl.h index 40f918142ba..66d11fed2e2 100644 --- a/drivers/sensor/lis2mdl/lis2mdl.h +++ b/drivers/sensor/lis2mdl/lis2mdl.h @@ -35,15 +35,15 @@ struct lis2mdl_config { u32_t gpio_pin; u8_t gpio_flags; #endif /* CONFIG_LIS2MDL_TRIGGER */ -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) u16_t i2c_slv_addr; -#elif DT_ANY_INST_ON_BUS(spi) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) struct spi_config spi_conf; #if DT_INST_SPI_DEV_HAS_CS_GPIOS(0) const char *gpio_cs_port; u8_t cs_gpio; #endif /* DT_INST_SPI_DEV_HAS_CS_GPIOS(0) */ -#endif /* DT_ANY_INST_ON_BUS(spi) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ }; /* Sensor data */ @@ -55,9 +55,9 @@ struct lis2mdl_data { stmdev_ctx_t *ctx; -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) stmdev_ctx_t ctx_i2c; -#elif DT_ANY_INST_ON_BUS(spi) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) stmdev_ctx_t ctx_spi; #endif diff --git a/drivers/sensor/lis2mdl/lis2mdl_i2c.c b/drivers/sensor/lis2mdl/lis2mdl_i2c.c index c9930533680..fd549540537 100644 --- a/drivers/sensor/lis2mdl/lis2mdl_i2c.c +++ b/drivers/sensor/lis2mdl/lis2mdl_i2c.c @@ -16,7 +16,7 @@ #include "lis2mdl.h" -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) #define LOG_LEVEL CONFIG_SENSOR_LOG_LEVEL LOG_MODULE_DECLARE(LIS2MDL); @@ -53,4 +53,4 @@ int lis2mdl_i2c_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(i2c) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ diff --git a/drivers/sensor/lis2mdl/lis2mdl_spi.c b/drivers/sensor/lis2mdl/lis2mdl_spi.c index 9b25e59f8c6..8fc4268a7d9 100644 --- a/drivers/sensor/lis2mdl/lis2mdl_spi.c +++ b/drivers/sensor/lis2mdl/lis2mdl_spi.c @@ -14,7 +14,7 @@ #include "lis2mdl.h" #include -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #define LIS2MDL_SPI_READ (1 << 7) @@ -133,4 +133,4 @@ int lis2mdl_spi_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(spi) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ diff --git a/drivers/sensor/lps22hh/lps22hh.c b/drivers/sensor/lps22hh/lps22hh.c index 9aff26ab62f..6c0484f407a 100644 --- a/drivers/sensor/lps22hh/lps22hh.c +++ b/drivers/sensor/lps22hh/lps22hh.c @@ -207,7 +207,7 @@ static const struct lps22hh_config lps22hh_config = { .drdy_pin = DT_INST_GPIO_PIN(0, drdy_gpios), .drdy_flags = DT_INST_GPIO_FLAGS(0, drdy_gpios), #endif -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) .bus_init = lps22hh_spi_init, .spi_conf.frequency = DT_INST_PROP(0, spi_max_frequency), .spi_conf.operation = (SPI_OP_MODE_MASTER | SPI_MODE_CPOL | @@ -222,7 +222,7 @@ static const struct lps22hh_config lps22hh_config = { #else .spi_conf.cs = NULL, #endif -#elif DT_ANY_INST_ON_BUS(i2c) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) .bus_init = lps22hh_i2c_init, .i2c_slv_addr = DT_INST_REG_ADDR(0), #else diff --git a/drivers/sensor/lps22hh/lps22hh.h b/drivers/sensor/lps22hh/lps22hh.h index 4236a3dc80b..89817a57b42 100644 --- a/drivers/sensor/lps22hh/lps22hh.h +++ b/drivers/sensor/lps22hh/lps22hh.h @@ -38,9 +38,9 @@ struct lps22hh_config { u8_t drdy_pin; u8_t drdy_flags; #endif -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) u16_t i2c_slv_addr; -#elif DT_ANY_INST_ON_BUS(spi) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) struct spi_config spi_conf; #if DT_INST_SPI_DEV_HAS_CS_GPIOS(0) const char *gpio_cs_port; @@ -56,9 +56,9 @@ struct lps22hh_data { stmdev_ctx_t *ctx; -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) stmdev_ctx_t ctx_i2c; -#elif DT_ANY_INST_ON_BUS(spi) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) stmdev_ctx_t ctx_spi; #endif diff --git a/drivers/sensor/lps22hh/lps22hh_i2c.c b/drivers/sensor/lps22hh/lps22hh_i2c.c index 3203e51dc47..893a08026b8 100644 --- a/drivers/sensor/lps22hh/lps22hh_i2c.c +++ b/drivers/sensor/lps22hh/lps22hh_i2c.c @@ -16,7 +16,7 @@ #include "lps22hh.h" -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) LOG_MODULE_DECLARE(LPS22HH, CONFIG_SENSOR_LOG_LEVEL); @@ -52,4 +52,4 @@ int lps22hh_i2c_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(i2c) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ diff --git a/drivers/sensor/lps22hh/lps22hh_spi.c b/drivers/sensor/lps22hh/lps22hh_spi.c index 08facebd0f7..5b60173a92c 100644 --- a/drivers/sensor/lps22hh/lps22hh_spi.c +++ b/drivers/sensor/lps22hh/lps22hh_spi.c @@ -15,7 +15,7 @@ #include "lps22hh.h" #include -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #define LPS22HH_SPI_READ (1 << 7) @@ -126,4 +126,4 @@ int lps22hh_spi_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(spi) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ diff --git a/drivers/sensor/lsm6dsl/lsm6dsl.c b/drivers/sensor/lsm6dsl/lsm6dsl.c index ef53ac2359b..cc112a7e8a1 100644 --- a/drivers/sensor/lsm6dsl/lsm6dsl.c +++ b/drivers/sensor/lsm6dsl/lsm6dsl.c @@ -789,7 +789,7 @@ static int lsm6dsl_init(struct device *dev) return -EINVAL; } -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) lsm6dsl_spi_init(dev); #else lsm6dsl_i2c_init(dev); diff --git a/drivers/sensor/lsm6dsl/lsm6dsl_i2c.c b/drivers/sensor/lsm6dsl/lsm6dsl_i2c.c index 6c76ce1a914..a3e049c8482 100644 --- a/drivers/sensor/lsm6dsl/lsm6dsl_i2c.c +++ b/drivers/sensor/lsm6dsl/lsm6dsl_i2c.c @@ -15,7 +15,7 @@ #include "lsm6dsl.h" -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) static u16_t lsm6dsl_i2c_slave_addr = DT_INST_REG_ADDR(0); @@ -64,4 +64,4 @@ int lsm6dsl_i2c_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(i2c) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ diff --git a/drivers/sensor/lsm6dsl/lsm6dsl_spi.c b/drivers/sensor/lsm6dsl/lsm6dsl_spi.c index 5240bbb4ec6..de19f8474e1 100644 --- a/drivers/sensor/lsm6dsl/lsm6dsl_spi.c +++ b/drivers/sensor/lsm6dsl/lsm6dsl_spi.c @@ -14,7 +14,7 @@ #include "lsm6dsl.h" #include -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #define LSM6DSL_SPI_READ (1 << 7) @@ -169,4 +169,4 @@ int lsm6dsl_spi_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(spi) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ diff --git a/drivers/sensor/lsm6dso/lsm6dso.c b/drivers/sensor/lsm6dso/lsm6dso.c index 647eeb4d4d9..7d2d4dc76cc 100644 --- a/drivers/sensor/lsm6dso/lsm6dso.c +++ b/drivers/sensor/lsm6dso/lsm6dso.c @@ -752,7 +752,7 @@ static struct lsm6dso_data lsm6dso_data; static const struct lsm6dso_config lsm6dso_config = { .bus_name = DT_INST_BUS_LABEL(0), -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) .bus_init = lsm6dso_spi_init, .spi_conf.frequency = DT_INST_PROP(0, spi_max_frequency), .spi_conf.operation = (SPI_OP_MODE_MASTER | SPI_MODE_CPOL | @@ -767,7 +767,7 @@ static const struct lsm6dso_config lsm6dso_config = { #else .spi_conf.cs = NULL, #endif -#elif DT_ANY_INST_ON_BUS(i2c) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) .bus_init = lsm6dso_i2c_init, .i2c_slv_addr = DT_INST_REG_ADDR(0), #else diff --git a/drivers/sensor/lsm6dso/lsm6dso.h b/drivers/sensor/lsm6dso/lsm6dso.h index 74a6721659d..ab85399c6ce 100644 --- a/drivers/sensor/lsm6dso/lsm6dso.h +++ b/drivers/sensor/lsm6dso/lsm6dso.h @@ -100,15 +100,15 @@ struct lsm6dso_config { u8_t int_gpio_flags; u8_t int_pin; #endif /* CONFIG_LSM6DSO_TRIGGER */ -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) u16_t i2c_slv_addr; -#elif DT_ANY_INST_ON_BUS(spi) +#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) struct spi_config spi_conf; #if DT_INST_SPI_DEV_HAS_CS_GPIOS(0) const char *gpio_cs_port; u8_t cs_gpio; #endif /* DT_INST_SPI_DEV_HAS_CS_GPIOS(0) */ -#endif /* DT_ANY_INST_ON_BUS(i2c) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ }; union samples { @@ -159,9 +159,9 @@ struct lsm6dso_data { stmdev_ctx_t *ctx; - #if DT_ANY_INST_ON_BUS(i2c) + #if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) stmdev_ctx_t ctx_i2c; - #elif DT_ANY_INST_ON_BUS(spi) + #elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) stmdev_ctx_t ctx_spi; #endif diff --git a/drivers/sensor/lsm6dso/lsm6dso_i2c.c b/drivers/sensor/lsm6dso/lsm6dso_i2c.c index aa3ba3b41f5..82a6ba33f5e 100644 --- a/drivers/sensor/lsm6dso/lsm6dso_i2c.c +++ b/drivers/sensor/lsm6dso/lsm6dso_i2c.c @@ -16,7 +16,7 @@ #include "lsm6dso.h" -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) LOG_MODULE_DECLARE(LSM6DSO, CONFIG_SENSOR_LOG_LEVEL); @@ -52,4 +52,4 @@ int lsm6dso_i2c_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(i2c) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ diff --git a/drivers/sensor/lsm6dso/lsm6dso_spi.c b/drivers/sensor/lsm6dso/lsm6dso_spi.c index 91eadf228c5..4eb09f1fa44 100644 --- a/drivers/sensor/lsm6dso/lsm6dso_spi.c +++ b/drivers/sensor/lsm6dso/lsm6dso_spi.c @@ -14,7 +14,7 @@ #include "lsm6dso.h" #include -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #define LSM6DSO_SPI_READ (1 << 7) @@ -125,4 +125,4 @@ int lsm6dso_spi_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(spi) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ diff --git a/drivers/sensor/mchp_tach_xec/tach_mchp_xec.c b/drivers/sensor/mchp_tach_xec/tach_mchp_xec.c index f0f80b3ceb8..d8b23bce4d8 100644 --- a/drivers/sensor/mchp_tach_xec/tach_mchp_xec.c +++ b/drivers/sensor/mchp_tach_xec/tach_mchp_xec.c @@ -133,4 +133,4 @@ static const struct sensor_driver_api tach_xec_driver_api = { CONFIG_SENSOR_INIT_PRIORITY, \ &tach_xec_driver_api); -DT_INST_FOREACH(TACH_XEC_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(TACH_XEC_DEVICE) diff --git a/drivers/sensor/ms5607/ms5607.c b/drivers/sensor/ms5607/ms5607.c index 138e27a2f25..3b5f9191960 100644 --- a/drivers/sensor/ms5607/ms5607.c +++ b/drivers/sensor/ms5607/ms5607.c @@ -239,7 +239,7 @@ static int ms5607_init(struct device *dev) return -EINVAL; } -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) ms5607_spi_init(dev); #else BUILD_ASSERT(1, "I2c interface not implemented yet"); diff --git a/drivers/sensor/ms5607/ms5607.h b/drivers/sensor/ms5607/ms5607.h index 10b92f4d011..df829496c57 100644 --- a/drivers/sensor/ms5607/ms5607.h +++ b/drivers/sensor/ms5607/ms5607.h @@ -61,7 +61,7 @@ #define MS5607_TEMP_OVER_DEFAULT 2048 #endif -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) int ms5607_spi_init(struct device *dev); #else /* I2c Interface not implemented yet */ diff --git a/drivers/sensor/ms5607/ms5607_spi.c b/drivers/sensor/ms5607/ms5607_spi.c index 8456f5a5cbb..54588715b1c 100644 --- a/drivers/sensor/ms5607/ms5607_spi.c +++ b/drivers/sensor/ms5607/ms5607_spi.c @@ -15,7 +15,7 @@ #include LOG_MODULE_DECLARE(ms5607); -#if DT_ANY_INST_ON_BUS(spi) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #if DT_INST_SPI_DEV_HAS_CS_GPIOS(0) static struct spi_cs_control ms5607_cs_ctrl; diff --git a/drivers/sensor/nxp_kinetis_temp/temp_kinetis.c b/drivers/sensor/nxp_kinetis_temp/temp_kinetis.c index d861e8a7c9c..01f0710b09e 100644 --- a/drivers/sensor/nxp_kinetis_temp/temp_kinetis.c +++ b/drivers/sensor/nxp_kinetis_temp/temp_kinetis.c @@ -180,7 +180,7 @@ static int temp_kinetis_init(struct device *dev) return 0; } -BUILD_ASSERT(DT_NUM_INST(DT_DRV_COMPAT) <= 1, +BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) <= 1, "unsupported temp instance"); #define TEMP_KINETIS_INIT(inst) \ @@ -221,4 +221,4 @@ BUILD_ASSERT(DT_NUM_INST(DT_DRV_COMPAT) <= 1, CONFIG_SENSOR_INIT_PRIORITY, \ &temp_kinetis_driver_api); -DT_INST_FOREACH(TEMP_KINETIS_INIT) +DT_INST_FOREACH_STATUS_OKAY(TEMP_KINETIS_INIT) diff --git a/drivers/sensor/stts751/stts751.c b/drivers/sensor/stts751/stts751.c index 9f32fe77b0e..19d34bf7235 100644 --- a/drivers/sensor/stts751/stts751.c +++ b/drivers/sensor/stts751/stts751.c @@ -204,7 +204,7 @@ static const struct stts751_config stts751_config = { .event_pin = DT_INST_GPIO_PIN(0, drdy_gpios), .int_flags = DT_INST_GPIO_FLAGS(0, drdy_gpios), #endif -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) .bus_init = stts751_i2c_init, .i2c_slv_addr = DT_INST_REG_ADDR(0), #else diff --git a/drivers/sensor/stts751/stts751.h b/drivers/sensor/stts751/stts751.h index 3640bd6d405..0fae3c423c5 100644 --- a/drivers/sensor/stts751/stts751.h +++ b/drivers/sensor/stts751/stts751.h @@ -32,7 +32,7 @@ struct stts751_config { u8_t event_pin; u8_t int_flags; #endif -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) u16_t i2c_slv_addr; #endif }; @@ -43,7 +43,7 @@ struct stts751_data { stmdev_ctx_t *ctx; -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) stmdev_ctx_t ctx_i2c; #endif diff --git a/drivers/sensor/stts751/stts751_i2c.c b/drivers/sensor/stts751/stts751_i2c.c index bbfc7c38eab..c072426b0d1 100644 --- a/drivers/sensor/stts751/stts751_i2c.c +++ b/drivers/sensor/stts751/stts751_i2c.c @@ -16,7 +16,7 @@ #include "stts751.h" -#if DT_ANY_INST_ON_BUS(i2c) +#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) LOG_MODULE_DECLARE(STTS751, CONFIG_SENSOR_LOG_LEVEL); @@ -52,4 +52,4 @@ int stts751_i2c_init(struct device *dev) return 0; } -#endif /* DT_ANY_INST_ON_BUS(i2c) */ +#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ diff --git a/drivers/serial/uart_cc13xx_cc26xx.c b/drivers/serial/uart_cc13xx_cc26xx.c index 04d5eff6906..235782539f1 100644 --- a/drivers/serial/uart_cc13xx_cc26xx.c +++ b/drivers/serial/uart_cc13xx_cc26xx.c @@ -657,4 +657,4 @@ static const struct uart_driver_api uart_cc13xx_cc26xx_driver_api = { \ UART_CC13XX_CC26XX_DEVICE_INIT(n); -DT_INST_FOREACH(UART_CC13XX_CC26XX_INIT) +DT_INST_FOREACH_STATUS_OKAY(UART_CC13XX_CC26XX_INIT) diff --git a/drivers/serial/uart_esp32.c b/drivers/serial/uart_esp32.c index 46299a0ce13..08822b0d314 100644 --- a/drivers/serial/uart_esp32.c +++ b/drivers/serial/uart_esp32.c @@ -539,4 +539,4 @@ DEVICE_AND_API_INIT(uart_esp32_##idx, \ \ ESP32_UART_IRQ_HANDLER(idx) -DT_INST_FOREACH(ESP32_UART_INIT) +DT_INST_FOREACH_STATUS_OKAY(ESP32_UART_INIT) diff --git a/drivers/serial/uart_imx.c b/drivers/serial/uart_imx.c index 180ae38ec8b..7263565b218 100644 --- a/drivers/serial/uart_imx.c +++ b/drivers/serial/uart_imx.c @@ -326,4 +326,4 @@ static const struct uart_driver_api uart_imx_driver_api = { \ UART_IMX_INIT_CFG(n); -DT_INST_FOREACH(UART_IMX_INIT) +DT_INST_FOREACH_STATUS_OKAY(UART_IMX_INIT) diff --git a/drivers/serial/uart_mcux.c b/drivers/serial/uart_mcux.c index f1437ea2a72..a02258538b8 100644 --- a/drivers/serial/uart_mcux.c +++ b/drivers/serial/uart_mcux.c @@ -340,4 +340,4 @@ static const struct uart_mcux_config uart_mcux_##n##_config = { \ \ UART_MCUX_INIT_CFG(n); -DT_INST_FOREACH(UART_MCUX_INIT) +DT_INST_FOREACH_STATUS_OKAY(UART_MCUX_INIT) diff --git a/drivers/serial/uart_mcux_flexcomm.c b/drivers/serial/uart_mcux_flexcomm.c index 12c82a497f0..d625786e715 100644 --- a/drivers/serial/uart_mcux_flexcomm.c +++ b/drivers/serial/uart_mcux_flexcomm.c @@ -335,4 +335,4 @@ static const struct mcux_flexcomm_config mcux_flexcomm_##n##_config = { \ \ UART_MCUX_FLEXCOMM_INIT_CFG(n); -DT_INST_FOREACH(UART_MCUX_FLEXCOMM_INIT) +DT_INST_FOREACH_STATUS_OKAY(UART_MCUX_FLEXCOMM_INIT) diff --git a/drivers/serial/uart_mcux_lpsci.c b/drivers/serial/uart_mcux_lpsci.c index 0276b23bffb..ca73e8c583e 100644 --- a/drivers/serial/uart_mcux_lpsci.c +++ b/drivers/serial/uart_mcux_lpsci.c @@ -332,4 +332,4 @@ static const struct mcux_lpsci_config mcux_lpsci_##n##_config = { \ \ MCUX_LPSCI_INIT_CFG(n); -DT_INST_FOREACH(MCUX_LPSCI_INIT) +DT_INST_FOREACH_STATUS_OKAY(MCUX_LPSCI_INIT) diff --git a/drivers/serial/uart_mcux_lpuart.c b/drivers/serial/uart_mcux_lpuart.c index 37a1c3c6522..ecebaaadf0e 100644 --- a/drivers/serial/uart_mcux_lpuart.c +++ b/drivers/serial/uart_mcux_lpuart.c @@ -340,4 +340,4 @@ static const struct mcux_lpuart_config mcux_lpuart_##n##_config = { \ \ LPUART_MCUX_INIT_CFG(n); -DT_INST_FOREACH(LPUART_MCUX_INIT) +DT_INST_FOREACH_STATUS_OKAY(LPUART_MCUX_INIT) diff --git a/drivers/serial/uart_miv.c b/drivers/serial/uart_miv.c index e5366e3ddd1..1a1267fb341 100644 --- a/drivers/serial/uart_miv.c +++ b/drivers/serial/uart_miv.c @@ -382,7 +382,7 @@ static const struct uart_driver_api uart_miv_driver_api = { }; /* This driver is single-instance. */ -BUILD_ASSERT(DT_NUM_INST(DT_DRV_COMPAT) <= 1, +BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) <= 1, "unsupported uart_miv instance"); #if DT_HAS_NODE_STATUS_OKAY(DT_DRV_INST(0)) diff --git a/drivers/serial/uart_rv32m1_lpuart.c b/drivers/serial/uart_rv32m1_lpuart.c index 4e99a20e891..e69497af4f3 100644 --- a/drivers/serial/uart_rv32m1_lpuart.c +++ b/drivers/serial/uart_rv32m1_lpuart.c @@ -346,4 +346,4 @@ static const struct uart_driver_api rv32m1_lpuart_driver_api = { \ RV32M1_LPUART_INIT_CFG(n); -DT_INST_FOREACH(RV32M1_LPUART_INIT) +DT_INST_FOREACH_STATUS_OKAY(RV32M1_LPUART_INIT) diff --git a/drivers/serial/uart_sam.c b/drivers/serial/uart_sam.c index 17e8737edb9..937041e6673 100644 --- a/drivers/serial/uart_sam.c +++ b/drivers/serial/uart_sam.c @@ -371,4 +371,4 @@ static const struct uart_driver_api uart_sam_driver_api = { \ UART_SAM_INIT_CFG(n); -DT_INST_FOREACH(UART_SAM_INIT) +DT_INST_FOREACH_STATUS_OKAY(UART_SAM_INIT) diff --git a/drivers/serial/uart_sam0.c b/drivers/serial/uart_sam0.c index 210ccc5c2aa..d1aaf6bfc36 100644 --- a/drivers/serial/uart_sam0.c +++ b/drivers/serial/uart_sam0.c @@ -1136,4 +1136,4 @@ DEVICE_AND_API_INIT(uart_sam0_##n, DT_INST_LABEL(n), \ &uart_sam0_driver_api); \ UART_SAM0_IRQ_HANDLER(n) -DT_INST_FOREACH(UART_SAM0_DEVICE_INIT) +DT_INST_FOREACH_STATUS_OKAY(UART_SAM0_DEVICE_INIT) diff --git a/drivers/serial/uart_stm32.c b/drivers/serial/uart_stm32.c index f586db278a7..e9f042bdd54 100644 --- a/drivers/serial/uart_stm32.c +++ b/drivers/serial/uart_stm32.c @@ -30,7 +30,7 @@ LOG_MODULE_REGISTER(uart_stm32); #define HAS_LPUART_1 (DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(lpuart1)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(lpuart1), \ + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(lpuart1), \ st_stm32_lpuart)) /* convenience defines */ @@ -779,4 +779,4 @@ DEVICE_AND_API_INIT(uart_stm32_##index, DT_INST_LABEL(index),\ \ STM32_UART_IRQ_HANDLER(index) -DT_INST_FOREACH(STM32_UART_INIT) +DT_INST_FOREACH_STATUS_OKAY(STM32_UART_INIT) diff --git a/drivers/serial/uart_xlnx_ps.c b/drivers/serial/uart_xlnx_ps.c index 320af7c975e..5ff1e693e60 100644 --- a/drivers/serial/uart_xlnx_ps.c +++ b/drivers/serial/uart_xlnx_ps.c @@ -1219,4 +1219,4 @@ DEVICE_AND_API_INIT(uart_xlnx_ps_##port, DT_INST_LABEL(port), \ UART_XLNX_PS_DEV_CFG(inst); \ UART_XLNX_PS_INIT(inst); -DT_INST_FOREACH(UART_XLNX_INSTANTIATE) +DT_INST_FOREACH_STATUS_OKAY(UART_XLNX_INSTANTIATE) diff --git a/drivers/serial/usart_sam.c b/drivers/serial/usart_sam.c index 4f7ed620528..ff66803c8cf 100644 --- a/drivers/serial/usart_sam.c +++ b/drivers/serial/usart_sam.c @@ -372,4 +372,4 @@ static const struct uart_driver_api usart_sam_driver_api = { \ USART_SAM_INIT_CFG(n); -DT_INST_FOREACH(USART_SAM_INIT) +DT_INST_FOREACH_STATUS_OKAY(USART_SAM_INIT) diff --git a/drivers/spi/spi_cc13xx_cc26xx.c b/drivers/spi/spi_cc13xx_cc26xx.c index f20d720434a..859ad974934 100644 --- a/drivers/spi/spi_cc13xx_cc26xx.c +++ b/drivers/spi/spi_cc13xx_cc26xx.c @@ -372,4 +372,4 @@ static const struct spi_driver_api spi_cc13xx_cc26xx_driver_api = { \ SPI_CC13XX_CC26XX_DEVICE_INIT(n); -DT_INST_FOREACH(SPI_CC13XX_CC26XX_INIT) +DT_INST_FOREACH_STATUS_OKAY(SPI_CC13XX_CC26XX_INIT) diff --git a/drivers/spi/spi_gecko.c b/drivers/spi/spi_gecko.c index a7b48241494..80b301a8815 100644 --- a/drivers/spi/spi_gecko.c +++ b/drivers/spi/spi_gecko.c @@ -321,4 +321,4 @@ static struct spi_driver_api spi_gecko_api = { #define SPI_INIT(n) SPI_INIT2(n, SPI_ID(n)) -DT_INST_FOREACH(SPI_INIT) +DT_INST_FOREACH_STATUS_OKAY(SPI_INIT) diff --git a/drivers/spi/spi_litespi.c b/drivers/spi/spi_litespi.c index 1c3a8851e6d..b412be77e8b 100644 --- a/drivers/spi/spi_litespi.c +++ b/drivers/spi/spi_litespi.c @@ -182,4 +182,4 @@ static struct spi_driver_api spi_litespi_api = { CONFIG_SPI_INIT_PRIORITY, \ &spi_litespi_api); -DT_INST_FOREACH(SPI_INIT) +DT_INST_FOREACH_STATUS_OKAY(SPI_INIT) diff --git a/drivers/spi/spi_ll_stm32.c b/drivers/spi/spi_ll_stm32.c index e61f162fefe..8ce3a710bcc 100644 --- a/drivers/spi/spi_ll_stm32.c +++ b/drivers/spi/spi_ll_stm32.c @@ -423,7 +423,7 @@ static void spi_stm32_complete(struct spi_stm32_data *data, SPI_TypeDef *spi, spi_context_cs_control(&data->ctx, false); -#if DT_HAS_COMPAT(st_stm32_spi_fifo) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_spi_fifo) /* Flush RX buffer */ while (ll_func_rx_is_not_empty(spi)) { (void) LL_SPI_ReceiveData8(spi); @@ -570,7 +570,7 @@ static int spi_stm32_configure(struct device *dev, LL_SPI_SetDataWidth(spi, LL_SPI_DATAWIDTH_16BIT); } -#if DT_HAS_COMPAT(st_stm32_spi_fifo) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_spi_fifo) ll_func_set_fifo_threshold_8bit(spi); #endif @@ -645,7 +645,7 @@ static int transceive(struct device *dev, /* Set buffers info */ spi_context_buffers_setup(&data->ctx, tx_bufs, rx_bufs, 1); -#if DT_HAS_COMPAT(st_stm32_spi_fifo) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_spi_fifo) /* Flush RX buffer */ while (ll_func_rx_is_not_empty(spi)) { (void) LL_SPI_ReceiveData8(spi); @@ -898,4 +898,4 @@ DEVICE_AND_API_INIT(spi_stm32_##id, DT_INST_LABEL(id), \ \ STM32_SPI_IRQ_HANDLER(id) -DT_INST_FOREACH(STM32_SPI_INIT) +DT_INST_FOREACH_STATUS_OKAY(STM32_SPI_INIT) diff --git a/drivers/spi/spi_ll_stm32.h b/drivers/spi/spi_ll_stm32.h index b32b973bb6b..7806673d9cd 100644 --- a/drivers/spi/spi_ll_stm32.h +++ b/drivers/spi/spi_ll_stm32.h @@ -136,7 +136,7 @@ static inline u32_t ll_func_spi_is_busy(SPI_TypeDef *spi) /* Header is compiled first, this switch avoid the compiler to lookup for * non-existing LL FIFO functions for SoC without SPI FIFO */ -#if DT_HAS_COMPAT(st_stm32_spi_fifo) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_spi_fifo) static inline void ll_func_set_fifo_threshold_8bit(SPI_TypeDef *spi) { #ifdef CONFIG_SOC_SERIES_STM32MP1X diff --git a/drivers/spi/spi_mcux_dspi.c b/drivers/spi/spi_mcux_dspi.c index dd59b28e40b..eb1ee14a84a 100644 --- a/drivers/spi/spi_mcux_dspi.c +++ b/drivers/spi/spi_mcux_dspi.c @@ -307,4 +307,4 @@ static const struct spi_driver_api spi_mcux_driver_api = { irq_enable(DT_INST_IRQN(id)); \ } -DT_INST_FOREACH(SPI_MCUX_DSPI_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(SPI_MCUX_DSPI_DEVICE) diff --git a/drivers/spi/spi_mcux_flexcomm.c b/drivers/spi/spi_mcux_flexcomm.c index 9d75756f898..923e26d50cb 100644 --- a/drivers/spi/spi_mcux_flexcomm.c +++ b/drivers/spi/spi_mcux_flexcomm.c @@ -295,4 +295,4 @@ static const struct spi_driver_api spi_mcux_driver_api = { irq_enable(DT_INST_IRQN(id)); \ } -DT_INST_FOREACH(SPI_MCUX_FLEXCOMM_DEVICE) +DT_INST_FOREACH_STATUS_OKAY(SPI_MCUX_FLEXCOMM_DEVICE) diff --git a/drivers/spi/spi_mcux_lpspi.c b/drivers/spi/spi_mcux_lpspi.c index e6d281f7546..e9f00c2fd54 100644 --- a/drivers/spi/spi_mcux_lpspi.c +++ b/drivers/spi/spi_mcux_lpspi.c @@ -305,4 +305,4 @@ static const struct spi_driver_api spi_mcux_driver_api = { irq_enable(DT_INST_IRQN(n)); \ } -DT_INST_FOREACH(SPI_MCUX_LPSPI_INIT) +DT_INST_FOREACH_STATUS_OKAY(SPI_MCUX_LPSPI_INIT) diff --git a/drivers/spi/spi_oc_simple.c b/drivers/spi/spi_oc_simple.c index ff682217c85..6a95f72025e 100644 --- a/drivers/spi/spi_oc_simple.c +++ b/drivers/spi/spi_oc_simple.c @@ -222,4 +222,4 @@ int spi_oc_simple_init(struct device *dev) CONFIG_SPI_INIT_PRIORITY, \ &spi_oc_simple_api); -DT_INST_FOREACH(SPI_OC_INIT) +DT_INST_FOREACH_STATUS_OKAY(SPI_OC_INIT) diff --git a/drivers/spi/spi_rv32m1_lpspi.c b/drivers/spi/spi_rv32m1_lpspi.c index da1afc09a88..91fa86b3230 100644 --- a/drivers/spi/spi_rv32m1_lpspi.c +++ b/drivers/spi/spi_rv32m1_lpspi.c @@ -311,4 +311,4 @@ static const struct spi_driver_api spi_mcux_driver_api = { irq_enable(DT_INST_IRQN(n)); \ } -DT_INST_FOREACH(SPI_RV32M1_INIT) +DT_INST_FOREACH_STATUS_OKAY(SPI_RV32M1_INIT) diff --git a/drivers/spi/spi_sam.c b/drivers/spi/spi_sam.c index 1949c793395..a5d43378cdb 100644 --- a/drivers/spi/spi_sam.c +++ b/drivers/spi/spi_sam.c @@ -473,4 +473,4 @@ static const struct spi_driver_api spi_sam_driver_api = { &spi_sam_config_##n, POST_KERNEL, \ CONFIG_SPI_INIT_PRIORITY, &spi_sam_driver_api); -DT_INST_FOREACH(SPI_SAM_DEVICE_INIT) +DT_INST_FOREACH_STATUS_OKAY(SPI_SAM_DEVICE_INIT) diff --git a/drivers/spi/spi_sam0.c b/drivers/spi/spi_sam0.c index 57f75ff8203..a851ace4c89 100644 --- a/drivers/spi/spi_sam0.c +++ b/drivers/spi/spi_sam0.c @@ -770,4 +770,4 @@ static const struct spi_sam0_config spi_sam0_config_##n = { \ CONFIG_SPI_INIT_PRIORITY, \ &spi_sam0_driver_api); -DT_INST_FOREACH(SPI_SAM0_DEVICE_INIT) +DT_INST_FOREACH_STATUS_OKAY(SPI_SAM0_DEVICE_INIT) diff --git a/drivers/usb/device/usb_dc_stm32.c b/drivers/usb/device/usb_dc_stm32.c index dfc3eef16b5..6dbc09d52c1 100644 --- a/drivers/usb/device/usb_dc_stm32.c +++ b/drivers/usb/device/usb_dc_stm32.c @@ -57,11 +57,11 @@ #include LOG_MODULE_REGISTER(usb_dc_stm32); -#if DT_HAS_COMPAT(st_stm32_otgfs) && DT_HAS_COMPAT(st_stm32_otghs) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otgfs) && DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs) #error "Only one interface should be enabled at a time, OTG FS or OTG HS" #endif -#if DT_HAS_COMPAT(st_stm32_otghs) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs) #define USB_BASE_ADDRESS DT_REG_ADDR(DT_INST(0, st_stm32_otghs)) #define USB_IRQ DT_IRQ_BY_NAME(DT_INST(0, st_stm32_otghs), otghs, irq) #define USB_IRQ_PRI DT_IRQ_BY_NAME(DT_INST(0, st_stm32_otghs), otghs, priority) @@ -72,7 +72,7 @@ LOG_MODULE_REGISTER(usb_dc_stm32); #endif #define USB_CLOCK_BITS DT_CLOCKS_CELL(DT_INST(0, st_stm32_otghs), bits) #define USB_CLOCK_BUS DT_CLOCKS_CELL(DT_INST(0, st_stm32_otghs), bus) -#elif DT_HAS_COMPAT(st_stm32_otgfs) +#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otgfs) #define USB_BASE_ADDRESS DT_REG_ADDR(DT_INST(0, st_stm32_otgfs)) #define USB_IRQ DT_IRQ_BY_NAME(DT_INST(0, st_stm32_otgfs), otgfs, irq) #define USB_IRQ_PRI DT_IRQ_BY_NAME(DT_INST(0, st_stm32_otgfs), otgfs, priority) @@ -83,7 +83,7 @@ LOG_MODULE_REGISTER(usb_dc_stm32); #endif #define USB_CLOCK_BITS DT_CLOCKS_CELL(DT_INST(0, st_stm32_otgfs), bits) #define USB_CLOCK_BUS DT_CLOCKS_CELL(DT_INST(0, st_stm32_otgfs), bus) -#elif DT_HAS_COMPAT(st_stm32_usb) +#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_usb) #define USB_BASE_ADDRESS DT_REG_ADDR(DT_INST(0, st_stm32_usb)) #define USB_IRQ DT_IRQ_BY_NAME(DT_INST(0, st_stm32_usb), usb, irq) #define USB_IRQ_PRI DT_IRQ_BY_NAME(DT_INST(0, st_stm32_usb), usb, priority) @@ -133,9 +133,9 @@ LOG_MODULE_REGISTER(usb_dc_stm32); #define EP0_MPS USB_OTG_MAX_EP0_SIZE -#if DT_HAS_COMPAT(st_stm32_otghs) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs) #define EP_MPS USB_OTG_HS_MAX_PACKET_SIZE -#elif DT_HAS_COMPAT(st_stm32_otgfs) || DT_HAS_COMPAT(st_stm32_usb) +#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otgfs) || DT_HAS_COMPAT_STATUS_OKAY(st_stm32_usb) #define EP_MPS USB_OTG_FS_MAX_PACKET_SIZE #endif @@ -289,8 +289,8 @@ static int usb_dc_stm32_clock_enable(void) return -EIO; } -#if DT_HAS_COMPAT(st_stm32_otghs) -#if DT_HAS_COMPAT(st_stm32_usbphyc) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_usbphyc) LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_OTGHSULPI); LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_OTGPHYC); #else @@ -310,7 +310,7 @@ static u32_t usb_dc_stm32_get_maximum_speed(void) * If max-speed is not passed via DT, set it to USB controller's * maximum hardware capability. */ -#if DT_HAS_COMPAT(st_stm32_usbphyc) && DT_HAS_COMPAT(st_stm32_otghs) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_usbphyc) && DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs) u32_t speed = USB_OTG_SPEED_HIGH; #else u32_t speed = USB_OTG_SPEED_FULL; @@ -321,7 +321,7 @@ static u32_t usb_dc_stm32_get_maximum_speed(void) if (!strncmp(USB_MAXIMUM_SPEED, "high-speed", 10)) { speed = USB_OTG_SPEED_HIGH; } else if (!strncmp(USB_MAXIMUM_SPEED, "full-speed", 10)) { -#if DT_HAS_COMPAT(st_stm32_usbphyc) && DT_HAS_COMPAT(st_stm32_otghs) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_usbphyc) && DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs) speed = USB_OTG_SPEED_HIGH_IN_FULL; #else speed = USB_OTG_SPEED_FULL; @@ -350,14 +350,14 @@ static int usb_dc_stm32_init(void) usb_dc_stm32_state.pcd.Init.ep0_mps = PCD_EP0MPS_64; usb_dc_stm32_state.pcd.Init.low_power_enable = 0; #else /* USB_OTG_FS || USB_OTG_HS */ -#if DT_HAS_COMPAT(st_stm32_otghs) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs) usb_dc_stm32_state.pcd.Instance = USB_OTG_HS; #else usb_dc_stm32_state.pcd.Instance = USB_OTG_FS; #endif usb_dc_stm32_state.pcd.Init.dev_endpoints = USB_NUM_BIDIR_ENDPOINTS; usb_dc_stm32_state.pcd.Init.speed = usb_dc_stm32_get_maximum_speed(); -#if DT_HAS_COMPAT(st_stm32_usbphyc) && DT_HAS_COMPAT(st_stm32_otghs) +#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_usbphyc) && DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs) usb_dc_stm32_state.pcd.Init.phy_itface = USB_OTG_HS_EMBEDDED_PHY; #else usb_dc_stm32_state.pcd.Init.phy_itface = PCD_PHY_EMBEDDED; diff --git a/drivers/watchdog/wdt_gecko.c b/drivers/watchdog/wdt_gecko.c index 56d490fa118..c7f906b44c8 100644 --- a/drivers/watchdog/wdt_gecko.c +++ b/drivers/watchdog/wdt_gecko.c @@ -295,4 +295,4 @@ static const struct wdt_driver_api wdt_gecko_driver_api = { irq_enable(DT_INST_IRQN(index)); \ } -DT_INST_FOREACH(GECKO_WDT_INIT) +DT_INST_FOREACH_STATUS_OKAY(GECKO_WDT_INIT) diff --git a/include/arch/riscv/common/linker.ld b/include/arch/riscv/common/linker.ld index 0ce4b3fa74d..613ebfd2509 100644 --- a/include/arch/riscv/common/linker.ld +++ b/include/arch/riscv/common/linker.ld @@ -34,10 +34,10 @@ MEMORY { #ifdef CONFIG_XIP -#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_flash), soc_nv_flash) +#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_CHOSEN(zephyr_flash), soc_nv_flash) #define ROM_BASE DT_REG_ADDR(DT_CHOSEN(zephyr_flash)) #define ROM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_flash)) -#elif DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_flash), jedec_spi_nor) +#elif DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_CHOSEN(zephyr_flash), jedec_spi_nor) /* For jedec,spi-nor we expect the spi controller to memory map the flash * and for that mapping to be the second register property of the spi * controller. diff --git a/include/devicetree.h b/include/devicetree.h index 74286cb6041..185959fe09b 100644 --- a/include/devicetree.h +++ b/include/devicetree.h @@ -187,21 +187,22 @@ /** * @brief Get a node identifier for an instance of a compatible * - * Instance numbers are just indexes among enabled nodes with the same + * Instance numbers are just indexes among *all* nodes with the same * compatible. This complicates their use outside of device drivers. * The **only guarantees** are: * * - instance numbers start at 0, * - are contiguous, and - * - exactly one is assigned for each enabled node with a matching - * compatible + * - exactly one is assigned for *each* node with a matching compatible, + * **including disabled ones** * * Instance numbers **in no way reflect** any numbering scheme that * might exist in SoC documentation, node labels or unit addresses, or - * properties of the /aliases node. There **is no guarantee** that the - * same node will have the same instance number between builds, even - * if you are building the same application again in the same build - * directory. + * properties of the /aliases node. + * + * There **is no guarantee** that the same node will have the same + * instance number between builds, even if you are building the same + * application again in the same build directory. * * Example devicetree fragment: * @@ -892,6 +893,45 @@ * @{ */ +/** + * @brief Does a node identifier refer to a node? + * + * Tests whether a node identifier refers to a node which exists, i.e. + * is defined in the devicetree. + * + * It doesn't matter whether or not the node has a matching binding, + * or what the node's status value is. This is purely a check of + * whether the node exists at all. + * + * @param node_id a node identifier + * @return 1 if the node identifier refers to a node, + * 0 otherwise. + */ +#define DT_NODE_EXISTS(node_id) IS_ENABLED(DT_CAT(node_id, _EXISTS)) + +/** + * @brief Does a node identifier refer to a node with a status? + * + * Example uses: + * + * DT_NODE_HAS_STATUS(DT_PATH(soc, i2c_12340000), okay) + * DT_NODE_HAS_STATUS(DT_PATH(soc, i2c_12340000), disabled) + * + * Tests whether a node identifier refers to a node which: + * + * - exists in the devicetree, and + * - has a status property matching the second argument + * (except that either a missing status or an "ok" status + * in the devicetree is treated as if it were "okay" instead) + * + * @param node_id a node identifier + * @param status a status as a token (not a string), e.g. okay or disabled + * @return 1 if the node identifier refers to a usable node, + * 0 otherwise. + */ +#define DT_NODE_HAS_STATUS(node_id, status) \ + DT_HAS_NODE_STATUS_INTERNAL(node_id, status) + /** * @brief Does a node identifier refer to a usable node? * @@ -910,7 +950,7 @@ * @return 1 if the node identifier refers to a usable node, * 0 otherwise. */ -#define DT_HAS_NODE_STATUS_OKAY(node_id) IS_ENABLED(DT_CAT(node_id, _EXISTS)) +#define DT_HAS_NODE_STATUS_OKAY(node_id) DT_NODE_HAS_STATUS(node_id, okay) /** * @brief Does the devicetree have any usable nodes with a compatible? @@ -923,16 +963,18 @@ * @return 0 if no nodes of the compatible are available for use, * 1 if at least one is enabled and has a matching binding */ -#define DT_HAS_COMPAT(compat) DT_HAS_NODE_STATUS_OKAY(DT_INST(0, compat)) +#define DT_HAS_COMPAT_STATUS_OKAY(compat) \ + IS_ENABLED(DT_CAT(DT_COMPAT_HAS_OKAY_, compat)) /** - * @brief Get the number of enabled instances for a given compatible + * @brief Get the number of instances of a given compatible with + * status "okay" * @param compat lowercase-and-underscores version of a compatible - * @return Number of enabled instances + * @return Number of instances with status "okay" */ -#define DT_NUM_INST(compat) \ - UTIL_AND(DT_HAS_COMPAT(compat), \ - UTIL_CAT(DT_N_INST, DT_DASH(compat, NUM))) +#define DT_NUM_INST_STATUS_OKAY(compat) \ + UTIL_AND(DT_HAS_COMPAT_STATUS_OKAY(compat), \ + UTIL_CAT(DT_N_INST, DT_DASH(compat, NUM_OKAY))) /** * @brief Test if the devicetree has a /chosen node @@ -953,8 +995,8 @@ * * Example usages which evaluate to 1: * - * DT_NODE_HAS_COMPAT(DT_NODELABEL(n), vnd_specific_device) - * DT_NODE_HAS_COMPAT(DT_NODELABEL(n), generic_device) + * DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(n), vnd_specific_device) + * DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(n), generic_device) * * This macro only uses the value of the compatible property. Whether * or not a particular compatible has a matching binding has no effect @@ -965,7 +1007,7 @@ * @return 1 if the node's compatible property contains compat, * 0 otherwise. */ -#define DT_NODE_HAS_COMPAT(node_id, compat) \ +#define DT_NODE_HAS_COMPAT_STATUS_OKAY(node_id, compat) \ IS_ENABLED(DT_CAT(node_id, _COMPAT_MATCHES_##compat)) /** @@ -1116,31 +1158,6 @@ */ #define DT_ON_BUS(node_id, bus) IS_ENABLED(DT_CAT(node_id, _BUS_##bus)) -/** - * @brief Test if any node of a compatible is on a bus of a given type - * - * Example devicetree overlay: - * - * &i2c0 { - * temp: temperature-sensor@76 { - * compatible = "vnd,some-sensor"; - * reg = <0x76>; - * }; - * }; - * - * Example usage, assuming "i2c0" is an I2C bus controller node, and - * therefore "temp" is on an I2C bus: - * - * DT_COMPAT_ON_BUS(vnd_some_sensor, i2c) // 1 - * - * @param compat lowercase-and-underscores version of a compatible - * @param bus a binding's bus type as a C token, lowercased and without quotes - * @return 1 if any enabled node with that compatible is on that bus type, - * 0 otherwise - */ -#define DT_COMPAT_ON_BUS(compat, bus) \ - IS_ENABLED(UTIL_CAT(DT_CAT(DT_COMPAT_, compat), _BUS_##bus)) - /** * @} */ @@ -1413,29 +1430,55 @@ #define DT_INST_ON_BUS(inst, bus) DT_ON_BUS(DT_DRV_INST(inst), bus) /** - * @brief Test if any node with compatible DT_DRV_COMPAT is on a bus + * @brief Test if any DT_DRV_COMPAT node is on a bus of a given type + * and has status okay + * + * Example devicetree overlay: + * + * &i2c0 { + * temp: temperature-sensor@76 { + * compatible = "vnd,some-sensor"; + * reg = <0x76>; + * }; + * }; + * + * Example usage, assuming "i2c0" is an I2C bus controller node, and + * therefore "temp" is on an I2C bus: + * + * #define DT_DRV_COMPAT vnd_some_sensor + * + * DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) // 1 * - * This is equivalent to DT_COMPAT_ON_BUS(DT_DRV_COMPAT, bus). * @param bus a binding's bus type as a C token, lowercased and without quotes + * @return 1 if any enabled node with that compatible is on that bus type, + * 0 otherwise */ -#define DT_ANY_INST_ON_BUS(bus) DT_COMPAT_ON_BUS(DT_DRV_COMPAT, bus) +#define DT_ANY_INST_ON_BUS_STATUS_OKAY(bus) \ + DT_COMPAT_ON_BUS_INTERNAL(DT_DRV_COMPAT, bus) /** - * @def DT_INST_FOREACH + * @def DT_INST_FOREACH_STATUS_OKAY * * @brief Call specified macro for all nodes with compatible DT_DRV_COMPAT + * and status "okay" + * + * @details This macro will scan for all DT_INST_ device nodes for that + * compatible. + * + * The macro then calls the supplied inst_expr with the instance number + * for each instance which has status "okay". * - * @details This macro will scan for all DT_INST_ device nodes for that driver. - * The macro then calls the supplied macro with the instance number. * This macro can be used for example to call the init macro of a driver - * for each device specified in the device tree. + * for each device specified in the device tree with "okay" status. * * @param inst_expr Macro or function that is called for each device node. * Has to accept instance_number as only parameter. */ -#define DT_INST_FOREACH(inst_expr) \ - COND_CODE_1(DT_HAS_COMPAT(DT_DRV_COMPAT), \ - (UTIL_CAT(DT_FOREACH_INST_, DT_DRV_COMPAT)(inst_expr)), ()) +#define DT_INST_FOREACH_STATUS_OKAY(inst_expr) \ + COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT), \ + (UTIL_CAT(DT_FOREACH_OKAY_INST_, \ + DT_DRV_COMPAT)(inst_expr)), \ + ()) /** * @brief Does a DT_DRV_COMPAT instance have a property? @@ -1530,6 +1573,12 @@ #define DT_DASH(...) MACRO_MAP_CAT(DT_DASH_PREFIX, __VA_ARGS__) /** @internal helper for DT_DASH(): prepends _ to a name */ #define DT_DASH_PREFIX(name) _##name +/** @internal helper for DT_HAS_NODE_STATUS */ +#define DT_HAS_NODE_STATUS_INTERNAL(node_id, status) \ + IS_ENABLED(DT_CAT(node_id, _STATUS_ ## status)) +/** @internal helper for test cases and DT_ANY_INST_ON_BUS_STATUS_OKAY() */ +#define DT_COMPAT_ON_BUS_INTERNAL(compat, bus) \ + IS_ENABLED(UTIL_CAT(DT_CAT(DT_COMPAT_, compat), _BUS_##bus)) /* have these last so the have access to all previously defined macros */ #include diff --git a/samples/drivers/watchdog/src/main.c b/samples/drivers/watchdog/src/main.c index 8ed0db7c530..c36c4a2a0e4 100644 --- a/samples/drivers/watchdog/src/main.c +++ b/samples/drivers/watchdog/src/main.c @@ -21,19 +21,19 @@ */ #if DT_HAS_NODE_STATUS_OKAY(DT_ALIAS(watchdog0)) #define WDT_NODE DT_ALIAS(watchdog0) -#elif DT_HAS_COMPAT(st_stm32_window_watchdog) +#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_window_watchdog) #define WDT_NODE DT_INST(0, st_stm32_window_watchdog) -#elif DT_HAS_COMPAT(st_stm32_watchdog) +#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_watchdog) #define WDT_NODE DT_INST(0, st_stm32_watchdog) -#elif DT_HAS_COMPAT(nordic_nrf_watchdog) +#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_watchdog) #define WDT_NODE DT_INST(0, nordic_nrf_watchdog) -#elif DT_HAS_COMPAT(espressif_esp32_watchdog) +#elif DT_HAS_COMPAT_STATUS_OKAY(espressif_esp32_watchdog) #define WDT_NODE DT_INST(0, espressif_esp32_watchdog) -#elif DT_HAS_COMPAT(silabs_gecko_wdog) +#elif DT_HAS_COMPAT_STATUS_OKAY(silabs_gecko_wdog) #define WDT_NODE DT_INST(0, silabs_gecko_wdog) -#elif DT_HAS_COMPAT(nxp_kinetis_wdog32) +#elif DT_HAS_COMPAT_STATUS_OKAY(nxp_kinetis_wdog32) #define WDT_NODE DT_INST(0, nxp_kinetis_wdog32) -#elif DT_HAS_COMPAT(microchip_xec_watchdog) +#elif DT_HAS_COMPAT_STATUS_OKAY(microchip_xec_watchdog) #define WDT_NODE DT_INST(0, microchip_xec_watchdog) #endif diff --git a/scripts/dts/gen_defines.py b/scripts/dts/gen_defines.py index 5595f745dba..2216d8ee59e 100755 --- a/scripts/dts/gen_defines.py +++ b/scripts/dts/gen_defines.py @@ -37,7 +37,7 @@ def main(): # Suppress this warning if it's suppressed in dtc warn_reg_unit_address_mismatch= "-Wno-simple_bus_reg" not in args.dtc_flags, - default_prop_types=False) + default_prop_types=True) except edtlib.EDTError as e: sys.exit(f"devicetree error: {e}") @@ -81,14 +81,6 @@ def main(): f"DT_{node.parent.z_path_id}") write_child_functions(node) - - if not node.enabled: - out_comment("No node macros: node is disabled") - continue - if not node.matching_compat: - out_comment("No node macros: node has no matching binding") - continue - write_idents_and_existence(node) write_bus(node) write_special_props(node) @@ -227,9 +219,7 @@ def write_idents_and_existence(node): idents = [f"N_ALIAS_{str2ident(alias)}" for alias in node.aliases] # Instances for compat in node.compats: - if not node.enabled: - continue - instance_no = node.edt.compat2enabled[compat].index(node) + instance_no = node.edt.compat2nodes[compat].index(node) idents.append(f"N_INST_{instance_no}_{str2ident(compat)}") # Node labels idents.extend(f"N_NODELABEL_{str2ident(label)}" for label in node.labels) @@ -270,6 +260,7 @@ def write_special_props(node): write_regs(node) write_interrupts(node) write_compatibles(node) + write_status(node) def write_regs(node): @@ -402,6 +393,10 @@ def write_child_functions(node): out_dt_define(macro, functions) +def write_status(node): + out_dt_define(f"{node.z_path_id}_STATUS_{str2ident(node.status)}", 1) + + def write_vanilla_props(node): # Writes macros for any and all properties defined in the # "properties" section of the binding for the node. @@ -582,38 +577,35 @@ def write_chosen(edt): def write_global_compat_info(edt): # Tree-wide information related to each compatible, such as number - # of instances, is printed here. + # of instances with status "okay", is printed here. - compat2numinst = {} - compat2buses = defaultdict(list) - for compat, enabled in edt.compat2enabled.items(): - compat2numinst[compat] = len(enabled) - - for node in enabled: + n_okay_macros = {} + for_each_macros = {} + compat2buses = defaultdict(list) # just for "okay" nodes + for compat, okay_nodes in edt.compat2okay.items(): + for node in okay_nodes: bus = node.on_bus if bus is not None and bus not in compat2buses[compat]: compat2buses[compat].append(bus) - out_comment("Helpers for calling a macro/function a fixed number of times" - "\n") - for numinsts in range(1, max(compat2numinst.values(), default=0) + 1): - out_define(f"DT_FOREACH_IMPL_{numinsts}(fn)", - " ".join([f"fn({i})" for i in range(numinsts)])) - - out_comment("Macros for enabled instances of each compatible\n") - n_inst_macros = {} - for_each_macros = {} - for compat, numinst in compat2numinst.items(): ident = str2ident(compat) - n_inst_macros[f"DT_N_INST_{ident}_NUM"] = numinst - for_each_macros[f"DT_FOREACH_INST_{ident}(fn)"] = \ - f"DT_FOREACH_IMPL_{numinst}(fn)" - for macro, value in n_inst_macros.items(): + n_okay_macros[f"DT_N_INST_{ident}_NUM_OKAY"] = len(okay_nodes) + for_each_macros[f"DT_FOREACH_OKAY_INST_{ident}(fn)"] = \ + " ".join(f"fn({edt.compat2nodes[compat].index(node)})" + for node in okay_nodes) + + out_comment('Macros for compatibles with status "okay" nodes\n') + for compat, okay_nodes in edt.compat2okay.items(): + if okay_nodes: + out_define(f"DT_COMPAT_HAS_OKAY_{str2ident(compat)}", 1) + + out_comment('Macros for status "okay" instances of each compatible\n') + for macro, value in n_okay_macros.items(): out_define(macro, value) for macro, value in for_each_macros.items(): out_define(macro, value) - out_comment("Bus information for enabled nodes of each compatible\n") + out_comment('Bus information for status "okay" nodes of each compatible\n') for compat, buses in compat2buses.items(): for bus in buses: out_define( diff --git a/soc/arm/atmel_sam0/common/atmel_sam0_dt.h b/soc/arm/atmel_sam0/common/atmel_sam0_dt.h index e5cf1787ade..06c0a9d47c3 100644 --- a/soc/arm/atmel_sam0/common/atmel_sam0_dt.h +++ b/soc/arm/atmel_sam0/common/atmel_sam0_dt.h @@ -38,7 +38,7 @@ /* Use to check if a sercom 'n' is enabled for a given 'compat' */ #define ATMEL_SAM0_DT_SERCOM_CHECK(n, compat) \ DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(sercom##n)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(sercom##n), compat) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(sercom##n), compat) /* Common macro for use to set HCLK_FREQ_HZ */ #define ATMEL_SAM0_DT_CPU_CLK_FREQ_HZ \ diff --git a/soc/arm/nordic_nrf/validate_base_addresses.c b/soc/arm/nordic_nrf/validate_base_addresses.c index 305333070d3..839a7211cfb 100644 --- a/soc/arm/nordic_nrf/validate_base_addresses.c +++ b/soc/arm/nordic_nrf/validate_base_addresses.c @@ -58,7 +58,7 @@ * @param addr_if_no_match MDK address to return otherwise */ #define NODE_ADDRESS(lbl, compat, addr_if_match, addr_if_no_match) \ - COND_CODE_1(DT_NODE_HAS_COMPAT(DT_NODELABEL(lbl), compat), \ + COND_CODE_1(DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(lbl), compat), \ (addr_if_match), (addr_if_no_match)) #define CHECK_SPI_REG(lbl, num) \ diff --git a/soc/arm/nxp_lpc/lpc54xxx/soc.c b/soc/arm/nxp_lpc/lpc54xxx/soc.c index 838185e994d..7e32f7bd5b2 100644 --- a/soc/arm/nxp_lpc/lpc54xxx/soc.c +++ b/soc/arm/nxp_lpc/lpc54xxx/soc.c @@ -68,7 +68,7 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_AttachClk(kFRO12M_to_FLEXCOMM0); #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm4)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm4), nxp_lpc_i2c) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c) /* attach 12 MHz clock to FLEXCOMM4 */ CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4); @@ -77,7 +77,7 @@ static ALWAYS_INLINE void clock_init(void) #endif #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm5)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm5), nxp_lpc_spi) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm5), nxp_lpc_spi) /* Attach 12 MHz clock to FLEXCOMM5 */ CLOCK_AttachClk(kFRO_HF_to_FLEXCOMM5); diff --git a/soc/arm/nxp_lpc/lpc55xxx/soc.c b/soc/arm/nxp_lpc/lpc55xxx/soc.c index 506603b76bd..85b4c6f7ea5 100644 --- a/soc/arm/nxp_lpc/lpc55xxx/soc.c +++ b/soc/arm/nxp_lpc/lpc55xxx/soc.c @@ -62,7 +62,7 @@ static ALWAYS_INLINE void clock_init(void) CLOCK_EnableClock(kCLOCK_Iocon); #if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm4)) && \ - DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm4), nxp_lpc_i2c) + DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c) /* attach 12 MHz clock to FLEXCOMM4 */ CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4); diff --git a/tests/drivers/counter/counter_basic_api/src/test_counter.c b/tests/drivers/counter/counter_basic_api/src/test_counter.c index d99f1b7c307..58dceaf55cd 100644 --- a/tests/drivers/counter/counter_basic_api/src/test_counter.c +++ b/tests/drivers/counter/counter_basic_api/src/test_counter.c @@ -29,8 +29,8 @@ struct counter_alarm_cfg alarm_cfg2; #define INST_DT_COMPAT_LABEL(n, compat) DT_LABEL(DT_INST(n, compat)), /* Generate a list of LABELs for all instances of the "compat" */ #define LABELS_FOR_DT_COMPAT(compat) \ - COND_CODE_1(DT_HAS_COMPAT(compat), \ - (UTIL_LISTIFY(DT_NUM_INST(compat), \ + COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \ + (UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(compat), \ INST_DT_COMPAT_LABEL, compat)), ()) static const char * const devices[] = { diff --git a/tests/drivers/watchdog/wdt_basic_api/src/test_wdt.c b/tests/drivers/watchdog/wdt_basic_api/src/test_wdt.c index 23f438959f0..78e47733aab 100644 --- a/tests/drivers/watchdog/wdt_basic_api/src/test_wdt.c +++ b/tests/drivers/watchdog/wdt_basic_api/src/test_wdt.c @@ -69,19 +69,19 @@ */ #if DT_HAS_NODE_STATUS_OKAY(DT_ALIAS(watchdog0)) #define WDT_NODE DT_ALIAS(watchdog0) -#elif DT_HAS_COMPAT(st_stm32_window_watchdog) +#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_window_watchdog) #define WDT_NODE DT_INST(0, st_stm32_window_watchdog) -#elif DT_HAS_COMPAT(st_stm32_watchdog) +#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_watchdog) #define WDT_NODE DT_INST(0, st_stm32_watchdog) -#elif DT_HAS_COMPAT(nordic_nrf_watchdog) +#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_watchdog) #define WDT_NODE DT_INST(0, nordic_nrf_watchdog) -#elif DT_HAS_COMPAT(espressif_esp32_watchdog) +#elif DT_HAS_COMPAT_STATUS_OKAY(espressif_esp32_watchdog) #define WDT_NODE DT_INST(0, espressif_esp32_watchdog) -#elif DT_HAS_COMPAT(silabs_gecko_wdog) +#elif DT_HAS_COMPAT_STATUS_OKAY(silabs_gecko_wdog) #define WDT_NODE DT_INST(0, silabs_gecko_wdog) -#elif DT_HAS_COMPAT(nxp_kinetis_wdog32) +#elif DT_HAS_COMPAT_STATUS_OKAY(nxp_kinetis_wdog32) #define WDT_NODE DT_INST(0, nxp_kinetis_wdog32) -#elif DT_HAS_COMPAT(microchip_xec_watchdog) +#elif DT_HAS_COMPAT_STATUS_OKAY(microchip_xec_watchdog) #define WDT_NODE DT_INST(0, microchip_xec_watchdog) #endif diff --git a/tests/lib/devicetree/app.overlay b/tests/lib/devicetree/app.overlay index f98dc0d8d16..b99eb8316c4 100644 --- a/tests/lib/devicetree/app.overlay +++ b/tests/lib/devicetree/app.overlay @@ -25,7 +25,7 @@ interrupt-parent = <&test_intc>; test_arrays: array-holder { - /* vnd,undefined-compat is for DT_NODE_HAS_COMPAT() */ + /* vnd,undefined-compat is for DT_NODE_HAS_COMPAT_STATUS_OKAY() */ compatible = "vnd,array-holder", "vnd,undefined-compat"; a = <1000 2000 3000>; b = [aa bb cc dd]; diff --git a/tests/lib/devicetree/src/main.c b/tests/lib/devicetree/src/main.c index e143b0d5414..9bbfe706b2d 100644 --- a/tests/lib/devicetree/src/main.c +++ b/tests/lib/devicetree/src/main.c @@ -105,12 +105,14 @@ static void test_inst_props(void) * Careful: * * We can only test properties that are shared across all - * instances of this compatible here. + * instances of this compatible here. This includes instances + * with status "disabled". */ zassert_equal(DT_PROP(TEST_INST, gpio_controller), 1, "gpio-controller"); - zassert_true(!strcmp(DT_PROP(TEST_INST, status), "okay"), + zassert_true(!strcmp(DT_PROP(TEST_INST, status), "okay") || + !strcmp(DT_PROP(TEST_INST, status), "disabled"), "status"); zassert_equal(DT_PROP_LEN(TEST_INST, compatible), 1, "compatible len"); @@ -124,7 +126,8 @@ static void test_inst_props(void) "inst 0 gpio-controller is not 1"); zassert_equal(DT_INST_NODE_HAS_PROP(0, xxxx), 0, "inst 0 has xxxx prop"); - zassert_true(!strcmp(DT_INST_PROP(0, status), "okay"), + zassert_true(!strcmp(DT_INST_PROP(0, status), "okay") || + !strcmp(DT_PROP(TEST_INST, status), "disabled"), "inst 0 status"); zassert_equal(DT_INST_PROP_LEN(0, compatible), 1, "inst 0 compatible len"); @@ -156,15 +159,15 @@ static void test_has_alias(void) static void test_inst_checks(void) { - zassert_equal(DT_HAS_NODE_STATUS_OKAY(DT_INST(0, vnd_gpio)), 1, + zassert_equal(DT_NODE_EXISTS(DT_INST(0, vnd_gpio)), 1, "vnd,gpio #0"); - zassert_equal(DT_HAS_NODE_STATUS_OKAY(DT_INST(1, vnd_gpio)), 1, + zassert_equal(DT_NODE_EXISTS(DT_INST(1, vnd_gpio)), 1, "vnd,gpio #1"); - zassert_equal(DT_HAS_NODE_STATUS_OKAY(DT_INST(2, vnd_gpio)), 0, + zassert_equal(DT_NODE_EXISTS(DT_INST(2, vnd_gpio)), 1, "vnd,gpio #2"); - zassert_equal(DT_NUM_INST(vnd_gpio), 2, "num. vnd,gpio"); - zassert_equal(DT_NUM_INST(xxxx), 0, "num. xxxx"); + zassert_equal(DT_NUM_INST_STATUS_OKAY(vnd_gpio), 2, "num. vnd,gpio"); + zassert_equal(DT_NUM_INST_STATUS_OKAY(xxxx), 0, "num. xxxx"); } static void test_has_nodelabel(void) @@ -178,15 +181,15 @@ static void test_has_nodelabel(void) "TEST_NODELABEL_ALLCAPS"); } -#define TA_HAS_COMPAT(compat) DT_NODE_HAS_COMPAT(TEST_ARRAYS, compat) +#define TA_HAS_COMPAT(compat) DT_NODE_HAS_COMPAT_STATUS_OKAY(TEST_ARRAYS, compat) static void test_has_compat(void) { unsigned int compats; - zassert_true(DT_HAS_COMPAT(vnd_gpio), "vnd,gpio"); - zassert_true(DT_HAS_COMPAT(vnd_gpio), "vnd,i2c"); - zassert_false(DT_HAS_COMPAT(vnd_disabled_compat), + zassert_true(DT_HAS_COMPAT_STATUS_OKAY(vnd_gpio), "vnd,gpio"); + zassert_true(DT_HAS_COMPAT_STATUS_OKAY(vnd_gpio), "vnd,i2c"); + zassert_false(DT_HAS_COMPAT_STATUS_OKAY(vnd_disabled_compat), "vnd,disabled-compat"); zassert_equal(TA_HAS_COMPAT(vnd_array_holder), 1, "vnd,array-holder"); @@ -269,13 +272,14 @@ static void test_bus(void) #undef DT_DRV_COMPAT #define DT_DRV_COMPAT vnd_spi_device - zassert_equal(DT_NUM_INST(DT_DRV_COMPAT), 2, "spi device count"); + zassert_equal(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT), 2, + "spi device count"); zassert_equal(DT_INST_ON_BUS(0, spi), 1, "spi inst 0 not on spi"); zassert_equal(DT_INST_ON_BUS(0, i2c), 0, "spi inst 0 on i2c"); - zassert_equal(DT_ANY_INST_ON_BUS(spi), 1, "no spi is on spi"); - zassert_equal(DT_ANY_INST_ON_BUS(i2c), 0, "a spi is on i2c"); + zassert_equal(DT_ANY_INST_ON_BUS_STATUS_OKAY(spi), 1, "no spi is on spi"); + zassert_equal(DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c), 0, "a spi is on i2c"); zassert_true(!strncmp(spi_dev, DT_INST_LABEL(0), strlen(spi_dev)), "inst 0 spi dev label"); @@ -284,13 +288,14 @@ static void test_bus(void) #undef DT_DRV_COMPAT #define DT_DRV_COMPAT vnd_i2c_device - zassert_equal(DT_NUM_INST(DT_DRV_COMPAT), 2, "i2c device count"); + zassert_equal(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT), 2, + "i2c device count"); zassert_equal(DT_INST_ON_BUS(0, i2c), 1, "i2c inst 0 not on i2c"); zassert_equal(DT_INST_ON_BUS(0, spi), 0, "i2c inst 0 on spi"); - zassert_equal(DT_ANY_INST_ON_BUS(i2c), 1, "no i2c is on i2c"); - zassert_equal(DT_ANY_INST_ON_BUS(spi), 0, "an i2c is on spi"); + zassert_equal(DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c), 1, "no i2c is on i2c"); + zassert_equal(DT_ANY_INST_ON_BUS_STATUS_OKAY(spi), 0, "an i2c is on spi"); zassert_true(!strncmp(i2c_dev, DT_INST_LABEL(0), strlen(i2c_dev)), "inst 0 i2c dev label"); @@ -299,17 +304,19 @@ static void test_bus(void) #undef DT_DRV_COMPAT /* - * Make sure the underlying DT_COMPAT_ON_BUS used by + * Make sure the underlying DT_COMPAT_ON_BUS_INTERNAL used by * DT_ANY_INST_ON_BUS works without DT_DRV_COMPAT defined. */ - zassert_equal(DT_COMPAT_ON_BUS(vnd_spi_device, spi), 1, NULL); - zassert_equal(DT_COMPAT_ON_BUS(vnd_spi_device, i2c), 0, NULL); + zassert_equal(DT_COMPAT_ON_BUS_INTERNAL(vnd_spi_device, spi), 1, NULL); + zassert_equal(DT_COMPAT_ON_BUS_INTERNAL(vnd_spi_device, i2c), 0, NULL); - zassert_equal(DT_COMPAT_ON_BUS(vnd_i2c_device, i2c), 1, NULL); - zassert_equal(DT_COMPAT_ON_BUS(vnd_i2c_device, spi), 0, NULL); + zassert_equal(DT_COMPAT_ON_BUS_INTERNAL(vnd_i2c_device, i2c), 1, NULL); + zassert_equal(DT_COMPAT_ON_BUS_INTERNAL(vnd_i2c_device, spi), 0, NULL); - zassert_equal(DT_COMPAT_ON_BUS(vnd_gpio_expander, i2c), 1, NULL); - zassert_equal(DT_COMPAT_ON_BUS(vnd_gpio_expander, spi), 1, NULL); + zassert_equal(DT_COMPAT_ON_BUS_INTERNAL(vnd_gpio_expander, i2c), 1, + NULL); + zassert_equal(DT_COMPAT_ON_BUS_INTERNAL(vnd_gpio_expander, spi), 1, + NULL); } #undef DT_DRV_COMPAT @@ -354,7 +361,8 @@ static void test_reg(void) "abcd1234 reg[two] size"); /* DT_INST */ - zassert_equal(DT_NUM_INST(DT_DRV_COMPAT), 1, "one instance"); + zassert_equal(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT), 1, + "one instance"); /* DT_INST_REG_HAS_IDX */ zassert_true(DT_INST_REG_HAS_IDX(0, 0), "has idx 0"); @@ -463,7 +471,8 @@ static void test_irq(void) zassert_equal(DT_IRQN(TEST_I2C_BUS), 6, "irqn"); /* DT_INST */ - zassert_equal(DT_NUM_INST(DT_DRV_COMPAT), 1, "one instance"); + zassert_equal(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT), 1, + "one instance"); /* DT_INST_IRQ_HAS_IDX */ zassert_equal(DT_INST_IRQ_HAS_IDX(0, 0), 1, "inst 0 irq 0 missing"); @@ -671,7 +680,8 @@ static void test_phandles(void) zassert_equal(gps[1].flags, 40, "gps[1].flags"); /* DT_INST */ - zassert_equal(DT_NUM_INST(DT_DRV_COMPAT), 1, "one instance"); + zassert_equal(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT), 1, + "one instance"); /* DT_INST_PROP_BY_PHANDLE */ zassert_true(!strcmp(DT_INST_PROP_BY_PHANDLE(0, ph, label), @@ -801,7 +811,8 @@ static void test_gpio(void) zassert_equal(DT_GPIO_FLAGS(TEST_PH, gpios), 20, "gpio 0 flags"); /* DT_INST */ - zassert_equal(DT_NUM_INST(DT_DRV_COMPAT), 1, "one instance"); + zassert_equal(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT), 1, + "one instance"); /* DT_INST_GPIO_LABEL_BY_IDX */ zassert_true(!strcmp(DT_INST_GPIO_LABEL_BY_IDX(0, gpios, 0), @@ -1007,7 +1018,8 @@ static void test_pwms(void) zassert_equal(DT_PWMS_FLAGS(TEST_PH), 3, "pwm channel"); /* DT_INST */ - zassert_equal(DT_NUM_INST(DT_DRV_COMPAT), 1, "one instance"); + zassert_equal(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT), 1, + "one instance"); /* DT_INST_PWMS_LABEL_BY_IDX */ zassert_true(!strcmp(DT_INST_PWMS_LABEL_BY_IDX(0, 0), @@ -1181,7 +1193,7 @@ static const struct gpio_driver_api test_api; CONFIG_APPLICATION_INIT_PRIORITY, \ &test_api); -DT_INST_FOREACH(TEST_GPIO_INIT) +DT_INST_FOREACH_STATUS_OKAY(TEST_GPIO_INIT) static inline struct test_gpio_data *to_data(struct device *dev) { @@ -1195,27 +1207,35 @@ static inline const struct test_gpio_info *to_info(struct device *dev) static void test_devices(void) { - struct device *dev0; - struct device *dev1; + struct device *devs[3]; + int i = 0; struct device *dev_abcd; unsigned int val; - zassert_true(DT_HAS_NODE_STATUS_OKAY(INST(0)), "inst 0 device"); - zassert_true(DT_HAS_NODE_STATUS_OKAY(INST(1)), "inst 1 device"); - zassert_false(DT_HAS_NODE_STATUS_OKAY(INST(2)), "inst 2 device"); + zassert_equal(DT_NUM_INST_STATUS_OKAY(vnd_gpio), 2, + "wrong number of gpio devs"); - zassert_equal(DT_NUM_INST(vnd_gpio), 2, "wrong number of gpio devs"); + devs[i] = device_get_binding(DT_LABEL(INST(0))); + if (devs[i]) { + i++; + } + devs[i] = device_get_binding(DT_LABEL(INST(1))); + if (devs[i]) { + i++; + } + devs[i] = device_get_binding(DT_LABEL(INST(2))); + if (devs[i]) { + i++; + } - dev0 = device_get_binding(DT_LABEL(INST(0))); - dev1 = device_get_binding(DT_LABEL(INST(1))); + zassert_not_null(devs[0], "null devs[0]"); + zassert_not_null(devs[1], "null devs[1]"); + zassert_true(devs[2] == NULL, "non-null devs[2]"); - zassert_not_null(dev0, "null device " DT_LABEL(INST(0))); - zassert_not_null(dev1, "null device " DT_LABEL(INST(1))); - - zassert_true(to_data(dev0)->is_gpio_ctlr, "dev0 not a gpio"); - zassert_true(to_data(dev1)->is_gpio_ctlr, "dev1 not a gpio"); - zassert_true(to_data(dev0)->init_called, "dev0 not initialized"); - zassert_true(to_data(dev1)->init_called, "dev1 not initialized"); + zassert_true(to_data(devs[0])->is_gpio_ctlr, "devs[0] not a gpio"); + zassert_true(to_data(devs[1])->is_gpio_ctlr, "devs[1] not a gpio"); + zassert_true(to_data(devs[0])->init_called, "devs[0] not initialized"); + zassert_true(to_data(devs[1])->init_called, "devs[1] not initialized"); dev_abcd = device_get_binding(DT_LABEL(TEST_ABCD1234)); zassert_not_null(dev_abcd, "abcd"); @@ -1223,23 +1243,22 @@ static void test_devices(void) zassert_equal(to_info(dev_abcd)->reg_len, 0x500, "abcd len"); /* - * Make sure DT_INST_FOREACH can be called from functions + * Make sure DT_INST_FOREACH_STATUS_OKAY can be called from functions * using macros with side effects in the current scope. */ -#undef SET_BIT -#define SET_BIT(i) do { unsigned int bit = BIT(i); val |= bit; } while (0); val = 0; - DT_INST_FOREACH(SET_BIT); - zassert_equal(val, 0x3, "foreach vnd_gpio"); +#define INC(inst_ignored) do { val++; } while (0); + DT_INST_FOREACH_STATUS_OKAY(INC) + zassert_equal(val, 2, "foreach okay vnd_gpio"); /* - * Make sure DT_INST_FOREACH works with 0 instances, and does + * Make sure DT_INST_FOREACH_STATUS_OKAY works with 0 instances, and does * not expand its argument at all. */ #undef DT_DRV_COMPAT #define DT_DRV_COMPAT xxxx #define BUILD_BUG_ON_EXPANSION (there is a bug in devicetree.h) - DT_INST_FOREACH(BUILD_BUG_ON_EXPANSION); + DT_INST_FOREACH_STATUS_OKAY(BUILD_BUG_ON_EXPANSION) } static void test_cs_gpios(void) @@ -1312,7 +1331,8 @@ static void test_clocks(void) "fixed clk freq"); /* DT_INST */ - zassert_equal(DT_NUM_INST(DT_DRV_COMPAT), 1, "one instance"); + zassert_equal(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT), 1, + "one instance"); /* DT_INST_CLOCKS_LABEL_BY_IDX */ zassert_true(!strcmp(DT_INST_CLOCKS_LABEL_BY_IDX(0, 0),