dts: clean up some redundant DT checks

These are redundantly checking a node's status twice.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Martí Bolívar 2020-05-06 10:50:36 -07:00 committed by Kumar Gala
commit 17b8667197
12 changed files with 20 additions and 41 deletions

View file

@ -122,8 +122,7 @@ static int frdm_k64f_pinmux_init(struct device *dev)
pinmux_pin_set(portb, 10, PORT_PCR_MUX(kPORT_PinDisabledOrAnalog));
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(ftm3)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
#if 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

View file

@ -33,8 +33,7 @@ static int frdm_k82f_pinmux_init(struct device *dev)
device_get_binding(CONFIG_PINMUX_MCUX_PORTE_NAME);
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(ftm3)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
#if 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));

View file

@ -30,8 +30,7 @@ static int hexiwear_k64_pinmux_init(struct device *dev)
device_get_binding(CONFIG_PINMUX_MCUX_PORTE_NAME);
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(ftm3)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
#if 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));

View file

@ -23,8 +23,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)
device_get_binding(CONFIG_PINMUX_MCUX_LPC_PORT1_NAME);
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm0)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
/* USART0 RX, TX */
const u32_t port0_pin0_config = (
IOCON_PIO_FUNC1 |
@ -108,8 +107,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)
pinmux_pin_set(port1, 10, port1_pin10_config);
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm4)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
#if 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 |
@ -129,8 +127,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)
IOCON_PIO_I2CFILTER_EN);
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm5)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm5), nxp_lpc_spi)
#if 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 |

View file

@ -95,8 +95,7 @@ static int lpcxpresso_55s16_pinmux_init(struct device *dev)
pinmux_pin_set(port1, DT_GPIO_PIN(DT_ALIAS(led2), gpios), led2_config);
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm0)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
/* USART0 RX, TX */
const u32_t port0_pin29_config = (
IOCON_PIO_FUNC1 |
@ -118,8 +117,7 @@ static int lpcxpresso_55s16_pinmux_init(struct device *dev)
pinmux_pin_set(port0, 30, port0_pin30_config);
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm4)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
#if 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 |

View file

@ -23,8 +23,7 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
device_get_binding(CONFIG_PINMUX_MCUX_LPC_PORT1_NAME);
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm0)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
/* USART0 RX, TX */
const u32_t port0_pin29_config = (
IOCON_PIO_FUNC1 |
@ -89,8 +88,7 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
pinmux_pin_set(port1, DT_GPIO_PIN(DT_ALIAS(sw2), gpios), sw2_config);
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm4)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
#if 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 |

View file

@ -34,8 +34,7 @@ static int twr_ke18f_pinmux_init(struct device *dev)
device_get_binding(CONFIG_PINMUX_MCUX_PORTE_NAME);
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(ftm0)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm0), nxp_kinetis_ftm_pwm)
#if 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));
@ -47,8 +46,7 @@ static int twr_ke18f_pinmux_init(struct device *dev)
pinmux_pin_set(portd, 16, PORT_PCR_MUX(kPORT_MuxAsGpio));
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(ftm3)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
#if 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));

View file

@ -20,10 +20,8 @@ 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_STATUS_OKAY(DT_NODELABEL(can1), st_stm32_can) && \
DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(can2)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can2), st_stm32_can)
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can1), 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
@ -1047,8 +1045,7 @@ static const struct can_driver_api can_api_funcs = {
.register_state_change_isr = can_stm32_register_state_change_isr
};
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(can1)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can1), st_stm32_can)
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can1), st_stm32_can)
static void config_can_1_irq(CAN_TypeDef *can);
@ -1137,8 +1134,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_STATUS_OKAY(DT_NODELABEL(can2), st_stm32_can)
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can2), st_stm32_can)
static void config_can_2_irq(CAN_TypeDef *can);

View file

@ -29,8 +29,7 @@
#include <logging/log.h>
LOG_MODULE_REGISTER(uart_stm32);
#define HAS_LPUART_1 (DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(lpuart1)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(lpuart1), \
#define HAS_LPUART_1 (DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(lpuart1), \
st_stm32_lpuart))
/* convenience defines */

View file

@ -37,7 +37,6 @@
/* 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_STATUS_OKAY(DT_NODELABEL(sercom##n), compat)
/* Common macro for use to set HCLK_FREQ_HZ */

View file

@ -67,8 +67,7 @@ static ALWAYS_INLINE void clock_init(void)
/* Attach 12 MHz clock to FLEXCOMM0 */
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM0);
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm4)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
/* attach 12 MHz clock to FLEXCOMM4 */
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4);
@ -76,8 +75,7 @@ static ALWAYS_INLINE void clock_init(void)
RESET_PeripheralReset(kFC4_RST_SHIFT_RSTn);
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm5)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm5), nxp_lpc_spi)
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm5), nxp_lpc_spi)
/* Attach 12 MHz clock to FLEXCOMM5 */
CLOCK_AttachClk(kFRO_HF_to_FLEXCOMM5);

View file

@ -61,8 +61,7 @@ static ALWAYS_INLINE void clock_init(void)
/* Enables the clock for the I/O controller.: Enable Clock. */
CLOCK_EnableClock(kCLOCK_Iocon);
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm4)) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
#if DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
/* attach 12 MHz clock to FLEXCOMM4 */
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4);