drivers: s/DT_CHILD(DT_DRV_INST(n), ...)/DT_INST_CHILD(n, ...)

Use instance version of DT_CHILD when possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-09-06 12:22:33 +02:00 committed by Marti Bolivar
parent 3732bbfa12
commit 8081d7f2a4
6 changed files with 10 additions and 11 deletions

View file

@ -18,7 +18,7 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(clock_control_scg);
#define MCUX_SCG_CLOCK_NODE(name) DT_CHILD(DT_DRV_INST(0), name)
#define MCUX_SCG_CLOCK_NODE(name) DT_INST_CHILD(0, name)
static int mcux_scg_on(const struct device *dev,
clock_control_subsys_t sub_system)

View file

@ -21,7 +21,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#if defined(CONFIG_ETH_E1000_PTP_CLOCK)
#include <zephyr/drivers/ptp_clock.h>
#define PTP_INST_NODEID(n) DT_CHILD(DT_DRV_INST(n), ptp)
#define PTP_INST_NODEID(n) DT_INST_CHILD(n, ptp)
#endif
#if defined(CONFIG_ETH_E1000_VERBOSE_DEBUG)

View file

@ -1405,7 +1405,7 @@ static void eth_mcux_err_isr(const struct device *dev)
(ETH_MCUX_NONE))
#if defined(CONFIG_PTP_CLOCK_MCUX)
#define PTP_INST_NODEID(n) DT_CHILD(DT_DRV_INST(n), ptp)
#define PTP_INST_NODEID(n) DT_INST_CHILD(n, ptp)
#define ETH_MCUX_IRQ_PTP_INIT(n) \
do { \

View file

@ -2213,8 +2213,8 @@ static const struct eth_sam_dev_cfg eth0_config = {
.periph_id = DT_INST_PROP_OR(0, peripheral_id, 0),
#endif
.config_func = eth0_irq_config,
#if DT_NODE_EXISTS(DT_CHILD(DT_DRV_INST(0), phy))
.phy_dev = DEVICE_DT_GET(DT_CHILD(DT_DRV_INST(0), phy))
#if DT_NODE_EXISTS(DT_INST_CHILD(0, phy))
.phy_dev = DEVICE_DT_GET(DT_INST_CHILD(0, phy))
#else
#error "No PHY driver specified"
#endif

View file

@ -31,9 +31,9 @@
/* configuration derived from DT */
#ifdef CONFIG_ARCH_POSIX
#define SOC_NV_FLASH_NODE DT_CHILD(DT_DRV_INST(0), flash_0)
#define SOC_NV_FLASH_NODE DT_INST_CHILD(0, flash_0)
#else
#define SOC_NV_FLASH_NODE DT_CHILD(DT_DRV_INST(0), flash_sim_0)
#define SOC_NV_FLASH_NODE DT_INST_CHILD(0, flash_sim_0)
#endif /* CONFIG_ARCH_POSIX */
#define FLASH_SIMULATOR_BASE_OFFSET DT_REG_ADDR(SOC_NV_FLASH_NODE)

View file

@ -249,10 +249,9 @@ static const struct gpio_driver_api gpio_xlnx_axi_driver_api = {
#define GPIO_XLNX_AXI_GPIO2_HAS_COMPAT_STATUS_OKAY(n) \
UTIL_AND( \
DT_NODE_HAS_COMPAT(DT_CHILD(DT_DRV_INST(n), gpio2), \
DT_NODE_HAS_COMPAT(DT_INST_CHILD(n, gpio2), \
xlnx_xps_gpio_1_00_a_gpio2), \
DT_NODE_HAS_STATUS(DT_CHILD(DT_DRV_INST(n), gpio2), \
okay) \
DT_NODE_HAS_STATUS(DT_INST_CHILD(n, gpio2), okay) \
)
#define GPIO_XLNX_AXI_GPIO2_COND_INIT(n) \
@ -281,7 +280,7 @@ static const struct gpio_driver_api gpio_xlnx_axi_driver_api = {
.all_outputs = DT_INST_PROP_OR(n, xlnx_all_outputs2, 0),\
}; \
\
DEVICE_DT_DEFINE(DT_CHILD(DT_DRV_INST(n), gpio2), \
DEVICE_DT_DEFINE(DT_INST_CHILD(n, gpio2), \
&gpio_xlnx_axi_init, \
NULL, \
&gpio_xlnx_axi_##n##_2_data, \