drivers: use DT_INST_NODE_HAS_COMPAT
Replace occurances of: DT_NODE_HAS_COMPAT\(DT_DRV_INST\((.*)\), (.*)\) With: DT_INST_NODE_HAS_COMPAT($1, $2) Signed-off-by: Yong Cong Sin <ycsin@meta.com>
This commit is contained in:
parent
9b7638f049
commit
0291c551a2
|
@ -1373,7 +1373,7 @@ static const struct can_driver_api mcux_flexcan_fd_driver_api = {
|
|||
|
||||
#ifdef CONFIG_CAN_MCUX_FLEXCAN_FD
|
||||
#define FLEXCAN_MAX_BITRATE(id) \
|
||||
COND_CODE_1(DT_NODE_HAS_COMPAT(DT_DRV_INST(id), FLEXCAN_FD_DRV_COMPAT), \
|
||||
COND_CODE_1(DT_INST_NODE_HAS_COMPAT(id, FLEXCAN_FD_DRV_COMPAT), \
|
||||
(8000000), (1000000))
|
||||
#else /* CONFIG_CAN_MCUX_FLEXCAN_FD */
|
||||
#define FLEXCAN_MAX_BITRATE(id) 1000000
|
||||
|
@ -1381,7 +1381,7 @@ static const struct can_driver_api mcux_flexcan_fd_driver_api = {
|
|||
|
||||
#ifdef CONFIG_CAN_MCUX_FLEXCAN_FD
|
||||
#define FLEXCAN_DRIVER_API(id) \
|
||||
COND_CODE_1(DT_NODE_HAS_COMPAT(DT_DRV_INST(id), FLEXCAN_FD_DRV_COMPAT), \
|
||||
COND_CODE_1(DT_INST_NODE_HAS_COMPAT(id, FLEXCAN_FD_DRV_COMPAT), \
|
||||
(mcux_flexcan_fd_driver_api), \
|
||||
(mcux_flexcan_driver_api))
|
||||
#else /* CONFIG_CAN_MCUX_FLEXCAN_FD */
|
||||
|
@ -1403,7 +1403,7 @@ static const struct can_driver_api mcux_flexcan_fd_driver_api = {
|
|||
DT_INST_CLOCKS_CELL(id, name), \
|
||||
.clk_source = DT_INST_PROP(id, clk_source), \
|
||||
IF_ENABLED(CONFIG_CAN_MCUX_FLEXCAN_FD, ( \
|
||||
.flexcan_fd = DT_NODE_HAS_COMPAT(DT_DRV_INST(id), FLEXCAN_FD_DRV_COMPAT), \
|
||||
.flexcan_fd = DT_INST_NODE_HAS_COMPAT(id, FLEXCAN_FD_DRV_COMPAT), \
|
||||
)) \
|
||||
.irq_config_func = mcux_flexcan_irq_config_##id, \
|
||||
.irq_enable_func = mcux_flexcan_irq_enable_##id, \
|
||||
|
|
|
@ -629,7 +629,7 @@ static const struct i2c_driver_api i2c_xilinx_axi_driver_api = {
|
|||
static const struct i2c_xilinx_axi_config i2c_xilinx_axi_config_##compat##_##n = { \
|
||||
.base = DT_INST_REG_ADDR(n), \
|
||||
.irq_config_func = i2c_xilinx_axi_config_func_##compat##_##n, \
|
||||
.dyn_read_working = DT_NODE_HAS_COMPAT(DT_DRV_INST(n), xlnx_xps_iic_2_1)}; \
|
||||
.dyn_read_working = DT_INST_NODE_HAS_COMPAT(n, xlnx_xps_iic_2_1)}; \
|
||||
\
|
||||
static struct i2c_xilinx_axi_data i2c_xilinx_axi_data_##compat##_##n; \
|
||||
\
|
||||
|
|
|
@ -793,7 +793,7 @@ static const struct bmi270_feature_config bmi270_feature_base = {
|
|||
};
|
||||
|
||||
#define BMI270_FEATURE(inst) ( \
|
||||
DT_NODE_HAS_COMPAT(DT_DRV_INST(inst), bosch_bmi270_base) ? \
|
||||
DT_INST_NODE_HAS_COMPAT(inst, bosch_bmi270_base) ? \
|
||||
&bmi270_feature_base : \
|
||||
&bmi270_feature_max_fifo)
|
||||
|
||||
|
|
|
@ -500,7 +500,7 @@ static int lis2dh_pm_action(const struct device *dev,
|
|||
&lis2dh_driver_api);
|
||||
|
||||
#define IS_LSM303AGR_DEV(inst) \
|
||||
DT_NODE_HAS_COMPAT(DT_DRV_INST(inst), st_lsm303agr_accel)
|
||||
DT_INST_NODE_HAS_COMPAT(inst, st_lsm303agr_accel)
|
||||
|
||||
#define DISC_PULL_UP(inst) \
|
||||
DT_INST_PROP(inst, disconnect_sdo_sa0_pull_up)
|
||||
|
@ -545,8 +545,8 @@ static int lis2dh_pm_action(const struct device *dev,
|
|||
* compat(lis2dh) cannot be used here because it is the base part.
|
||||
*/
|
||||
#define FRACTIONAL_BITS(inst) \
|
||||
(DT_NODE_HAS_COMPAT(DT_DRV_INST(inst), st_lis2dh12) || \
|
||||
DT_NODE_HAS_COMPAT(DT_DRV_INST(inst), st_lis3dh)) ? \
|
||||
(DT_INST_NODE_HAS_COMPAT(inst, st_lis2dh12) || \
|
||||
DT_INST_NODE_HAS_COMPAT(inst, st_lis3dh)) ? \
|
||||
(IS_ENABLED(CONFIG_LIS2DH_OPER_MODE_LOW_POWER) ? 0 : 2) : \
|
||||
0
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ static const struct sensor_driver_api lps2xdf_driver_api = {
|
|||
.lpf = DT_INST_PROP(inst, lpf), \
|
||||
.avg = DT_INST_PROP(inst, avg), \
|
||||
.chip_api = &name##_chip_api, \
|
||||
IF_ENABLED(DT_NODE_HAS_COMPAT(DT_DRV_INST(inst), st_lps28dfw), \
|
||||
IF_ENABLED(DT_INST_NODE_HAS_COMPAT(inst, st_lps28dfw), \
|
||||
(.fs = DT_INST_PROP(inst, fs),)) \
|
||||
IF_ENABLED(DT_INST_NODE_HAS_PROP(inst, drdy_gpios), \
|
||||
(LPS2XDF_CFG_IRQ(inst)))
|
||||
|
|
|
@ -909,7 +909,7 @@ static int lsm6dso_init(const struct device *dev)
|
|||
.accel_pm = DT_INST_PROP(inst, accel_pm), \
|
||||
.accel_odr = DT_INST_PROP(inst, accel_odr), \
|
||||
.accel_range = DT_INST_PROP(inst, accel_range) | \
|
||||
(DT_NODE_HAS_COMPAT(DT_DRV_INST(inst), st_lsm6dso32) ? \
|
||||
(DT_INST_NODE_HAS_COMPAT(inst, st_lsm6dso32) ? \
|
||||
ACCEL_RANGE_DOUBLE : 0), \
|
||||
.gyro_pm = DT_INST_PROP(inst, gyro_pm), \
|
||||
.gyro_odr = DT_INST_PROP(inst, gyro_odr), \
|
||||
|
|
|
@ -550,7 +550,7 @@ static const struct uart_driver_api uart_rcar_driver_api = {
|
|||
.bus_clk.module = DT_INST_CLOCKS_CELL_BY_IDX(n, 1, module), \
|
||||
.bus_clk.domain = DT_INST_CLOCKS_CELL_BY_IDX(n, 1, domain), \
|
||||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
|
||||
.is_hscif = DT_NODE_HAS_COMPAT(DT_DRV_INST(n), renesas_rcar_hscif), \
|
||||
.is_hscif = DT_INST_NODE_HAS_COMPAT(n, renesas_rcar_hscif), \
|
||||
IRQ_FUNC_INIT \
|
||||
}
|
||||
|
||||
|
|
|
@ -128,12 +128,12 @@ static int usb_dw_init_pinctrl(const struct usb_dw_config *const config)
|
|||
#define USB_DW_GET_COMPAT_QUIRK_NONE(n) NULL
|
||||
|
||||
#define USB_DW_GET_COMPAT_CLK_QUIRK_0(n) \
|
||||
COND_CODE_1(DT_NODE_HAS_COMPAT(DT_DRV_INST(n), st_stm32f4_fsotg), \
|
||||
COND_CODE_1(DT_INST_NODE_HAS_COMPAT(n, st_stm32f4_fsotg), \
|
||||
(clk_enable_st_stm32f4_fsotg_##n), \
|
||||
USB_DW_GET_COMPAT_QUIRK_NONE(n))
|
||||
|
||||
#define USB_DW_GET_COMPAT_PWR_QUIRK_0(n) \
|
||||
COND_CODE_1(DT_NODE_HAS_COMPAT(DT_DRV_INST(n), st_stm32f4_fsotg), \
|
||||
COND_CODE_1(DT_INST_NODE_HAS_COMPAT(n, st_stm32f4_fsotg), \
|
||||
(pwr_on_st_stm32f4_fsotg), \
|
||||
USB_DW_GET_COMPAT_QUIRK_NONE(n))
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ static inline int pwr_on_st_stm32f4_fsotg(struct usb_dwc2_reg *const base)
|
|||
}
|
||||
|
||||
#define USB_DW_QUIRK_ST_STM32F4_FSOTG_DEFINE(n) \
|
||||
COND_CODE_1(DT_NODE_HAS_COMPAT(DT_DRV_INST(n), st_stm32f4_fsotg), \
|
||||
COND_CODE_1(DT_INST_NODE_HAS_COMPAT(n, st_stm32f4_fsotg), \
|
||||
(QUIRK_ST_STM32F4_FSOTG_DEFINE(n)), ())
|
||||
|
||||
#endif /* ZEPHYR_DRIVERS_USB_DEVICE_USB_DC_DW_STM32_H */
|
||||
|
|
Loading…
Reference in a new issue