From 071e7adefb172105a08240a7bf4865ea604583e9 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Wed, 9 Dec 2020 11:00:35 -0600 Subject: [PATCH] drivers: i2c: Convert drivers to new DT device macros Convert i2c drivers from: DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE DEVICE_GET -> DEVICE_DT_INST_GET DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE Signed-off-by: Kumar Gala --- drivers/i2c/i2c_cc13xx_cc26xx.c | 6 +++--- drivers/i2c/i2c_cc32xx.c | 4 ++-- drivers/i2c/i2c_dw_port_x.h | 9 ++++----- drivers/i2c/i2c_emul.c | 4 ++-- drivers/i2c/i2c_esp32.c | 12 ++++++------ drivers/i2c/i2c_gecko.c | 8 ++++---- drivers/i2c/i2c_gpio.c | 3 ++- drivers/i2c/i2c_imx.c | 5 +++-- drivers/i2c/i2c_litex.c | 4 ++-- drivers/i2c/i2c_lpc11u6x.c | 5 +++-- drivers/i2c/i2c_mchp_xec.c | 5 ++--- drivers/i2c/i2c_mcux.c | 8 ++++---- drivers/i2c/i2c_mcux_flexcomm.c | 6 +++--- drivers/i2c/i2c_mcux_lpi2c.c | 6 +++--- drivers/i2c/i2c_nios2.c | 4 ++-- drivers/i2c/i2c_rv32m1_lpi2c.c | 6 +++--- drivers/i2c/i2c_sam0.c | 6 +++--- drivers/i2c/i2c_sam4l_twim.c | 8 ++++---- drivers/i2c/i2c_sam_twi.c | 8 ++++---- drivers/i2c/i2c_sam_twihs.c | 8 ++++---- drivers/i2c/i2c_sbcon.c | 3 ++- drivers/i2c/i2c_sifive.c | 4 ++-- 22 files changed, 67 insertions(+), 65 deletions(-) diff --git a/drivers/i2c/i2c_cc13xx_cc26xx.c b/drivers/i2c/i2c_cc13xx_cc26xx.c index 7f1a5a9494..167dc6632f 100644 --- a/drivers/i2c/i2c_cc13xx_cc26xx.c +++ b/drivers/i2c/i2c_cc13xx_cc26xx.c @@ -23,7 +23,7 @@ LOG_MODULE_REGISTER(i2c_cc13xx_cc26xx); #include "i2c-priv.h" -DEVICE_DECLARE(i2c_cc13xx_cc26xx); +DEVICE_DT_INST_DECLARE(0); struct i2c_cc13xx_cc26xx_data { struct k_sem lock; @@ -439,7 +439,7 @@ static int i2c_cc13xx_cc26xx_init(const struct device *dev) IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), - i2c_cc13xx_cc26xx_isr, DEVICE_GET(i2c_cc13xx_cc26xx), 0); + i2c_cc13xx_cc26xx_isr, DEVICE_DT_INST_GET(0), 0); irq_enable(DT_INST_IRQN(0)); /* Configure IOC module to route SDA and SCL signals */ @@ -475,7 +475,7 @@ static struct i2c_cc13xx_cc26xx_data i2c_cc13xx_cc26xx_data = { .error = I2C_MASTER_ERR_NONE }; -DEVICE_DEFINE(i2c_cc13xx_cc26xx, DT_INST_LABEL(0), +DEVICE_DT_INST_DEFINE(0, i2c_cc13xx_cc26xx_init, i2c_cc13xx_cc26xx_pm_control, &i2c_cc13xx_cc26xx_data, &i2c_cc13xx_cc26xx_config, diff --git a/drivers/i2c/i2c_cc32xx.c b/drivers/i2c/i2c_cc32xx.c index b41d97862d..ada8c6b591 100644 --- a/drivers/i2c/i2c_cc32xx.c +++ b/drivers/i2c/i2c_cc32xx.c @@ -382,7 +382,7 @@ static const struct i2c_cc32xx_config i2c_cc32xx_config = { static struct i2c_cc32xx_data i2c_cc32xx_data; -DEVICE_AND_API_INIT(i2c_cc32xx, DT_INST_LABEL(0), &i2c_cc32xx_init, +DEVICE_DT_INST_DEFINE(0, &i2c_cc32xx_init, device_pm_control_nop, &i2c_cc32xx_data, &i2c_cc32xx_config, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &i2c_cc32xx_driver_api); @@ -391,7 +391,7 @@ static void configure_i2c_irq(const struct i2c_cc32xx_config *config) { IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), - i2c_cc32xx_isr, DEVICE_GET(i2c_cc32xx), 0); + i2c_cc32xx_isr, DEVICE_DT_INST_GET(0), 0); irq_enable(config->irq_no); } diff --git a/drivers/i2c/i2c_dw_port_x.h b/drivers/i2c/i2c_dw_port_x.h index fd1c4a31f8..8c0f7b48ea 100644 --- a/drivers/i2c/i2c_dw_port_x.h +++ b/drivers/i2c/i2c_dw_port_x.h @@ -22,8 +22,7 @@ static const struct i2c_dw_rom_config i2c_config_dw_@NUM@ = { static struct i2c_dw_dev_config i2c_@NUM@_runtime; -DEVICE_AND_API_INIT(i2c_@NUM@, DT_INST_LABEL(@NUM@), - &i2c_dw_initialize, +DEVICE_DT_INST_DEFINE(@NUM@, &i2c_dw_initialize, device_pm_control_nop, &i2c_@NUM@_runtime, &i2c_config_dw_@NUM@, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, &funcs); @@ -56,7 +55,7 @@ static void i2c_config_@NUM@(const struct device *port) irq_connect_dynamic(irq, DT_INST_IRQ(@NUM@, priority), (void (*)(const void *))i2c_dw_isr, - DEVICE_GET(i2c_@NUM@), INST_@NUM@_IRQ_FLAGS); + DEVICE_DT_INST_GET(@NUM@), INST_@NUM@_IRQ_FLAGS); pcie_irq_enable(DT_INST_REG_ADDR(@NUM@), irq); #else @@ -65,7 +64,7 @@ static void i2c_config_@NUM@(const struct device *port) IRQ_CONNECT(DT_INST_IRQN(@NUM@), DT_INST_IRQ(@NUM@, priority), - i2c_dw_isr, DEVICE_GET(i2c_@NUM@), + i2c_dw_isr, DEVICE_DT_INST_GET(@NUM@), INST_@NUM@_IRQ_FLAGS); pcie_irq_enable(DT_INST_REG_ADDR(@NUM@), DT_INST_IRQN(@NUM@)); @@ -77,7 +76,7 @@ static void i2c_config_@NUM@(const struct device *port) IRQ_CONNECT(DT_INST_IRQN(@NUM@), DT_INST_IRQ(@NUM@, priority), - i2c_dw_isr, DEVICE_GET(i2c_@NUM@), + i2c_dw_isr, DEVICE_DT_INST_GET(@NUM@), INST_@NUM@_IRQ_FLAGS); irq_enable(DT_INST_IRQN(@NUM@)); diff --git a/drivers/i2c/i2c_emul.c b/drivers/i2c/i2c_emul.c index 0def4a731b..84005fc10a 100644 --- a/drivers/i2c/i2c_emul.c +++ b/drivers/i2c/i2c_emul.c @@ -143,9 +143,9 @@ static struct i2c_driver_api i2c_emul_api = { .num_children = ARRAY_SIZE(emuls_##n), \ }; \ static struct i2c_emul_data i2c_emul_data_##n; \ - DEVICE_AND_API_INIT(i2c_##n, \ - DT_INST_LABEL(n), \ + DEVICE_DT_INST_DEFINE(n, \ i2c_emul_init, \ + device_pm_control_nop, \ &i2c_emul_data_##n, \ &i2c_emul_cfg_##n, \ POST_KERNEL, \ diff --git a/drivers/i2c/i2c_esp32.c b/drivers/i2c/i2c_esp32.c index 964f83a023..ffd9749782 100644 --- a/drivers/i2c/i2c_esp32.c +++ b/drivers/i2c/i2c_esp32.c @@ -579,12 +579,12 @@ static const struct i2c_driver_api i2c_esp32_driver_api = { }; #if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) -DEVICE_DECLARE(i2c_esp32_0); +DEVICE_DT_INST_DECLARE(0); static void i2c_esp32_connect_irq_0(void) { IRQ_CONNECT(CONFIG_I2C_ESP32_0_IRQ, 1, i2c_esp32_isr, - DEVICE_GET(i2c_esp32_0), 0); + DEVICE_DT_INST_GET(0), 0); } static const struct i2c_esp32_config i2c_esp32_config_0 = { @@ -618,19 +618,19 @@ static const struct i2c_esp32_config i2c_esp32_config_0 = { static struct i2c_esp32_data i2c_esp32_data_0; -DEVICE_AND_API_INIT(i2c_esp32_0, DT_INST_LABEL(0), &i2c_esp32_init, +DEVICE_DT_INST_DEFINE(0, &i2c_esp32_init, device_pm_control_nop, &i2c_esp32_data_0, &i2c_esp32_config_0, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, &i2c_esp32_driver_api); #endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ #if DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) -DEVICE_DECLARE(i2c_esp32_1); +DEVICE_DT_INST_DECLARE(1); static void i2c_esp32_connect_irq_1(void) { IRQ_CONNECT(CONFIG_I2C_ESP32_1_IRQ, 1, i2c_esp32_isr, - DEVICE_GET(i2c_esp32_1), 0); + DEVICE_DT_INST_GET(1), 0); } static const struct i2c_esp32_config i2c_esp32_config_1 = { @@ -664,7 +664,7 @@ static const struct i2c_esp32_config i2c_esp32_config_1 = { static struct i2c_esp32_data i2c_esp32_data_1; -DEVICE_AND_API_INIT(i2c_esp32_1, DT_INST_LABEL(1), &i2c_esp32_init, +DEVICE_DT_INST_DEFINE(1, &i2c_esp32_init, device_pm_control_nop, &i2c_esp32_data_1, &i2c_esp32_config_1, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, &i2c_esp32_driver_api); diff --git a/drivers/i2c/i2c_gecko.c b/drivers/i2c/i2c_gecko.c index b08de317ad..84d532fa99 100644 --- a/drivers/i2c/i2c_gecko.c +++ b/drivers/i2c/i2c_gecko.c @@ -224,8 +224,8 @@ static const struct i2c_gecko_config i2c_gecko_config_0 = { static struct i2c_gecko_data i2c_gecko_data_0; -DEVICE_AND_API_INIT(i2c_gecko_0, DT_INST_LABEL(0), - &i2c_gecko_init, &i2c_gecko_data_0, &i2c_gecko_config_0, +DEVICE_DT_INST_DEFINE(0, &i2c_gecko_init, device_pm_control_nop, + &i2c_gecko_data_0, &i2c_gecko_config_0, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &i2c_gecko_driver_api); #endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay) */ @@ -257,8 +257,8 @@ static const struct i2c_gecko_config i2c_gecko_config_1 = { static struct i2c_gecko_data i2c_gecko_data_1; -DEVICE_AND_API_INIT(i2c_gecko_1, DT_INST_LABEL(1), - &i2c_gecko_init, &i2c_gecko_data_1, &i2c_gecko_config_1, +DEVICE_DT_INST_DEFINE(1, &i2c_gecko_init, device_pm_control_nop, + &i2c_gecko_data_1, &i2c_gecko_config_1, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &i2c_gecko_driver_api); #endif /* DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay) */ diff --git a/drivers/i2c/i2c_gpio.c b/drivers/i2c/i2c_gpio.c index 504682c26f..03618e626e 100644 --- a/drivers/i2c/i2c_gpio.c +++ b/drivers/i2c/i2c_gpio.c @@ -182,8 +182,9 @@ static const struct i2c_gpio_config i2c_gpio_dev_cfg_##_num = { \ .bitrate = DT_INST_PROP(_num, clock_frequency), \ }; \ \ -DEVICE_AND_API_INIT(i2c_gpio_##_num, DT_INST_LABEL(_num), \ +DEVICE_DT_INST_DEFINE(_num, \ i2c_gpio_init, \ + device_pm_control_nop, \ &i2c_gpio_dev_data_##_num, \ &i2c_gpio_dev_cfg_##_num, \ POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, &api); diff --git a/drivers/i2c/i2c_imx.c b/drivers/i2c/i2c_imx.c index 1a46f35177..043b10f2b5 100644 --- a/drivers/i2c/i2c_imx.c +++ b/drivers/i2c/i2c_imx.c @@ -371,8 +371,9 @@ static const struct i2c_driver_api i2c_imx_driver_api = { \ static struct i2c_imx_data i2c_imx_data_##n; \ \ - DEVICE_AND_API_INIT(i2c_imx_##n, DT_INST_LABEL(n), \ + DEVICE_DT_INST_DEFINE(n, \ &i2c_imx_init, \ + device_pm_control_nop, \ &i2c_imx_data_##n, &i2c_imx_config_##n, \ POST_KERNEL, \ CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ @@ -384,7 +385,7 @@ static const struct i2c_driver_api i2c_imx_driver_api = { \ IRQ_CONNECT(DT_INST_IRQN(n), \ DT_INST_IRQ(n, priority), \ - i2c_imx_isr, DEVICE_GET(i2c_imx_##n), 0); \ + i2c_imx_isr, DEVICE_DT_INST_GET(n), 0); \ \ irq_enable(DT_INST_IRQN(n)); \ } diff --git a/drivers/i2c/i2c_litex.c b/drivers/i2c/i2c_litex.c index f83c416911..c53711f62e 100644 --- a/drivers/i2c/i2c_litex.c +++ b/drivers/i2c/i2c_litex.c @@ -126,9 +126,9 @@ static const struct i2c_driver_api i2c_litex_driver_api = { \ static struct i2c_bitbang i2c_bitbang_##n; \ \ - DEVICE_AND_API_INIT(litex_i2c_##n, \ - DT_INST_LABEL(n), \ + DEVICE_DT_INST_DEFINE(n, \ i2c_litex_init, \ + device_pm_control_nop, \ &i2c_bitbang_##n, \ &i2c_litex_cfg_##n, \ POST_KERNEL, \ diff --git a/drivers/i2c/i2c_lpc11u6x.c b/drivers/i2c/i2c_lpc11u6x.c index 003ffc3f8d..9b13dcdb8a 100644 --- a/drivers/i2c/i2c_lpc11u6x.c +++ b/drivers/i2c/i2c_lpc11u6x.c @@ -401,8 +401,9 @@ static const struct lpc11u6x_i2c_config i2c_cfg_##idx = { \ \ static struct lpc11u6x_i2c_data i2c_data_##idx; \ \ -DEVICE_AND_API_INIT(lpc11u6x_i2c_##idx, DT_INST_LABEL(idx), \ +DEVICE_DT_INST_DEFINE(idx, \ &lpc11u6x_i2c_init, \ + device_pm_control_nop, \ &i2c_data_##idx, &i2c_cfg_##idx, \ PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_OBJECTS, \ &i2c_api); \ @@ -411,7 +412,7 @@ static void lpc11u6x_i2c_isr_config_##idx(const struct device *dev) \ { \ IRQ_CONNECT(DT_INST_IRQN(idx), \ DT_INST_IRQ(idx, priority), \ - lpc11u6x_i2c_isr, DEVICE_GET(lpc11u6x_i2c_##idx), 0); \ + lpc11u6x_i2c_isr, DEVICE_DT_INST_GET(idx), 0); \ \ irq_enable(DT_INST_IRQN(idx)); \ } diff --git a/drivers/i2c/i2c_mchp_xec.c b/drivers/i2c/i2c_mchp_xec.c index 9f0ccb9659..45b54fc2c9 100644 --- a/drivers/i2c/i2c_mchp_xec.c +++ b/drivers/i2c/i2c_mchp_xec.c @@ -424,9 +424,8 @@ static int i2c_xec_init(const struct device *dev) DT_INST_REG_ADDR(n), \ .port_sel = DT_INST_PROP(n, port_sel), \ }; \ - DEVICE_AND_API_INIT(i2c_xec_##n, \ - DT_INST_LABEL(n), \ - &i2c_xec_init, &i2c_xec_data_##n, &i2c_xec_config_##n, \ + DEVICE_DT_INST_DEFINE(n, &i2c_xec_init, device_pm_control_nop, \ + &i2c_xec_data_##n, &i2c_xec_config_##n, \ POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ &i2c_xec_driver_api); diff --git a/drivers/i2c/i2c_mcux.c b/drivers/i2c/i2c_mcux.c index 9b445e3d3f..b804cc8a67 100644 --- a/drivers/i2c/i2c_mcux.c +++ b/drivers/i2c/i2c_mcux.c @@ -230,9 +230,9 @@ static const struct i2c_driver_api i2c_mcux_driver_api = { \ static struct i2c_mcux_data i2c_mcux_data_ ## n; \ \ - DEVICE_AND_API_INIT(i2c_mcux_ ## n, \ - DT_INST_LABEL(n), \ - &i2c_mcux_init, &i2c_mcux_data_ ## n, \ + DEVICE_DT_INST_DEFINE(n, \ + &i2c_mcux_init, device_pm_control_nop, \ + &i2c_mcux_data_ ## n, \ &i2c_mcux_config_ ## n, POST_KERNEL, \ CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &i2c_mcux_driver_api); \ @@ -242,7 +242,7 @@ static const struct i2c_driver_api i2c_mcux_driver_api = { IRQ_CONNECT(DT_INST_IRQN(n), \ DT_INST_IRQ(n, priority), \ i2c_mcux_isr, \ - DEVICE_GET(i2c_mcux_ ## n), 0); \ + DEVICE_DT_INST_GET(n), 0); \ \ irq_enable(DT_INST_IRQN(n)); \ } diff --git a/drivers/i2c/i2c_mcux_flexcomm.c b/drivers/i2c/i2c_mcux_flexcomm.c index e9725939d9..bf1594aa51 100644 --- a/drivers/i2c/i2c_mcux_flexcomm.c +++ b/drivers/i2c/i2c_mcux_flexcomm.c @@ -232,9 +232,9 @@ static const struct i2c_driver_api mcux_flexcomm_driver_api = { .bitrate = DT_INST_PROP(id, clock_frequency), \ }; \ static struct mcux_flexcomm_data mcux_flexcomm_data_##id; \ - DEVICE_AND_API_INIT(mcux_flexcomm_##id, \ - DT_INST_LABEL(id), \ + DEVICE_DT_INST_DEFINE(id, \ &mcux_flexcomm_init, \ + device_pm_control_nop, \ &mcux_flexcomm_data_##id, \ &mcux_flexcomm_config_##id, \ POST_KERNEL, \ @@ -245,7 +245,7 @@ static const struct i2c_driver_api mcux_flexcomm_driver_api = { IRQ_CONNECT(DT_INST_IRQN(id), \ DT_INST_IRQ(id, priority), \ mcux_flexcomm_isr, \ - DEVICE_GET(mcux_flexcomm_##id), \ + DEVICE_DT_INST_GET(id), \ 0); \ irq_enable(DT_INST_IRQN(id)); \ } \ diff --git a/drivers/i2c/i2c_mcux_lpi2c.c b/drivers/i2c/i2c_mcux_lpi2c.c index b16afb69b9..9c5bf8a421 100644 --- a/drivers/i2c/i2c_mcux_lpi2c.c +++ b/drivers/i2c/i2c_mcux_lpi2c.c @@ -251,8 +251,8 @@ static const struct i2c_driver_api mcux_lpi2c_driver_api = { \ static struct mcux_lpi2c_data mcux_lpi2c_data_##n; \ \ - DEVICE_AND_API_INIT(mcux_lpi2c_##n, DT_INST_LABEL(n), \ - &mcux_lpi2c_init, &mcux_lpi2c_data_##n, \ + DEVICE_DT_INST_DEFINE(n, &mcux_lpi2c_init, device_pm_control_nop,\ + &mcux_lpi2c_data_##n, \ &mcux_lpi2c_config_##n, POST_KERNEL, \ CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &mcux_lpi2c_driver_api); \ @@ -262,7 +262,7 @@ static const struct i2c_driver_api mcux_lpi2c_driver_api = { IRQ_CONNECT(DT_INST_IRQN(n), \ DT_INST_IRQ(n, priority), \ mcux_lpi2c_isr, \ - DEVICE_GET(mcux_lpi2c_##n), 0); \ + DEVICE_DT_INST_GET(n), 0); \ \ irq_enable(DT_INST_IRQN(n)); \ } diff --git a/drivers/i2c/i2c_nios2.c b/drivers/i2c/i2c_nios2.c index d575c58cd0..3ad93e9b9a 100644 --- a/drivers/i2c/i2c_nios2.c +++ b/drivers/i2c/i2c_nios2.c @@ -165,7 +165,7 @@ static struct i2c_nios2_config i2c_nios2_cfg = { }, }; -DEVICE_AND_API_INIT(i2c_nios2_0, DT_INST_LABEL(0), &i2c_nios2_init, +DEVICE_DT_INST_DEFINE(0, &i2c_nios2_init, device_pm_control_nop, NULL, &i2c_nios2_cfg, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &i2c_nios2_driver_api); @@ -190,7 +190,7 @@ static int i2c_nios2_init(const struct device *dev) alt_avalon_i2c_int_clear(&config->i2c_dev, ALT_AVALON_I2C_ISR_ALL_CLEARABLE_INTS_MSK); IRQ_CONNECT(I2C_0_IRQ, CONFIG_I2C_0_IRQ_PRI, - i2c_nios2_isr, DEVICE_GET(i2c_nios2_0), 0); + i2c_nios2_isr, DEVICE_DT_INST_GET(0), 0); irq_enable(I2C_0_IRQ); return 0; } diff --git a/drivers/i2c/i2c_rv32m1_lpi2c.c b/drivers/i2c/i2c_rv32m1_lpi2c.c index a7a2ca021a..9fe23abc5e 100644 --- a/drivers/i2c/i2c_rv32m1_lpi2c.c +++ b/drivers/i2c/i2c_rv32m1_lpi2c.c @@ -280,9 +280,9 @@ static const struct i2c_driver_api rv32m1_lpi2c_driver_api = { .completion_sync = Z_SEM_INITIALIZER( \ rv32m1_lpi2c_##id##_data.completion_sync, 0, 1), \ }; \ - DEVICE_AND_API_INIT(rv32m1_lpi2c_##id, \ - DT_INST_LABEL(id), \ + DEVICE_DT_INST_DEFINE(id, \ &rv32m1_lpi2c_init, \ + device_pm_control_nop, \ &rv32m1_lpi2c_##id##_data, \ &rv32m1_lpi2c_##id##_config, \ POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ @@ -291,7 +291,7 @@ static const struct i2c_driver_api rv32m1_lpi2c_driver_api = { { \ IRQ_CONNECT(DT_INST_IRQN(id), \ 0, \ - rv32m1_lpi2c_isr, DEVICE_GET(rv32m1_lpi2c_##id), \ + rv32m1_lpi2c_isr, DEVICE_DT_INST_GET(id), \ 0); \ irq_enable(DT_INST_IRQN(id)); \ } \ diff --git a/drivers/i2c/i2c_sam0.c b/drivers/i2c/i2c_sam0.c index 76cd4b342a..850b44f5ff 100644 --- a/drivers/i2c/i2c_sam0.c +++ b/drivers/i2c/i2c_sam0.c @@ -751,7 +751,7 @@ static const struct i2c_driver_api i2c_sam0_driver_api = { IRQ_CONNECT(DT_INST_IRQ_BY_IDX(n, m, irq), \ DT_INST_IRQ_BY_IDX(n, m, priority), \ i2c_sam0_isr, \ - DEVICE_GET(i2c_sam0_##n), 0); \ + DEVICE_DT_INST_GET(n), 0); \ irq_enable(DT_INST_IRQ_BY_IDX(n, m, irq)); \ } while (0) @@ -799,9 +799,9 @@ static const struct i2c_sam0_dev_config i2c_sam0_dev_config_##n = { \ static void i2c_sam0_irq_config_##n(const struct device *dev); \ I2C_SAM0_CONFIG(n); \ static struct i2c_sam0_dev_data i2c_sam0_dev_data_##n; \ - DEVICE_AND_API_INIT(i2c_sam0_##n, \ - DT_INST_LABEL(n), \ + DEVICE_DT_INST_DEFINE(n, \ &i2c_sam0_initialize, \ + device_pm_control_nop, \ &i2c_sam0_dev_data_##n, \ &i2c_sam0_dev_config_##n, POST_KERNEL, \ CONFIG_I2C_INIT_PRIORITY, \ diff --git a/drivers/i2c/i2c_sam4l_twim.c b/drivers/i2c/i2c_sam4l_twim.c index 87bbc030be..730b03f50a 100644 --- a/drivers/i2c/i2c_sam4l_twim.c +++ b/drivers/i2c/i2c_sam4l_twim.c @@ -607,13 +607,13 @@ static const struct i2c_driver_api i2c_sam_twim_driver_api = { .hs_data_strength_low = DT_INST_ENUM_IDX(n, hs_data_strength_low) #define I2C_TWIM_SAM_INIT(n) \ - static const struct device DEVICE_NAME_GET(i2c##n##_sam); \ + DEVICE_DT_INST_DECLARE(n); \ \ static void i2c##n##_sam_irq_config(void) \ { \ IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), \ i2c_sam_twim_isr, \ - DEVICE_GET(i2c##n##_sam), 0); \ + DEVICE_DT_INST_GET(n), 0); \ } \ \ static const struct soc_gpio_pin pins_twim##n[] = \ @@ -633,8 +633,8 @@ static const struct i2c_driver_api i2c_sam_twim_driver_api = { \ static struct i2c_sam_twim_dev_data i2c##n##_sam_data; \ \ - DEVICE_AND_API_INIT(i2c##n##_sam, DT_INST_LABEL(n), \ - &i2c_sam_twim_initialize, \ + DEVICE_DT_INST_DEFINE(n, &i2c_sam_twim_initialize, \ + device_pm_control_nop, \ &i2c##n##_sam_data, &i2c##n##_sam_config, \ POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ &i2c_sam_twim_driver_api) diff --git a/drivers/i2c/i2c_sam_twi.c b/drivers/i2c/i2c_sam_twi.c index 76177f7e9c..a31b2b30e3 100644 --- a/drivers/i2c/i2c_sam_twi.c +++ b/drivers/i2c/i2c_sam_twi.c @@ -339,13 +339,13 @@ static const struct i2c_driver_api i2c_sam_twi_driver_api = { }; #define I2C_TWI_SAM_INIT(n) \ - DEVICE_DECLARE(i2c##n##_sam); \ + DEVICE_DT_INST_DECLARE(n); \ \ static void i2c##n##_sam_irq_config(void) \ { \ IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), \ i2c_sam_twi_isr, \ - DEVICE_GET(i2c##n##_sam), 0); \ + DEVICE_DT_INST_GET(n), 0); \ } \ \ static const struct soc_gpio_pin pins_twi##n[] = \ @@ -363,8 +363,8 @@ static const struct i2c_driver_api i2c_sam_twi_driver_api = { \ static struct i2c_sam_twi_dev_data i2c##n##_sam_data; \ \ - DEVICE_AND_API_INIT(i2c##n##_sam, DT_INST_LABEL(n), \ - &i2c_sam_twi_initialize, \ + DEVICE_DT_INST_DEFINE(n, &i2c_sam_twi_initialize, \ + device_pm_control_nop, \ &i2c##n##_sam_data, &i2c##n##_sam_config, \ POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ &i2c_sam_twi_driver_api); diff --git a/drivers/i2c/i2c_sam_twihs.c b/drivers/i2c/i2c_sam_twihs.c index 261544b6b5..f0a483101e 100644 --- a/drivers/i2c/i2c_sam_twihs.c +++ b/drivers/i2c/i2c_sam_twihs.c @@ -326,13 +326,13 @@ static const struct i2c_driver_api i2c_sam_twihs_driver_api = { }; #define I2C_TWIHS_SAM_INIT(n) \ - DEVICE_DECLARE(i2c##n##_sam); \ + DEVICE_DT_INST_DECLARE(n); \ \ static void i2c##n##_sam_irq_config(void) \ { \ IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), \ i2c_sam_twihs_isr, \ - DEVICE_GET(i2c##n##_sam), 0); \ + DEVICE_DT_INST_GET(n), 0); \ } \ \ static const struct soc_gpio_pin pins_twihs##n[] = \ @@ -350,8 +350,8 @@ static const struct i2c_driver_api i2c_sam_twihs_driver_api = { \ static struct i2c_sam_twihs_dev_data i2c##n##_sam_data; \ \ - DEVICE_AND_API_INIT(i2c##n##_sam, DT_INST_LABEL(n), \ - &i2c_sam_twihs_initialize, \ + DEVICE_DT_INST_DEFINE(n, &i2c_sam_twihs_initialize, \ + device_pm_control_nop, \ &i2c##n##_sam_data, &i2c##n##_sam_config, \ POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ &i2c_sam_twihs_driver_api); diff --git a/drivers/i2c/i2c_sbcon.c b/drivers/i2c/i2c_sbcon.c index e56c408275..3deb485176 100644 --- a/drivers/i2c/i2c_sbcon.c +++ b/drivers/i2c/i2c_sbcon.c @@ -116,8 +116,9 @@ static const struct i2c_sbcon_config i2c_sbcon_dev_cfg_##_num = { \ .sbcon = (void *)DT_INST_REG_ADDR(_num), \ }; \ \ -DEVICE_AND_API_INIT(i2c_sbcon_##_num, DT_INST_LABEL(_num), \ +DEVICE_DT_INST_DEFINE(_num, \ i2c_sbcon_init, \ + device_pm_control_nop, \ &i2c_sbcon_dev_data_##_num, \ &i2c_sbcon_dev_cfg_##_num, \ PRE_KERNEL_2, CONFIG_I2C_INIT_PRIORITY, &api); diff --git a/drivers/i2c/i2c_sifive.c b/drivers/i2c/i2c_sifive.c index dc09387d32..527b0b5406 100644 --- a/drivers/i2c/i2c_sifive.c +++ b/drivers/i2c/i2c_sifive.c @@ -329,9 +329,9 @@ static struct i2c_driver_api i2c_sifive_api = { .f_sys = DT_INST_PROP(n, input_frequency), \ .f_bus = DT_INST_PROP(n, clock_frequency), \ }; \ - DEVICE_AND_API_INIT(i2c_##n, \ - DT_INST_LABEL(n), \ + DEVICE_DT_INST_DEFINE(n \ i2c_sifive_init, \ + device_pm_control_nop, \ NULL, \ &i2c_sifive_cfg_##n, \ POST_KERNEL, \