Skip to content

Commit 8015d1a

Browse files
committed
drivers/i2c: Switching I2C_DEVICE_DT_DEFINE macros to new ones
Switching to I2C_DEVICE_INSTANCE and I2C_DEVICE_INSTANCE_FROM_DT_INST relevantly. Signed-off-by: Tomasz Bursztyka <[email protected]>
1 parent 5c6ac50 commit 8015d1a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+131
-169
lines changed

drivers/i2c/gpio_i2c_switch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ static int gpio_i2c_switch_init(const struct device *dev)
9191
.gpio = GPIO_DT_SPEC_GET(DT_DRV_INST(inst), gpios), \
9292
}; \
9393
\
94-
I2C_DEVICE_DT_INST_DEFINE(inst, gpio_i2c_switch_init, device_pm_control_nop, \
94+
I2C_DEVICE_INSTANCE_FROM_DT_INST(inst, gpio_i2c_switch_init, device_pm_control_nop, \
9595
&gpio_i2c_switch_dev_data_##inst, &gpio_i2c_switch_dev_cfg_##inst, \
96-
POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, &gpio_i2c_switch_api_funcs);
96+
POST_KERNEL, &gpio_i2c_switch_api_funcs);
9797

9898
DT_INST_FOREACH_STATUS_OKAY(DEFINE_GPIO_I2C_SWITCH)

drivers/i2c/i2c_ambiq.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,7 @@ static int i2c_ambiq_pm_action(const struct device *dev, enum pm_device_action a
452452
(.scl = GPIO_DT_SPEC_INST_GET_OR(n, scl_gpios, {0}),\
453453
.sda = GPIO_DT_SPEC_INST_GET_OR(n, sda_gpios, {0}),)) }; \
454454
PM_DEVICE_DT_INST_DEFINE(n, i2c_ambiq_pm_action); \
455-
I2C_DEVICE_DT_INST_DEFINE(n, i2c_ambiq_init, PM_DEVICE_DT_INST_GET(n), &i2c_ambiq_data##n, \
456-
&i2c_ambiq_config##n, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \
457-
&i2c_ambiq_driver_api);
455+
I2C_DEVICE_INSTANCE_FROM_DT_INST(n, i2c_ambiq_init, PM_DEVICE_DT_INST_GET(n), &i2c_ambiq_data##n,\
456+
&i2c_ambiq_config##n, POST_KERNEL, &i2c_ambiq_driver_api);
458457

459458
DT_INST_FOREACH_STATUS_OKAY(AMBIQ_I2C_DEFINE)

drivers/i2c/i2c_andes_atciic100.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,13 +778,12 @@ static int i2c_atciic100_init(const struct device *dev)
778778
.irq_num = DT_INST_IRQN(n), \
779779
.dt_init_fn = i2c_dt_init_##n \
780780
}; \
781-
I2C_DEVICE_DT_INST_DEFINE(n, \
781+
I2C_DEVICE_INSTANCE_FROM_DT_INST(n, \
782782
i2c_atciic100_init, \
783783
NULL, \
784784
&i2c_atciic100_dev_data_##n, \
785785
&i2c_atciic100_config_##n, \
786786
POST_KERNEL, \
787-
CONFIG_I2C_INIT_PRIORITY, \
788787
&i2c_atciic100_driver); \
789788
\
790789
static void i2c_dt_init_##n(void) \

drivers/i2c/i2c_b91.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,11 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) <= 1,
170170
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \
171171
}; \
172172
\
173-
I2C_DEVICE_DT_INST_DEFINE(inst, i2c_b91_init, \
174-
NULL, \
175-
&i2c_b91_data_##inst, \
176-
&i2c_b91_cfg_##inst, \
177-
POST_KERNEL, \
178-
CONFIG_I2C_INIT_PRIORITY, \
173+
I2C_DEVICE_INSTANCE_FROM_DT_INST(inst, i2c_b91_init, \
174+
NULL, \
175+
&i2c_b91_data_##inst, \
176+
&i2c_b91_cfg_##inst, \
177+
POST_KERNEL, \
179178
&i2c_b91_api);
180179

181180
DT_INST_FOREACH_STATUS_OKAY(I2C_B91_INIT)

drivers/i2c/i2c_bcm_iproc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -946,8 +946,7 @@ static const struct i2c_driver_api iproc_i2c_driver_api = {
946946
\
947947
static struct iproc_i2c_data iproc_i2c_data_##n; \
948948
\
949-
I2C_DEVICE_DT_INST_DEFINE(n, &iproc_i2c_init, NULL, &iproc_i2c_data_##n, \
950-
&iproc_i2c_config_##n, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \
951-
&iproc_i2c_driver_api);
949+
I2C_DEVICE_INSTANCE_FROM_DT_INST(n, &iproc_i2c_init, NULL, &iproc_i2c_data_##n, \
950+
&iproc_i2c_config_##n, POST_KERNEL, &iproc_i2c_driver_api);
952951

953952
DT_INST_FOREACH_STATUS_OKAY(IPROC_I2C_DEVICE_INIT)

drivers/i2c/i2c_cc13xx_cc26xx.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,8 @@ static struct i2c_cc13xx_cc26xx_data i2c_cc13xx_cc26xx_data = {
442442

443443
PM_DEVICE_DT_INST_DEFINE(0, i2c_cc13xx_cc26xx_pm_action);
444444

445-
I2C_DEVICE_DT_INST_DEFINE(0,
445+
I2C_DEVICE_INSTANCE_FROM_DT_INST(0,
446446
i2c_cc13xx_cc26xx_init,
447447
PM_DEVICE_DT_INST_GET(0),
448448
&i2c_cc13xx_cc26xx_data, &i2c_cc13xx_cc26xx_config,
449-
POST_KERNEL, CONFIG_I2C_INIT_PRIORITY,
450-
&i2c_cc13xx_cc26xx_driver_api);
449+
POST_KERNEL, &i2c_cc13xx_cc26xx_driver_api);

drivers/i2c/i2c_cc32xx.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,9 @@ static const struct i2c_cc32xx_config i2c_cc32xx_config = {
398398

399399
static struct i2c_cc32xx_data i2c_cc32xx_data;
400400

401-
I2C_DEVICE_DT_INST_DEFINE(0, i2c_cc32xx_init, NULL,
401+
I2C_DEVICE_INSTANCE_FROM_DT_INST(0, i2c_cc32xx_init, NULL,
402402
&i2c_cc32xx_data, &i2c_cc32xx_config,
403-
POST_KERNEL, CONFIG_I2C_INIT_PRIORITY,
404-
&i2c_cc32xx_driver_api);
403+
POST_KERNEL, &i2c_cc32xx_driver_api);
405404

406405
static void configure_i2c_irq(const struct i2c_cc32xx_config *config)
407406
{

drivers/i2c/i2c_dw.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,9 +1218,8 @@ static int i2c_dw_initialize(const struct device *dev)
12181218
RESET_DW_CONFIG(n) PINCTRL_DW_CONFIG(n) I2C_DW_INIT_PCIE(n) \
12191219
I2C_CONFIG_DMA_INIT(n)}; \
12201220
static struct i2c_dw_dev_config i2c_##n##_runtime; \
1221-
I2C_DEVICE_DT_INST_DEFINE(n, i2c_dw_initialize, NULL, &i2c_##n##_runtime, \
1222-
&i2c_config_dw_##n, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \
1223-
&funcs); \
1221+
I2C_DEVICE_INSTANCE_FROM_DT_INST(n, i2c_dw_initialize, NULL, &i2c_##n##_runtime, \
1222+
&i2c_config_dw_##n, POST_KERNEL, &funcs); \
12241223
I2C_DW_IRQ_CONFIG(n)
12251224

12261225
DT_INST_FOREACH_STATUS_OKAY(I2C_DEVICE_INIT_DW)

drivers/i2c/i2c_emul.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ static const struct i2c_driver_api i2c_emul_api = {
335335
static struct i2c_emul_data i2c_emul_data_##n = { \
336336
.bitrate = DT_INST_PROP(n, clock_frequency), \
337337
}; \
338-
I2C_DEVICE_DT_INST_DEFINE(n, i2c_emul_init, NULL, &i2c_emul_data_##n, &i2c_emul_cfg_##n, \
339-
POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, &i2c_emul_api);
338+
I2C_DEVICE_INSTANCE_FROM_DT_INST(n, i2c_emul_init, NULL, &i2c_emul_data_##n, &i2c_emul_cfg_##n,\
339+
POST_KERNEL, &i2c_emul_api);
340340

341341
DT_INST_FOREACH_STATUS_OKAY(I2C_EMUL_INIT)

drivers/i2c/i2c_ene_kb1200.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,8 @@ static int i2c_kb1200_init(const struct device *dev)
352352
.fsmbm = (struct fsmbm_regs *)DT_INST_REG_ADDR(inst), \
353353
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \
354354
}; \
355-
I2C_DEVICE_DT_INST_DEFINE(inst, &i2c_kb1200_init, NULL, &i2c_kb1200_data_##inst, \
355+
I2C_DEVICE_INSTANCE_FROM_DT_INST(inst, &i2c_kb1200_init, NULL, &i2c_kb1200_data_##inst, \
356356
&i2c_kb1200_config_##inst, PRE_KERNEL_1, \
357-
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &i2c_kb1200_api);
357+
&i2c_kb1200_api);
358358

359359
DT_INST_FOREACH_STATUS_OKAY(I2C_KB1200_DEVICE)

0 commit comments

Comments
 (0)