diff --git a/CMakeLists.txt b/CMakeLists.txt index 59d91526bd14e..2a48d5b161366 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,6 +89,8 @@ set(DRIVER_VALIDATION_H_TARGET driver_validation_h_target) set(KOBJ_TYPES_H_TARGET kobj_types_h_target) set(PARSE_SYSCALLS_TARGET parse_syscalls_target) +include(${ZEPHYR_BASE}/cmake/modules/init_priorities.cmake) + define_property(GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT BRIEF_DOCS " " FULL_DOCS " ") set_property( GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT elf32-little${ARCH}) # BFD format @@ -976,6 +978,9 @@ else() set(NO_WHOLE_ARCHIVE_LIBS kernel) endif() +# Generating priorities +zephyr_generate_init_priorities() + get_property(OUTPUT_FORMAT GLOBAL PROPERTY PROPERTY_OUTPUT_FORMAT) if (CONFIG_CODE_DATA_RELOCATION) diff --git a/boards/beagle/beagleconnect_freedom/board_antenna.c b/boards/beagle/beagleconnect_freedom/board_antenna.c index 18407c06a78a1..31a305f810220 100644 --- a/boards/beagle/beagleconnect_freedom/board_antenna.c +++ b/boards/beagle/beagleconnect_freedom/board_antenna.c @@ -43,8 +43,8 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { }; PINCTRL_DT_INST_DEFINE(0); -DEVICE_DT_INST_DEFINE(0, board_antenna_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_BOARD_ANTENNA_INIT_PRIO, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, board_antenna_init, NULL, NULL, NULL, POST_KERNEL, + NULL); static const struct pinctrl_dev_config *ant_pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0); static const struct gpio_dt_spec ant_gpios[] = { diff --git a/boards/ti/common/board_antenna.c b/boards/ti/common/board_antenna.c index 5081ae7f89ef2..445a745caf22c 100644 --- a/boards/ti/common/board_antenna.c +++ b/boards/ti/common/board_antenna.c @@ -44,8 +44,8 @@ const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = { }; PINCTRL_DT_INST_DEFINE(0); -DEVICE_DT_INST_DEFINE(0, board_antenna_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_BOARD_ANTENNA_INIT_PRIO, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, board_antenna_init, NULL, NULL, NULL, POST_KERNEL, + NULL); static const struct pinctrl_dev_config *ant_pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0); static const struct gpio_dt_spec ant_gpios[] = { diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index b91566024ef65..b0f556c90ede8 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -5172,8 +5172,8 @@ endfunction() # This is useful content such as struct devices. # # For example: zephyr_linker_section_obj_level(SECTION init LEVEL PRE_KERNEL_1) -# will create an input section matching `.z_init_PRE_KERNEL_1?_` and -# `.z_init_PRE_KERNEL_1??_`. +# will create an input section matching `.z_init_PRE_KERNEL_1?_`, +# `.z_init_PRE_KERNEL_1??_` and `.z_init_PRE_KERNEL_1???_` # # SECTION
: Section in which the objects shall be placed # LEVEL : Priority level, all input sections matching the level @@ -5197,13 +5197,18 @@ function(zephyr_linker_section_obj_level) zephyr_linker_section_configure( SECTION ${OBJ_SECTION} - INPUT ".z_${OBJ_SECTION}_${OBJ_LEVEL}?_*" + INPUT ".z_${OBJ_SECTION}_${OBJ_LEVEL}_?_*" SYMBOLS __${OBJ_SECTION}_${OBJ_LEVEL}_start KEEP SORT NAME ) zephyr_linker_section_configure( SECTION ${OBJ_SECTION} - INPUT ".z_${OBJ_SECTION}_${OBJ_LEVEL}??_*" + INPUT ".z_${OBJ_SECTION}_${OBJ_LEVEL}_??_*" + KEEP SORT NAME + ) + zephyr_linker_section_configure( + SECTION ${OBJ_SECTION} + INPUT ".z_${OBJ_SECTION}_${OBJ_LEVEL}_???_*" KEEP SORT NAME ) endfunction() diff --git a/cmake/modules/init_priorities.cmake b/cmake/modules/init_priorities.cmake new file mode 100644 index 0000000000000..4126ac6aa55ee --- /dev/null +++ b/cmake/modules/init_priorities.cmake @@ -0,0 +1,110 @@ +# Copyright (c) 2024, Tomasz Bursztyka +# +# SPDX-License-Identifier: Apache-2.0 + +include_guard(GLOBAL) +include(boards) + +function(zephyr_add_service service_file) + set(service_full_path ${CMAKE_CURRENT_SOURCE_DIR}/${service_file}) + set_property(TARGET zephyr_interface APPEND PROPERTY ZEPHYR_SERVICE_FILES ${service_full_path}) +endfunction() + +function(zephyr_add_service_ifdef feature_toggle service_file) + if(${${feature_toggle}}) + zephyr_add_service(${service_file}) + endif() +endfunction() + +function(zephyr_add_device_init dev_init_file) + set(dev_init_full_path ${CMAKE_CURRENT_SOURCE_DIR}/${dev_init_file}) + set_property(TARGET zephyr_interface APPEND PROPERTY ZEPHYR_DEVICE_INIT_FILES ${dev_init_full_path}) +endfunction() + +function(zephyr_add_device_init_ifdef feature_toggle dev_init_file) + if(${${feature_toggle}}) + zephyr_add_device_init(${dev_init_file}) + endif() +endfunction() + +function(zephyr_generate_init_priorities) + if(NOT (ARGC EQUAL 0)) + messasge(FATAL_ERROR "zephyr_generate_init_priorities takes no arguments") + endif() + + # The directory containing gen_init_priorities.py script and files. + set(GIP_BASE ${ZEPHYR_BASE}/scripts/gen_init_priorities) + + # gen_init_priorities script that will generate a header about soft/hard + # init nodes priority and - whene relevant - levels too. + set(GIP_SCRIPT ${GIP_BASE}/gen_init_priorities.py) + + # The edtlib.EDT object in pickle format. + set(EDT_PICKLE ${PROJECT_BINARY_DIR}/edt.pickle) + + # The .config file generated by Kconfig + set(DOTCONFIG ${PROJECT_BINARY_DIR}/.config) + + # The generated C header needed by + set(GIP_INIT_H ${BINARY_DIR_INCLUDE_GENERATED}/zinit.h) + + set(init_files) + # Recovering services files, if any + get_property(service_files TARGET zephyr_interface PROPERTY ZEPHYR_SERVICE_FILES) + if (NOT (service_files EQUAL 0)) + list(APPEND init_files ${service_files}) + endif() + + # Recovering device init files, if any + get_property(dev_init_files TARGET zephyr_interface PROPERTY ZEPHYR_DEVICE_INIT_FILES) + if (NOT (dev_init_files EQUAL 0)) + list(APPEND init_files ${dev_init_files}) + endif() + + # Recovering application overlays + zephyr_build_string(board_string SHORT shortened_board_string + BOARD ${BOARD} BOARD_QUALIFIERS ${BOARD_QUALIFIERS} + ) + + set(gip_board_strings + ${board_string} + ${shortened_board_string} + ) + + foreach(str ${gip_board_strings}) + if (EXISTS ${APPLICATION_CONFIG_DIR}/boards/${str}_service_and_device_init.yaml) + list(APPEND init_files ${APPLICATION_CONFIG_DIR}/boards/${str}_service_and_device_init.yaml) + endif() + endforeach() + + if (EXISTS ${APPLICATION_CONFIG_DIR}/service_and_device_init.yaml) + list(APPEND init_files ${APPLICATION_CONFIG_DIR}/service_and_device_init.yaml) + endif() + + set(INIT_OPT) + list(LENGTH init_files found_init_files) + if (NOT (found_init_files EQUAL 0)) + message(STATUS "Found initialization object files: ${init_files}") + list(APPEND INIT_OPT --init-files ${init_files}) + endif() + + # + # Run GIP_SCRIPT + # + execute_process( + COMMAND ${PYTHON_EXECUTABLE} ${GIP_SCRIPT} + --dotconfig-file ${DOTCONFIG} + --edt-pickle ${EDT_PICKLE} + ${INIT_OPT} + --header-out ${GIP_INIT_H} + OUTPUT_QUIET # Discard stdout + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + RESULT_VARIABLE ret + ) + + if(NOT "${ret}" STREQUAL "0") + message(FATAL_ERROR "command failed with return code: ${ret}") + else() + message(STATUS "Generated initialization header file ${GIP_INIT_H}") + endif() +endfunction() diff --git a/drivers/adc/adc_ad559x.c b/drivers/adc/adc_ad559x.c index fdde4bb012403..79f79a7d92937 100644 --- a/drivers/adc/adc_ad559x.c +++ b/drivers/adc/adc_ad559x.c @@ -313,8 +313,7 @@ static int adc_ad559x_init(const struct device *dev) \ static struct adc_ad559x_data adc_ad559x_data##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, adc_ad559x_init, NULL, &adc_ad559x_data##inst, \ - &adc_ad559x_config##inst, POST_KERNEL, CONFIG_MFD_INIT_PRIORITY, \ - &adc_ad559x_api##inst); + DEVICE_INSTANCE_FROM_DT_INST(inst, adc_ad559x_init, NULL, &adc_ad559x_data##inst, \ + &adc_ad559x_config##inst, POST_KERNEL, &adc_ad559x_api##inst); DT_INST_FOREACH_STATUS_OKAY(ADC_AD559X_DEFINE) diff --git a/drivers/adc/adc_ads1112.c b/drivers/adc/adc_ads1112.c index ecf8ddf469d9a..b214f41e0df94 100644 --- a/drivers/adc/adc_ads1112.c +++ b/drivers/adc/adc_ads1112.c @@ -387,7 +387,7 @@ static const struct adc_driver_api api = { #define ADC_ADS1112_INST_DEFINE(n) \ static const struct ads1112_config config_##n = {.bus = I2C_DT_SPEC_INST_GET(n)}; \ static struct ads1112_data data_##n; \ - DEVICE_DT_INST_DEFINE(n, ads1112_init, NULL, &data_##n, &config_##n, POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, &api); + DEVICE_INSTANCE_FROM_DT_INST(n, ads1112_init, NULL, &data_##n, &config_##n, POST_KERNEL, \ + &api); DT_INST_FOREACH_STATUS_OKAY(ADC_ADS1112_INST_DEFINE); diff --git a/drivers/adc/adc_ads1119.c b/drivers/adc/adc_ads1119.c index 638b83fc2b2a9..8239d1e7a1902 100644 --- a/drivers/adc/adc_ads1119.c +++ b/drivers/adc/adc_ads1119.c @@ -499,9 +499,8 @@ static const struct adc_driver_api api = { IF_ENABLED(CONFIG_ADC_ASYNC, (.stack = thread_stack_##n)) \ }; \ static struct ads1119_data data_##n; \ - DEVICE_DT_INST_DEFINE(n, ads1119_init, \ - NULL, &data_##n, &config_##n, \ - POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, \ - &api); + DEVICE_INSTANCE_FROM_DT_INST(n, ads1119_init, \ + NULL, &data_##n, &config_##n, \ + POST_KERNEL, &api); DT_INST_FOREACH_STATUS_OKAY(ADC_ADS1119_INST_DEFINE); diff --git a/drivers/adc/adc_ads114s0x.c b/drivers/adc/adc_ads114s0x.c index 9864fd689f46d..599e46fce60a1 100644 --- a/drivers/adc/adc_ads114s0x.c +++ b/drivers/adc/adc_ads114s0x.c @@ -1502,7 +1502,7 @@ BUILD_ASSERT(CONFIG_ADC_INIT_PRIORITY > CONFIG_SPI_INIT_PRIORITY, .vbias_level = DT_INST_PROP(n, vbias_level), \ }; \ static struct ads114s0x_data data_##n; \ - DEVICE_DT_INST_DEFINE(n, ads114s0x_init, NULL, &data_##n, &config_##n, POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, &api); + DEVICE_INSTANCE_FROM_DT_INST(n, ads114s0x_init, NULL, &data_##n, &config_##n, POST_KERNEL, \ + &api); DT_INST_FOREACH_STATUS_OKAY(ADC_ADS114S0X_INST_DEFINE); diff --git a/drivers/adc/adc_ads1x1x.c b/drivers/adc/adc_ads1x1x.c index 0502eb0c8780a..cbc139b55a088 100644 --- a/drivers/adc/adc_ads1x1x.c +++ b/drivers/adc/adc_ads1x1x.c @@ -818,9 +818,8 @@ static const struct adc_driver_api ads1x1x_api = { ADC_CONTEXT_INIT_TIMER(ads##t##_data_##n, ctx), \ ADC_CONTEXT_INIT_SYNC(ads##t##_data_##n, ctx), \ }; \ - DEVICE_DT_DEFINE(DT_INST_ADS1X1X(n, t), ads1x1x_init, NULL, &ads##t##_data_##n, \ - &ads##t##_config_##n, POST_KERNEL, CONFIG_ADC_ADS1X1X_INIT_PRIORITY, \ - &ads1x1x_api); + DEVICE_INSTANCE(DT_INST_ADS1X1X(n, t), ads1x1x_init, NULL, &ads##t##_data_##n, \ + &ads##t##_config_##n, POST_KERNEL, &ads1x1x_api); /* The ADS111X provides 16 bits of data in binary two's complement format * A positive full-scale (+FS) input produces an output code of 7FFFh and a diff --git a/drivers/adc/adc_ads7052.c b/drivers/adc/adc_ads7052.c index c4ae2264e1e29..6879d314e1405 100644 --- a/drivers/adc/adc_ads7052.c +++ b/drivers/adc/adc_ads7052.c @@ -308,7 +308,7 @@ static const struct adc_driver_api ads7052_api = { ADC_CONTEXT_INIT_SYNC(ads7052_data_##n, ctx), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, adc_ads7052_init, NULL, &ads7052_data_##n, &ads7052_cfg_##n, \ - POST_KERNEL, CONFIG_ADC_ADS7052_INIT_PRIORITY, &ads7052_api); + DEVICE_INSTANCE_FROM_DT_INST(n, adc_ads7052_init, NULL, &ads7052_data_##n, &ads7052_cfg_##n,\ + POST_KERNEL, &ads7052_api); DT_INST_FOREACH_STATUS_OKAY(ADC_ADS7052_INIT) diff --git a/drivers/adc/adc_ambiq.c b/drivers/adc/adc_ambiq.c index ce8ee479d16d4..4aa1293b1773a 100644 --- a/drivers/adc/adc_ambiq.c +++ b/drivers/adc/adc_ambiq.c @@ -432,8 +432,7 @@ static int adc_ambiq_pm_action(const struct device *dev, enum pm_device_action a .pwr_func = pwr_on_ambiq_adc_##n, \ }; \ PM_DEVICE_DT_INST_DEFINE(n, adc_ambiq_pm_action); \ - DEVICE_DT_INST_DEFINE(n, &adc_ambiq_init, PM_DEVICE_DT_INST_GET(n), &adc_ambiq_data_##n, \ - &adc_ambiq_config_##n, POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, \ - &adc_ambiq_driver_api_##n); + DEVICE_INSTANCE_FROM_DT_INST(n, &adc_ambiq_init, PM_DEVICE_DT_INST_GET(n), &adc_ambiq_data_##n,\ + &adc_ambiq_config_##n, POST_KERNEL, &adc_ambiq_driver_api_##n); DT_INST_FOREACH_STATUS_OKAY(ADC_AMBIQ_INIT) diff --git a/drivers/adc/adc_b91.c b/drivers/adc/adc_b91.c index 30e76c88a764a..34fcca48c4341 100644 --- a/drivers/adc/adc_b91.c +++ b/drivers/adc/adc_b91.c @@ -461,8 +461,7 @@ static const struct adc_driver_api adc_b91_driver_api = { .ref_internal = cfg_0.vref_internal_mv, }; -DEVICE_DT_INST_DEFINE(0, adc_b91_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, adc_b91_init, NULL, &data_0, &cfg_0, POST_KERNEL, - CONFIG_ADC_INIT_PRIORITY, &adc_b91_driver_api); diff --git a/drivers/adc/adc_cc13xx_cc26xx.c b/drivers/adc/adc_cc13xx_cc26xx.c index b75aac176ad56..0c836265def16 100644 --- a/drivers/adc/adc_cc13xx_cc26xx.c +++ b/drivers/adc/adc_cc13xx_cc26xx.c @@ -294,11 +294,10 @@ static const struct adc_driver_api cc13xx_cc26xx_driver_api = { ADC_CONTEXT_INIT_LOCK(adc_cc13xx_cc26xx_data_##index, ctx), \ ADC_CONTEXT_INIT_SYNC(adc_cc13xx_cc26xx_data_##index, ctx), \ }; \ - DEVICE_DT_INST_DEFINE(index, \ + DEVICE_INSTANCE_FROM_DT_INST(index, \ &adc_cc13xx_cc26xx_init, NULL, \ &adc_cc13xx_cc26xx_data_##index, \ &adc_cc13xx_cc26xx_cfg_##index, POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &cc13xx_cc26xx_driver_api); \ \ static void adc_cc13xx_cc26xx_cfg_func_##index(void) \ diff --git a/drivers/adc/adc_cc32xx.c b/drivers/adc/adc_cc32xx.c index 3fff3b84e73fb..2b63147ee22bd 100644 --- a/drivers/adc/adc_cc32xx.c +++ b/drivers/adc/adc_cc32xx.c @@ -311,10 +311,9 @@ static const struct adc_driver_api cc32xx_driver_api = { ADC_CONTEXT_INIT_SYNC(adc_cc32xx_data_##index, ctx), \ }; \ \ - DEVICE_DT_INST_DEFINE(index, \ + DEVICE_INSTANCE_FROM_DT_INST(index, \ &adc_cc32xx_init, NULL, &adc_cc32xx_data_##index, \ &adc_cc32xx_cfg_##index, POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &cc32xx_driver_api); \ \ static void adc_cc32xx_cfg_func_##index(void) \ diff --git a/drivers/adc/adc_emul.c b/drivers/adc/adc_emul.c index 20b9764fd5fbb..4ce13eae4b501 100644 --- a/drivers/adc/adc_emul.c +++ b/drivers/adc/adc_emul.c @@ -574,10 +574,9 @@ static int adc_emul_init(const struct device *dev) .ref_int = DT_INST_PROP(_num, ref_internal_mv), \ }; \ \ - DEVICE_DT_INST_DEFINE(_num, adc_emul_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(_num, adc_emul_init, NULL, \ &adc_emul_data_##_num, \ &adc_emul_config_##_num, POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &adc_emul_api_##_num); DT_INST_FOREACH_STATUS_OKAY(ADC_EMUL_INIT) diff --git a/drivers/adc/adc_ene_kb1200.c b/drivers/adc/adc_ene_kb1200.c index 51b0eb93bbba2..bd4ae894b0a92 100644 --- a/drivers/adc/adc_ene_kb1200.c +++ b/drivers/adc/adc_ene_kb1200.c @@ -249,8 +249,8 @@ static int adc_kb1200_init(const struct device *dev) .adc = (struct adc_regs *)DT_INST_REG_ADDR(inst), \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ }; \ - DEVICE_DT_INST_DEFINE(inst, &adc_kb1200_init, NULL, &adc_kb1200_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &adc_kb1200_init, NULL, &adc_kb1200_data_##inst, \ &adc_kb1200_config_##inst, PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &adc_kb1200_api); + &adc_kb1200_api); DT_INST_FOREACH_STATUS_OKAY(ADC_KB1200_DEVICE) diff --git a/drivers/adc/adc_esp32.c b/drivers/adc/adc_esp32.c index 1740d96b0ccb0..38f973ffae83d 100644 --- a/drivers/adc/adc_esp32.c +++ b/drivers/adc/adc_esp32.c @@ -744,11 +744,10 @@ static const struct adc_driver_api api_esp32_driver_api = { static struct adc_esp32_data adc_esp32_data_##inst = { \ }; \ \ -DEVICE_DT_INST_DEFINE(inst, &adc_esp32_init, NULL, \ +DEVICE_INSTANCE_FROM_DT_INST(inst, &adc_esp32_init, NULL, \ &adc_esp32_data_##inst, \ &adc_esp32_conf_##inst, \ POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &api_esp32_driver_api); DT_INST_FOREACH_STATUS_OKAY(ESP32_ADC_INIT) diff --git a/drivers/adc/adc_gd32.c b/drivers/adc/adc_gd32.c index 46fbfc783b751..de41122802d32 100644 --- a/drivers/adc/adc_gd32.c +++ b/drivers/adc/adc_gd32.c @@ -498,10 +498,9 @@ static void adc_gd32_global_irq_cfg(void) .irq_config_func = adc_gd32_global_irq_cfg, \ ADC_CLOCK_SOURCE(n) \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &adc_gd32_init, NULL, \ &adc_gd32_data_##n, &adc_gd32_config_##n, \ - POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, \ - &adc_gd32_driver_api); \ + POST_KERNEL, &adc_gd32_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(ADC_GD32_INIT) diff --git a/drivers/adc/adc_gecko.c b/drivers/adc/adc_gecko.c index d8544cebd612b..5772791963e3d 100644 --- a/drivers/adc/adc_gecko.c +++ b/drivers/adc/adc_gecko.c @@ -306,10 +306,9 @@ static const struct adc_driver_api api_gecko_adc_driver_api = { adc_gecko_isr, DEVICE_DT_INST_GET(n), 0); \ irq_enable(DT_INST_IRQN(n)); \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &adc_gecko_init, NULL, \ - &adc_gecko_data_##n, &adc_gecko_config_##n,\ - POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, \ - &api_gecko_adc_driver_api); + &adc_gecko_data_##n, &adc_gecko_config_##n, \ + POST_KERNEL, &api_gecko_adc_driver_api); DT_INST_FOREACH_STATUS_OKAY(GECKO_ADC_INIT) diff --git a/drivers/adc/adc_ifx_cat1.c b/drivers/adc/adc_ifx_cat1.c index 095f860b8eb14..44b1ca6e1d313 100644 --- a/drivers/adc/adc_ifx_cat1.c +++ b/drivers/adc/adc_ifx_cat1.c @@ -287,10 +287,9 @@ static const struct adc_driver_api adc_cat1_driver_api = { .irq_priority = DT_INST_IRQ(n, priority), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, ifx_cat1_adc_init, \ - NULL, &ifx_cat1_adc_data##n, \ - &adc_cat1_cfg_##n, \ - POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, \ - &adc_cat1_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, ifx_cat1_adc_init, \ + NULL, &ifx_cat1_adc_data##n, \ + &adc_cat1_cfg_##n, \ + POST_KERNEL, &adc_cat1_driver_api); DT_INST_FOREACH_STATUS_OKAY(INFINEON_CAT1_ADC_INIT) diff --git a/drivers/adc/adc_ite_it8xxx2.c b/drivers/adc/adc_ite_it8xxx2.c index 53aec279fd2d0..2f9c34165b1c5 100644 --- a/drivers/adc/adc_ite_it8xxx2.c +++ b/drivers/adc/adc_ite_it8xxx2.c @@ -489,9 +489,8 @@ static const struct adc_it8xxx2_cfg adc_it8xxx2_cfg_0 = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0), }; -DEVICE_DT_INST_DEFINE(0, adc_it8xxx2_init, +DEVICE_INSTANCE_FROM_DT_INST(0, adc_it8xxx2_init, NULL, &adc_it8xxx2_data_0, &adc_it8xxx2_cfg_0, PRE_KERNEL_1, - CONFIG_ADC_INIT_PRIORITY, &api_it8xxx2_driver_api); diff --git a/drivers/adc/adc_lmp90xxx.c b/drivers/adc/adc_lmp90xxx.c index f71d6f4fa3879..5dc6ae6115f20 100644 --- a/drivers/adc/adc_lmp90xxx.c +++ b/drivers/adc/adc_lmp90xxx.c @@ -1072,12 +1072,11 @@ static const struct adc_driver_api lmp90xxx_adc_api = { .resolution = res, \ .channels = ch, \ }; \ - DEVICE_DT_DEFINE(DT_INST_LMP90XXX(n, t), \ - &lmp90xxx_init, NULL, \ - &lmp##t##_data_##n, \ - &lmp##t##_config_##n, POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ - &lmp90xxx_adc_api); + DEVICE_INSTANCE(DT_INST_LMP90XXX(n, t), \ + &lmp90xxx_init, NULL, \ + &lmp##t##_data_##n, \ + &lmp##t##_config_##n, POST_KERNEL, \ + &lmp90xxx_adc_api); /* * LMP90077: 16 bit, 2 diff/4 se (4 channels), 0 currents diff --git a/drivers/adc/adc_ltc2451.c b/drivers/adc/adc_ltc2451.c index 95b86f30d68a5..3a9137b8a6be8 100644 --- a/drivers/adc/adc_ltc2451.c +++ b/drivers/adc/adc_ltc2451.c @@ -98,8 +98,7 @@ static const struct adc_driver_api ltc2451_api = { .conversion_speed = DT_INST_PROP(index, conversion_speed), \ }; \ \ - DEVICE_DT_INST_DEFINE(index, <c2451_init, NULL, NULL, \ - <c2451_cfg_##index, POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, \ - <c2451_api); + DEVICE_INSTANCE_FROM_DT_INST(index, <c2451_init, NULL, NULL,\ + <c2451_cfg_##index, POST_KERNEL, <c2451_api); DT_INST_FOREACH_STATUS_OKAY(LTC2451_DEFINE) diff --git a/drivers/adc/adc_max11102_17.c b/drivers/adc/adc_max11102_17.c index 5443de0375357..10a5bbb5d4482 100644 --- a/drivers/adc/adc_max11102_17.c +++ b/drivers/adc/adc_max11102_17.c @@ -411,9 +411,8 @@ BUILD_ASSERT(CONFIG_ADC_INIT_PRIORITY > CONFIG_SPI_INIT_PRIORITY, .channel_count = channels, \ }; \ static struct max11102_17_data data_##name##_##index; \ - DEVICE_DT_INST_DEFINE(index, max11102_17_init, NULL, &data_##name##_##index, \ - &config_##name##_##index, POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, \ - &api); + DEVICE_INSTANCE_FROM_DT_INST(index, max11102_17_init, NULL, &data_##name##_##index, \ + &config_##name##_##index, POST_KERNEL, &api); #define DT_DRV_COMPAT maxim_max11102 #define ADC_MAX11102_RESOLUTION 12 diff --git a/drivers/adc/adc_max1125x.c b/drivers/adc/adc_max1125x.c index a70748d420ef1..2c4ecffdc480b 100644 --- a/drivers/adc/adc_max1125x.c +++ b/drivers/adc/adc_max1125x.c @@ -799,9 +799,8 @@ static const struct adc_driver_api max1125x_api = { ADC_CONTEXT_INIT_TIMER(max##t##_data_##n, ctx), \ ADC_CONTEXT_INIT_SYNC(max##t##_data_##n, ctx), \ }; \ - DEVICE_DT_DEFINE(DT_INST_MAX1125X(n, t), max1125x_init, NULL, &max##t##_data_##n, \ - &max##t##_cfg_##n, POST_KERNEL, CONFIG_ADC_MAX1125X_INIT_PRIORITY, \ - &max1125x_api); + DEVICE_INSTANCE(DT_INST_MAX1125X(n, t), max1125x_init, NULL, &max##t##_data_##n, \ + &max##t##_cfg_##n, POST_KERNEL, &max1125x_api); /* Each data register is a 16-bit read-only register. Any attempt to write * data to this location will have no effect. The data read from these diff --git a/drivers/adc/adc_max32.c b/drivers/adc/adc_max32.c index f09d8695a1204..cd06173d79a11 100644 --- a/drivers/adc/adc_max32.c +++ b/drivers/adc/adc_max32.c @@ -333,8 +333,7 @@ static const struct adc_driver_api adc_max32_driver_api = { ADC_CONTEXT_INIT_SYNC(max32_adc_data_##_num, ctx), \ .resolution = DT_INST_PROP(_num, resolution), \ }; \ - DEVICE_DT_INST_DEFINE(_num, &adc_max32_init, NULL, &max32_adc_data_##_num, \ - &max32_adc_config_##_num, POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, \ - &adc_max32_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(_num, &adc_max32_init, NULL, &max32_adc_data_##_num, \ + &max32_adc_config_##_num, POST_KERNEL, &adc_max32_driver_api); DT_INST_FOREACH_STATUS_OKAY(MAX32_ADC_INIT) diff --git a/drivers/adc/adc_mchp_xec.c b/drivers/adc/adc_mchp_xec.c index 948b8e894a9b4..6c8bd94f8dc98 100644 --- a/drivers/adc/adc_mchp_xec.c +++ b/drivers/adc/adc_mchp_xec.c @@ -470,7 +470,6 @@ static struct adc_xec_data adc_xec_dev_data_0 = { PM_DEVICE_DT_INST_DEFINE(0, adc_xec_pm_action); -DEVICE_DT_INST_DEFINE(0, adc_xec_init, PM_DEVICE_DT_INST_GET(0), +DEVICE_INSTANCE_FROM_DT_INST(0, adc_xec_init, PM_DEVICE_DT_INST_GET(0), &adc_xec_dev_data_0, &adc_xec_dev_cfg_0, - PRE_KERNEL_1, CONFIG_ADC_INIT_PRIORITY, - &adc_xec_api); + PRE_KERNEL_1, &adc_xec_api); diff --git a/drivers/adc/adc_mcp320x.c b/drivers/adc/adc_mcp320x.c index 7fc0e421fd8fd..de351df3c3be8 100644 --- a/drivers/adc/adc_mcp320x.c +++ b/drivers/adc/adc_mcp320x.c @@ -319,12 +319,11 @@ static const struct adc_driver_api mcp320x_adc_api = { SPI_WORD_SET(8), 0), \ .channels = ch, \ }; \ - DEVICE_DT_DEFINE(INST_DT_MCP320X(n, t), \ - &mcp320x_init, NULL, \ - &mcp##t##_data_##n, \ - &mcp##t##_config_##n, POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ - &mcp320x_adc_api) + DEVICE_INSTANCE(INST_DT_MCP320X(n, t), \ + &mcp320x_init, NULL, \ + &mcp##t##_data_##n, \ + &mcp##t##_config_##n, POST_KERNEL, \ + &mcp320x_adc_api) /* * MCP3204: 4 channels diff --git a/drivers/adc/adc_mcux_12b1msps_sar.c b/drivers/adc/adc_mcux_12b1msps_sar.c index 059ec7c3cd956..351700e11cbc7 100644 --- a/drivers/adc/adc_mcux_12b1msps_sar.c +++ b/drivers/adc/adc_mcux_12b1msps_sar.c @@ -303,10 +303,9 @@ static const struct adc_driver_api mcux_12b1msps_sar_adc_driver_api = { ADC_CONTEXT_INIT_SYNC(mcux_12b1msps_sar_adc_data_##n, ctx), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &mcux_12b1msps_sar_adc_init, NULL, \ - &mcux_12b1msps_sar_adc_data_##n, &mcux_12b1msps_sar_adc_config_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &mcux_12b1msps_sar_adc_driver_api); \ + DEVICE_INSTANCE_FROM_DT_INST(n, &mcux_12b1msps_sar_adc_init, NULL,\ + &mcux_12b1msps_sar_adc_data_##n, &mcux_12b1msps_sar_adc_config_##n,\ + POST_KERNEL, &mcux_12b1msps_sar_adc_driver_api); \ \ static void mcux_12b1msps_sar_adc_config_func_##n(const struct device *dev) \ { \ diff --git a/drivers/adc/adc_mcux_adc12.c b/drivers/adc/adc_mcux_adc12.c index a8b176dd58e7e..5a00014069f2c 100644 --- a/drivers/adc/adc_mcux_adc12.c +++ b/drivers/adc/adc_mcux_adc12.c @@ -305,10 +305,9 @@ static int mcux_adc12_init(const struct device *dev) ADC_CONTEXT_INIT_SYNC(mcux_adc12_data_##n, ctx), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &mcux_adc12_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &mcux_adc12_init, \ NULL, &mcux_adc12_data_##n, \ &mcux_adc12_config_##n, POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &mcux_adc12_driver_api_##n); \ \ static void mcux_adc12_config_func_##n(const struct device *dev) \ diff --git a/drivers/adc/adc_mcux_adc16.c b/drivers/adc/adc_mcux_adc16.c index 49e89de58ce90..cafccf3895d84 100644 --- a/drivers/adc/adc_mcux_adc16.c +++ b/drivers/adc/adc_mcux_adc16.c @@ -494,12 +494,11 @@ static const struct adc_driver_api mcux_adc16_driver_api = { ADC16_MCUX_EDMA_DATA(n) \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &mcux_adc16_init, \ - NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &mcux_adc16_init,\ + NULL, \ &mcux_adc16_data_##n, \ &mcux_adc16_config_##n, \ POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &mcux_adc16_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(ACD16_MCUX_INIT) diff --git a/drivers/adc/adc_mcux_gau_adc.c b/drivers/adc/adc_mcux_gau_adc.c index 137c33feeaf47..9272809ca6163 100644 --- a/drivers/adc/adc_mcux_gau_adc.c +++ b/drivers/adc/adc_mcux_gau_adc.c @@ -377,10 +377,9 @@ static const struct adc_driver_api mcux_gau_adc_driver_api = { \ static struct mcux_gau_adc_data mcux_gau_adc_data_##n = {0}; \ \ - DEVICE_DT_INST_DEFINE(n, &mcux_gau_adc_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &mcux_gau_adc_init, NULL, \ &mcux_gau_adc_data_##n, &mcux_gau_adc_config_##n, \ - POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, \ - &mcux_gau_adc_driver_api); \ + POST_KERNEL, &mcux_gau_adc_driver_api); \ \ static void mcux_gau_adc_config_func_##n(const struct device *dev) \ { \ diff --git a/drivers/adc/adc_mcux_lpadc.c b/drivers/adc/adc_mcux_lpadc.c index 8300935c21fb7..3c8959d6ad917 100644 --- a/drivers/adc/adc_mcux_lpadc.c +++ b/drivers/adc/adc_mcux_lpadc.c @@ -581,11 +581,10 @@ static const struct adc_driver_api mcux_lpadc_driver_api = { ADC_CONTEXT_INIT_SYNC(mcux_lpadc_data_##n, ctx), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &mcux_lpadc_init, NULL, &mcux_lpadc_data_##n, \ &mcux_lpadc_config_##n, POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ - &mcux_lpadc_driver_api); \ + &mcux_lpadc_driver_api); \ \ static void mcux_lpadc_config_func_##n(const struct device *dev) \ { \ diff --git a/drivers/adc/adc_npcx.c b/drivers/adc/adc_npcx.c index ae1cf65ffbb2d..f3362e60d0beb 100644 --- a/drivers/adc/adc_npcx.c +++ b/drivers/adc/adc_npcx.c @@ -866,10 +866,9 @@ static int adc_npcx_init(const struct device *dev) ADC_CONTEXT_INIT_SYNC(adc_npcx_data_##n, ctx), \ .threshold_data = &threshold_data_##n, \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ adc_npcx_init, NULL, \ &adc_npcx_data_##n, &adc_npcx_cfg_##n, \ - PRE_KERNEL_1, CONFIG_ADC_INIT_PRIORITY, \ - &adc_npcx_driver_api_##n); + PRE_KERNEL_1, &adc_npcx_driver_api_##n); DT_INST_FOREACH_STATUS_OKAY(NPCX_ADC_INIT) diff --git a/drivers/adc/adc_nrfx_adc.c b/drivers/adc/adc_nrfx_adc.c index ec96e244bcdea..a56a0730bfa31 100644 --- a/drivers/adc/adc_nrfx_adc.c +++ b/drivers/adc/adc_nrfx_adc.c @@ -302,10 +302,9 @@ static const struct adc_driver_api adc_nrfx_driver_api = { #define ADC_INIT(inst) \ BUILD_ASSERT((inst) == 0, \ "multiple instances not supported"); \ - DEVICE_DT_INST_DEFINE(0, \ + DEVICE_INSTANCE_FROM_DT_INST(0, \ init_adc, NULL, NULL, NULL, \ POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &adc_nrfx_driver_api); DT_INST_FOREACH_STATUS_OKAY(ADC_INIT) diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index c5b68f564a825..24d267f208d15 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -688,13 +688,12 @@ static const struct adc_driver_api adc_nrfx_driver_api = { #define SAADC_INIT(inst) \ BUILD_ASSERT((inst) == 0, \ "multiple instances not supported"); \ - DEVICE_DT_INST_DEFINE(0, \ + DEVICE_INSTANCE_FROM_DT_INST(0, \ init_saadc, \ NULL, \ NULL, \ NULL, \ POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &adc_nrfx_driver_api); DT_INST_FOREACH_STATUS_OKAY(SAADC_INIT) diff --git a/drivers/adc/adc_numaker.c b/drivers/adc/adc_numaker.c index 42d3b7ad5ddbf..c9f940d7c6d4d 100644 --- a/drivers/adc/adc_numaker.c +++ b/drivers/adc/adc_numaker.c @@ -396,10 +396,9 @@ static int adc_numaker_init(const struct device *dev) ADC_CONTEXT_INIT_LOCK(adc_numaker_data_##inst, ctx), \ ADC_CONTEXT_INIT_SYNC(adc_numaker_data_##inst, ctx), \ }; \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &adc_numaker_init, NULL, \ &adc_numaker_data_##inst, &adc_numaker_cfg_##inst, \ - POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, \ - &adc_numaker_driver_api); + POST_KERNEL, &adc_numaker_driver_api); DT_INST_FOREACH_STATUS_OKAY(ADC_NUMAKER_INIT) diff --git a/drivers/adc/adc_nxp_s32_adc_sar.c b/drivers/adc/adc_nxp_s32_adc_sar.c index e4c9f269b7274..10376903246c0 100644 --- a/drivers/adc/adc_nxp_s32_adc_sar.c +++ b/drivers/adc/adc_nxp_s32_adc_sar.c @@ -446,13 +446,12 @@ static void adc_nxp_s32_isr(const struct device *dev) .pin_cfg = COND_CODE_1(DT_INST_NUM_PINCTRL_STATES(n), \ (PINCTRL_DT_INST_DEV_CONFIG_GET(n)), (NULL)), \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &adc_nxp_s32_init, \ NULL, \ &adc_nxp_s32_data_##n, \ &adc_nxp_s32_config_##n, \ POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &adc_nxp_s32_driver_api_##n); DT_INST_FOREACH_STATUS_OKAY(ADC_NXP_S32_INIT_DEVICE) diff --git a/drivers/adc/adc_renesas_ra.c b/drivers/adc/adc_renesas_ra.c index d1054f9721c96..da4f209c59586 100644 --- a/drivers/adc/adc_renesas_ra.c +++ b/drivers/adc/adc_renesas_ra.c @@ -384,7 +384,7 @@ const adc_extended_cfg_t g_adc_cfg_extend = { }, \ }; \ \ - DEVICE_DT_INST_DEFINE(idx, adc_ra_init, NULL, &adc_ra_data_##idx, &adc_ra_config_##idx, \ - POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, &adc_ra_api_##idx) + DEVICE_INSTANCE_FROM_DT_INST(idx, adc_ra_init, NULL, &adc_ra_data_##idx, &adc_ra_config_##idx,\ + POST_KERNEL, &adc_ra_api_##idx) DT_INST_FOREACH_STATUS_OKAY(ADC_RA_INIT); diff --git a/drivers/adc/adc_rpi_pico.c b/drivers/adc/adc_rpi_pico.c index 3f63924a9d580..d9a3658d4ec02 100644 --- a/drivers/adc/adc_rpi_pico.c +++ b/drivers/adc/adc_rpi_pico.c @@ -375,10 +375,9 @@ static int adc_rpi_init(const struct device *dev) .dev = DEVICE_DT_INST_GET(idx), \ }; \ \ - DEVICE_DT_INST_DEFINE(idx, adc_rpi_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, adc_rpi_init, NULL, \ &adc_rpi_data_##idx, \ &adc_rpi_config_##idx, POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &adc_rpi_api_##idx) DT_INST_FOREACH_STATUS_OKAY(ADC_RPI_INIT); diff --git a/drivers/adc/adc_sam.c b/drivers/adc/adc_sam.c index 3536a88af4d57..7e65fa3f28b12 100644 --- a/drivers/adc/adc_sam.c +++ b/drivers/adc/adc_sam.c @@ -410,10 +410,9 @@ static const struct adc_driver_api adc_sam_api = { ADC_CONTEXT_INIT_SYNC(adc_sam_data_##n, ctx), \ .dev = DEVICE_DT_INST_GET(n), \ }; \ - DEVICE_DT_INST_DEFINE(n, adc_sam_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, adc_sam_init, NULL, \ &adc_sam_data_##n, \ &adc_sam_config_##n, POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &adc_sam_api); DT_INST_FOREACH_STATUS_OKAY(ADC_SAM_DEVICE) diff --git a/drivers/adc/adc_sam0.c b/drivers/adc/adc_sam0.c index b7b1f59aa8ed7..caace93c7fea6 100644 --- a/drivers/adc/adc_sam0.c +++ b/drivers/adc/adc_sam0.c @@ -577,10 +577,9 @@ do { \ ADC_CONTEXT_INIT_LOCK(adc_sam_data_##n, ctx), \ ADC_CONTEXT_INIT_SYNC(adc_sam_data_##n, ctx), \ }; \ - DEVICE_DT_INST_DEFINE(n, adc_sam0_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, adc_sam0_init, NULL, \ &adc_sam_data_##n, \ &adc_sam_cfg_##n, POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &adc_sam0_api); \ static void adc_sam0_config_##n(const struct device *dev) \ { \ diff --git a/drivers/adc/adc_sam_afec.c b/drivers/adc/adc_sam_afec.c index 8096ca9236eb9..d518bfa1ea48d 100644 --- a/drivers/adc/adc_sam_afec.c +++ b/drivers/adc/adc_sam_afec.c @@ -380,10 +380,9 @@ static void adc_sam_isr(const struct device *dev) ADC_CONTEXT_INIT_SYNC(adc##n##_sam_data, ctx), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, adc_sam_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, adc_sam_init, NULL, \ &adc##n##_sam_data, \ &adc##n##_sam_cfg, POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &adc_sam_api); \ \ static void adc##n##_sam_cfg_func(const struct device *dev) \ diff --git a/drivers/adc/adc_smartbond_gpadc.c b/drivers/adc/adc_smartbond_gpadc.c index 76bdaede5108e..35a88149a3035 100644 --- a/drivers/adc/adc_smartbond_gpadc.c +++ b/drivers/adc/adc_smartbond_gpadc.c @@ -420,13 +420,12 @@ static const struct adc_driver_api adc_smartbond_driver_api = { ADC_CONTEXT_INIT_SYNC(adc_smartbond_data_##inst, ctx), \ }; \ PM_DEVICE_DT_INST_DEFINE(inst, gpadc_smartbond_pm_action); \ - DEVICE_DT_INST_DEFINE(inst, \ - adc_smartbond_init, \ - PM_DEVICE_DT_INST_GET(inst), \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ + adc_smartbond_init, \ + PM_DEVICE_DT_INST_GET(inst), \ &adc_smartbond_data_##inst, \ &adc_smartbond_cfg_##inst, \ POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &adc_smartbond_driver_api); DT_INST_FOREACH_STATUS_OKAY(ADC_INIT) diff --git a/drivers/adc/adc_smartbond_sdadc.c b/drivers/adc/adc_smartbond_sdadc.c index de7b71888299d..2b6647f42795c 100644 --- a/drivers/adc/adc_smartbond_sdadc.c +++ b/drivers/adc/adc_smartbond_sdadc.c @@ -425,13 +425,12 @@ static const struct adc_driver_api sdadc_smartbond_driver_api = { ADC_CONTEXT_INIT_SYNC(sdadc_smartbond_data_##inst, ctx), \ }; \ PM_DEVICE_DT_INST_DEFINE(inst, sdadc_smartbond_pm_action); \ - DEVICE_DT_INST_DEFINE(inst, \ - sdadc_smartbond_init, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ + sdadc_smartbond_init, \ PM_DEVICE_DT_INST_GET(inst), \ &sdadc_smartbond_data_##inst, \ &sdadc_smartbond_cfg_##inst, \ POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &sdadc_smartbond_driver_api); DT_INST_FOREACH_STATUS_OKAY(SDADC_INIT) diff --git a/drivers/adc/adc_stm32.c b/drivers/adc/adc_stm32.c index 81e44ccab2fec..cef7a955974fc 100644 --- a/drivers/adc/adc_stm32.c +++ b/drivers/adc/adc_stm32.c @@ -1938,10 +1938,9 @@ static struct adc_stm32_data adc_stm32_data_##index = { \ \ PM_DEVICE_DT_INST_DEFINE(index, adc_stm32_pm_action); \ \ -DEVICE_DT_INST_DEFINE(index, \ +DEVICE_INSTANCE_FROM_DT_INST(index, \ &adc_stm32_init, PM_DEVICE_DT_INST_GET(index), \ &adc_stm32_data_##index, &adc_stm32_cfg_##index, \ - POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, \ - &api_stm32_driver_api); + POST_KERNEL, &api_stm32_driver_api); DT_INST_FOREACH_STATUS_OKAY(ADC_STM32_INIT) diff --git a/drivers/adc/adc_stm32wb0.c b/drivers/adc/adc_stm32wb0.c index e36cee7631c28..ed22deb2bb93f 100644 --- a/drivers/adc/adc_stm32wb0.c +++ b/drivers/adc/adc_stm32wb0.c @@ -1246,6 +1246,5 @@ static struct adc_stm32wb0_data adc_data = { PM_DEVICE_DT_DEFINE(ADC_NODE, adc_stm32wb0_pm_action); -DEVICE_DT_DEFINE(ADC_NODE, &adc_stm32wb0_init, PM_DEVICE_DT_GET(ADC_NODE), - &adc_data, &adc_config, POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, - &api_stm32wb0_driver_api); +DEVICE_INSTANCE(ADC_NODE, &adc_stm32wb0_init, PM_DEVICE_DT_GET(ADC_NODE), + &adc_data, &adc_config, POST_KERNEL, &api_stm32wb0_driver_api); diff --git a/drivers/adc/adc_test.c b/drivers/adc/adc_test.c index 09f30ddace9bc..6c3abcb3b95bd 100644 --- a/drivers/adc/adc_test.c +++ b/drivers/adc/adc_test.c @@ -46,9 +46,8 @@ static const struct adc_driver_api vnd_adc_api = { }; #define VND_ADC_INIT(n) \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, NULL, NULL, \ POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &vnd_adc_api); DT_INST_FOREACH_STATUS_OKAY(VND_ADC_INIT) diff --git a/drivers/adc/adc_tla2021.c b/drivers/adc/adc_tla2021.c index 7c08a8292b058..ec738900a4daf 100644 --- a/drivers/adc/adc_tla2021.c +++ b/drivers/adc/adc_tla2021.c @@ -324,8 +324,8 @@ static const struct adc_driver_api tla2021_driver_api = { IF_ENABLED(CONFIG_ADC_ASYNC, \ (.acq_lock = Z_SEM_INITIALIZER(inst_##n##_data.acq_lock, 0, 1),)) \ }; \ - DEVICE_DT_INST_DEFINE(n, &tla2021_init, NULL, &inst_##n##_data, &inst_##n##_config, \ - POST_KERNEL, CONFIG_ADC_TLA2021_INIT_PRIORITY, &tla2021_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &tla2021_init, NULL, &inst_##n##_data, &inst_##n##_config, \ + POST_KERNEL, &tla2021_driver_api); DT_INST_FOREACH_STATUS_OKAY(TLA2021_INIT) diff --git a/drivers/adc/adc_vf610.c b/drivers/adc/adc_vf610.c index 1fa8b090af9a4..b9663cfdabd0f 100644 --- a/drivers/adc/adc_vf610.c +++ b/drivers/adc/adc_vf610.c @@ -257,10 +257,9 @@ static const struct adc_driver_api vf610_adc_driver_api = { ADC_CONTEXT_INIT_SYNC(vf610_adc_data_##n, ctx), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &vf610_adc_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &vf610_adc_init, \ NULL, &vf610_adc_data_##n, \ &vf610_adc_config_##n, POST_KERNEL, \ - CONFIG_ADC_INIT_PRIORITY, \ &vf610_adc_driver_api); \ \ static void vf610_adc_config_func_##n(const struct device *dev) \ diff --git a/drivers/adc/adc_xmc4xxx.c b/drivers/adc/adc_xmc4xxx.c index b5b935b53d060..5ffd241a8079c 100644 --- a/drivers/adc/adc_xmc4xxx.c +++ b/drivers/adc/adc_xmc4xxx.c @@ -333,10 +333,9 @@ static struct adc_xmc4xxx_data adc_xmc4xxx_data_##index = { \ ADC_CONTEXT_INIT_SYNC(adc_xmc4xxx_data_##index, ctx), \ }; \ \ -DEVICE_DT_INST_DEFINE(index, \ +DEVICE_INSTANCE_FROM_DT_INST(index, \ &adc_xmc4xxx_init, NULL, \ &adc_xmc4xxx_data_##index, &adc_xmc4xxx_cfg_##index, \ - POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, \ - &api_xmc4xxx_driver_api); + POST_KERNEL, &api_xmc4xxx_driver_api); DT_INST_FOREACH_STATUS_OKAY(ADC_XMC4XXX_INIT) diff --git a/drivers/adc/iadc_gecko.c b/drivers/adc/iadc_gecko.c index d9dc542a5bf94..06f6515fbf1fc 100644 --- a/drivers/adc/iadc_gecko.c +++ b/drivers/adc/iadc_gecko.c @@ -482,10 +482,9 @@ static const struct adc_driver_api api_gecko_adc_driver_api = { adc_gecko_isr, DEVICE_DT_INST_GET(n), 0); \ irq_enable(DT_INST_IRQN(n)); \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &adc_gecko_init, NULL, \ - &adc_gecko_data_##n, &adc_gecko_config_##n,\ - POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, \ - &api_gecko_adc_driver_api); + &adc_gecko_data_##n, &adc_gecko_config_##n, \ + POST_KERNEL, &api_gecko_adc_driver_api); DT_INST_FOREACH_STATUS_OKAY(GECKO_IADC_INIT) diff --git a/drivers/audio/dmic_mcux.c b/drivers/audio/dmic_mcux.c index 0f032e8368cc0..3bd6d6a8828f6 100644 --- a/drivers/audio/dmic_mcux.c +++ b/drivers/audio/dmic_mcux.c @@ -718,10 +718,9 @@ static const struct _dmic_ops dmic_ops = { .use2fs = DT_INST_PROP(idx, use2fs), \ }; \ \ - DEVICE_DT_INST_DEFINE(idx, mcux_dmic_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, mcux_dmic_init, NULL, \ &mcux_dmic_data##idx, &mcux_dmic_cfg##idx, \ - POST_KERNEL, CONFIG_AUDIO_DMIC_INIT_PRIORITY, \ - &dmic_ops); + POST_KERNEL, &dmic_ops); /* Existing SoCs only have one PDM instance. */ DT_INST_FOREACH_STATUS_OKAY(MCUX_DMIC_DEVICE) diff --git a/drivers/audio/dmic_nrfx_pdm.c b/drivers/audio/dmic_nrfx_pdm.c index 4ffd00f49099e..cfc61f3586952 100644 --- a/drivers/audio/dmic_nrfx_pdm.c +++ b/drivers/audio/dmic_nrfx_pdm.c @@ -632,10 +632,9 @@ static const struct _dmic_ops dmic_ops = { hfclkaudio_frequency), \ "Clock source ACLK requires the hfclkaudio-frequency " \ "property to be defined in the nordic,nrf-clock node."); \ - DEVICE_DT_DEFINE(PDM(idx), pdm_nrfx_init##idx, NULL, \ - &dmic_nrfx_pdm_data##idx, &dmic_nrfx_pdm_cfg##idx, \ - POST_KERNEL, CONFIG_AUDIO_DMIC_INIT_PRIORITY, \ - &dmic_ops); + DEVICE_INSTANCE(PDM(idx), pdm_nrfx_init##idx, NULL, \ + &dmic_nrfx_pdm_data##idx, &dmic_nrfx_pdm_cfg##idx, \ + POST_KERNEL, &dmic_ops); #ifdef CONFIG_HAS_HW_NRF_PDM0 PDM_NRFX_DEVICE(0); diff --git a/drivers/audio/mpxxdtyy.c b/drivers/audio/mpxxdtyy.c index 784dddb458159..0181ab2a686ac 100644 --- a/drivers/audio/mpxxdtyy.c +++ b/drivers/audio/mpxxdtyy.c @@ -180,6 +180,6 @@ static const struct mpxxdtyy_config mpxxdtyy_config = { static struct mpxxdtyy_data mpxxdtyy_data; -DEVICE_DT_INST_DEFINE(0, mpxxdtyy_initialize, NULL, &mpxxdtyy_data, +DEVICE_INSTANCE_FROM_DT_INST(0, mpxxdtyy_initialize, NULL, &mpxxdtyy_data, &mpxxdtyy_config, POST_KERNEL, - CONFIG_AUDIO_DMIC_INIT_PRIORITY, &mpxxdtyy_driver_api); + &mpxxdtyy_driver_api); diff --git a/drivers/audio/tas6422dac.c b/drivers/audio/tas6422dac.c index cb1efb597edf9..88a76d6d20b13 100644 --- a/drivers/audio/tas6422dac.c +++ b/drivers/audio/tas6422dac.c @@ -374,8 +374,8 @@ static const struct audio_codec_api codec_driver_api = { static struct codec_driver_config codec_device_config_##n = { \ .bus = I2C_DT_SPEC_INST_GET(n), TAS6422DAC_MUTE_GPIO_INIT(n)}; \ \ - DEVICE_DT_INST_DEFINE(n, codec_initialize, NULL, &codec_device_data_##n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, codec_initialize, NULL, &codec_device_data_##n, \ &codec_device_config_##n, POST_KERNEL, \ - CONFIG_AUDIO_CODEC_INIT_PRIORITY, &codec_driver_api); + &codec_driver_api); DT_INST_FOREACH_STATUS_OKAY(TAS6422DAC_INIT) diff --git a/drivers/audio/tlv320dac310x.c b/drivers/audio/tlv320dac310x.c index 7821f5b54b5a7..cdf54179c0b35 100644 --- a/drivers/audio/tlv320dac310x.c +++ b/drivers/audio/tlv320dac310x.c @@ -517,6 +517,6 @@ static const struct audio_codec_api codec_driver_api = { .apply_properties = codec_apply_properties, }; -DEVICE_DT_INST_DEFINE(0, codec_initialize, NULL, &codec_device_data, +DEVICE_INSTANCE_FROM_DT_INST(0, codec_initialize, NULL, &codec_device_data, &codec_device_config, POST_KERNEL, - CONFIG_AUDIO_CODEC_INIT_PRIORITY, &codec_driver_api); + &codec_driver_api); diff --git a/drivers/audio/wm8904.c b/drivers/audio/wm8904.c index 8cfe9db900aa7..08a5dc8efc2fe 100644 --- a/drivers/audio/wm8904.c +++ b/drivers/audio/wm8904.c @@ -675,7 +675,7 @@ static const struct audio_codec_api wm8904_driver_api = { .mclk_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR_BY_NAME(n, mclk)), \ .mclk_name = (clock_control_subsys_t)DT_INST_CLOCKS_CELL_BY_NAME(n, mclk, name)}; \ \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, &wm8904_device_config_##n, \ - POST_KERNEL, CONFIG_AUDIO_CODEC_INIT_PRIORITY, &wm8904_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, NULL, &wm8904_device_config_##n, \ + POST_KERNEL, &wm8904_driver_api); DT_INST_FOREACH_STATUS_OKAY(WM8904_INIT) diff --git a/drivers/auxdisplay/auxdisplay_hd44780.c b/drivers/auxdisplay/auxdisplay_hd44780.c index 1d0441a31d932..3a0efd1248146 100644 --- a/drivers/auxdisplay/auxdisplay_hd44780.c +++ b/drivers/auxdisplay/auxdisplay_hd44780.c @@ -582,13 +582,12 @@ static const struct auxdisplay_driver_api auxdisplay_hd44780_auxdisplay_api = { .clear_delay = DT_INST_PROP(inst, clear_command_delay_us), \ .boot_delay = DT_INST_PROP(inst, boot_delay_ms), \ }; \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &auxdisplay_hd44780_init, \ NULL, \ &auxdisplay_hd44780_data_##inst, \ &auxdisplay_hd44780_config_##inst, \ POST_KERNEL, \ - CONFIG_AUXDISPLAY_INIT_PRIORITY, \ &auxdisplay_hd44780_auxdisplay_api); DT_INST_FOREACH_STATUS_OKAY(AUXDISPLAY_HD44780_DEVICE) diff --git a/drivers/auxdisplay/auxdisplay_itron.c b/drivers/auxdisplay/auxdisplay_itron.c index b5aa5d89f673f..050606b002fb3 100644 --- a/drivers/auxdisplay/auxdisplay_itron.c +++ b/drivers/auxdisplay/auxdisplay_itron.c @@ -435,13 +435,12 @@ static const struct auxdisplay_driver_api auxdisplay_itron_auxdisplay_api = { .busy_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, busy_gpios, {0}), \ .reset_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, reset_gpios, {0}), \ }; \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &auxdisplay_itron_init, \ NULL, \ &auxdisplay_itron_data_##inst, \ &auxdisplay_itron_config_##inst, \ POST_KERNEL, \ - CONFIG_AUXDISPLAY_INIT_PRIORITY, \ &auxdisplay_itron_auxdisplay_api); DT_INST_FOREACH_STATUS_OKAY(AUXDISPLAY_ITRON_DEVICE) diff --git a/drivers/auxdisplay/auxdisplay_jhd1313.c b/drivers/auxdisplay/auxdisplay_jhd1313.c index 9b4ef08e88b91..7c01edde5d884 100644 --- a/drivers/auxdisplay/auxdisplay_jhd1313.c +++ b/drivers/auxdisplay/auxdisplay_jhd1313.c @@ -367,13 +367,12 @@ static const struct auxdisplay_driver_api auxdisplay_jhd1313_auxdisplay_api = { .cursor = false, \ .blinking = false, \ }; \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &auxdisplay_jhd1313_initialize, \ NULL, \ &auxdisplay_jhd1313_data_##inst, \ &auxdisplay_jhd1313_config_##inst, \ POST_KERNEL, \ - CONFIG_AUXDISPLAY_INIT_PRIORITY, \ &auxdisplay_jhd1313_auxdisplay_api); DT_INST_FOREACH_STATUS_OKAY(AUXDISPLAY_JHD1313_DEVICE) diff --git a/drivers/auxdisplay/auxdisplay_pt6314.c b/drivers/auxdisplay/auxdisplay_pt6314.c index e204783f8f762..04c5b39357185 100644 --- a/drivers/auxdisplay/auxdisplay_pt6314.c +++ b/drivers/auxdisplay/auxdisplay_pt6314.c @@ -326,8 +326,8 @@ static const struct auxdisplay_driver_api auxdisplay_pt6314_auxdisplay_api = { .cursor_y = 0, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &auxdisplay_pt6314_init, NULL, &auxdisplay_pt6314_data_##n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &auxdisplay_pt6314_init, NULL, &auxdisplay_pt6314_data_##n,\ &auxdisplay_pt6314_config_##n, POST_KERNEL, \ - CONFIG_AUXDISPLAY_INIT_PRIORITY, &auxdisplay_pt6314_auxdisplay_api); + &auxdisplay_pt6314_auxdisplay_api); DT_INST_FOREACH_STATUS_OKAY(AUXDISPLAY_PT6314_INST) diff --git a/drivers/auxdisplay/auxdisplay_serlcd.c b/drivers/auxdisplay/auxdisplay_serlcd.c index 19c7154de293c..075d717e3f815 100644 --- a/drivers/auxdisplay/auxdisplay_serlcd.c +++ b/drivers/auxdisplay/auxdisplay_serlcd.c @@ -426,8 +426,8 @@ static const struct auxdisplay_driver_api auxdisplay_serlcd_auxdisplay_api = { \ static struct auxdisplay_serlcd_data auxdisplay_serlcd_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, &auxdisplay_serlcd_init, NULL, &auxdisplay_serlcd_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &auxdisplay_serlcd_init, NULL, &auxdisplay_serlcd_data_##inst,\ &auxdisplay_serlcd_config_##inst, POST_KERNEL, \ - CONFIG_AUXDISPLAY_INIT_PRIORITY, &auxdisplay_serlcd_auxdisplay_api); + &auxdisplay_serlcd_auxdisplay_api); DT_INST_FOREACH_STATUS_OKAY(AUXDISPLAY_SERLCD_INST) diff --git a/drivers/bbram/bbram_emul.c b/drivers/bbram/bbram_emul.c index 663e00a66f290..7384ce72376f7 100644 --- a/drivers/bbram/bbram_emul.c +++ b/drivers/bbram/bbram_emul.c @@ -136,8 +136,7 @@ static const struct bbram_driver_api bbram_emul_driver_api = { static struct bbram_emul_config bbram_emul_config_##inst = { \ .size = DT_INST_PROP(inst, size), \ }; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &bbram_emul_data_##inst, \ - &bbram_emul_config_##inst, PRE_KERNEL_1, CONFIG_BBRAM_INIT_PRIORITY, \ - &bbram_emul_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &bbram_emul_data_##inst, \ + &bbram_emul_config_##inst, PRE_KERNEL_1, &bbram_emul_driver_api); DT_INST_FOREACH_STATUS_OKAY(BBRAM_INIT); diff --git a/drivers/bbram/bbram_it8xxx2.c b/drivers/bbram/bbram_it8xxx2.c index 1110cf025ce46..37c7cc8d76760 100644 --- a/drivers/bbram/bbram_it8xxx2.c +++ b/drivers/bbram/bbram_it8xxx2.c @@ -106,8 +106,7 @@ static int bbram_it8xxx2_init(const struct device *dev) #define BBRAM_INIT(inst) \ BBRAM_IT8XXX2_DECL_CONFIG(inst); \ - DEVICE_DT_INST_DEFINE(inst, bbram_it8xxx2_init, NULL, NULL, &bbram_cfg_##inst, \ - PRE_KERNEL_1, CONFIG_BBRAM_INIT_PRIORITY, \ - &bbram_it8xxx2_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, bbram_it8xxx2_init, NULL, NULL, &bbram_cfg_##inst, \ + PRE_KERNEL_1, &bbram_it8xxx2_driver_api); DT_INST_FOREACH_STATUS_OKAY(BBRAM_INIT); diff --git a/drivers/bbram/bbram_microchip_mcp7940n.c b/drivers/bbram/bbram_microchip_mcp7940n.c index ff5b7850576a6..f7aa13f153aa4 100644 --- a/drivers/bbram/bbram_microchip_mcp7940n.c +++ b/drivers/bbram/bbram_microchip_mcp7940n.c @@ -226,13 +226,12 @@ static const struct bbram_driver_api microchip_mcp7940n_bbram_api = { microchip_mcp7940n_bbram_config_##inst = { \ .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ µchip_mcp7940n_bbram_init, \ NULL, \ µchip_mcp7940n_bbram_data_##inst, \ µchip_mcp7940n_bbram_config_##inst, \ POST_KERNEL, \ - CONFIG_BBRAM_INIT_PRIORITY, \ µchip_mcp7940n_bbram_api); DT_INST_FOREACH_STATUS_OKAY(MICROCHIP_MCP7940N_BBRAM_DEVICE) diff --git a/drivers/bbram/bbram_npcx.c b/drivers/bbram/bbram_npcx.c index ceca04b1d8084..432ab3167112a 100644 --- a/drivers/bbram/bbram_npcx.c +++ b/drivers/bbram/bbram_npcx.c @@ -101,7 +101,7 @@ static const struct bbram_driver_api bbram_npcx_driver_api = { #define BBRAM_INIT(inst) \ BBRAM_NPCX_DECL_CONFIG(inst); \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, &bbram_cfg_##inst, PRE_KERNEL_1, \ - CONFIG_BBRAM_INIT_PRIORITY, &bbram_npcx_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, NULL, &bbram_cfg_##inst, PRE_KERNEL_1, \ + &bbram_npcx_driver_api); DT_INST_FOREACH_STATUS_OKAY(BBRAM_INIT); diff --git a/drivers/bbram/bbram_stm32.c b/drivers/bbram/bbram_stm32.c index 26acf001a9aed..ef0b9201dad46 100644 --- a/drivers/bbram/bbram_stm32.c +++ b/drivers/bbram/bbram_stm32.c @@ -118,7 +118,7 @@ static int bbram_stm32_init(const struct device *dev) .base_addr = DT_REG_ADDR(DT_INST_PARENT(inst)) + STM32_BKP_REG_OFFSET, \ .size = DT_INST_PROP(inst, st_backup_regs) * STM32_BKP_REG_BYTES, \ }; \ - DEVICE_DT_INST_DEFINE(inst, bbram_stm32_init, NULL, NULL, &bbram_cfg_##inst, PRE_KERNEL_1, \ - CONFIG_BBRAM_INIT_PRIORITY, &bbram_stm32_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, bbram_stm32_init, NULL, NULL, &bbram_cfg_##inst, PRE_KERNEL_1,\ + &bbram_stm32_driver_api); DT_INST_FOREACH_STATUS_OKAY(BBRAM_INIT); diff --git a/drivers/bbram/bbram_xec.c b/drivers/bbram/bbram_xec.c index 56a1cab2b9aa2..4c194e66ff149 100644 --- a/drivers/bbram/bbram_xec.c +++ b/drivers/bbram/bbram_xec.c @@ -84,8 +84,7 @@ static const struct bbram_driver_api bbram_xec_driver_api = { .base = (uint8_t *)(DT_INST_REG_ADDR(inst)), \ .size = DT_INST_REG_SIZE(inst), \ }; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, &bbram_cfg_##inst,\ - PRE_KERNEL_1, CONFIG_BBRAM_INIT_PRIORITY, \ - &bbram_xec_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, NULL, &bbram_cfg_##inst,\ + PRE_KERNEL_1, &bbram_xec_driver_api); DT_INST_FOREACH_STATUS_OKAY(BBRAM_INIT); diff --git a/drivers/bluetooth/hci/h4.c b/drivers/bluetooth/hci/h4.c index a37eb7fd16511..085bf321a2450 100644 --- a/drivers/bluetooth/hci/h4.c +++ b/drivers/bluetooth/hci/h4.c @@ -589,7 +589,7 @@ static const struct bt_hci_driver_api h4_driver_api = { .fifo = Z_FIFO_INITIALIZER(h4_data_##inst.tx.fifo), \ }, \ }; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &h4_data_##inst, &h4_config_##inst, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &h4_driver_api) + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &h4_data_##inst, &h4_config_##inst,\ + POST_KERNEL, &h4_driver_api) DT_INST_FOREACH_STATUS_OKAY(BT_UART_DEVICE_INIT) diff --git a/drivers/bluetooth/hci/h5.c b/drivers/bluetooth/hci/h5.c index ae75088b99775..707305d3c4307 100644 --- a/drivers/bluetooth/hci/h5.c +++ b/drivers/bluetooth/hci/h5.c @@ -821,8 +821,8 @@ static const struct bt_hci_driver_api h5_driver_api = { .tx_thread = &tx_thread_##inst, \ }; \ static struct h5_data h5_##inst; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &h5_##inst, &h5_config_##inst, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &h5_driver_api) + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &h5_##inst, &h5_config_##inst,\ + POST_KERNEL, &h5_driver_api) DT_INST_FOREACH_STATUS_OKAY(BT_UART_DEVICE_INIT) diff --git a/drivers/bluetooth/hci/hci_ambiq.c b/drivers/bluetooth/hci/hci_ambiq.c index a00139094492d..1fd51c06ce2fe 100644 --- a/drivers/bluetooth/hci/hci_ambiq.c +++ b/drivers/bluetooth/hci/hci_ambiq.c @@ -452,8 +452,8 @@ static int bt_apollo_init(const struct device *dev) #define HCI_DEVICE_INIT(inst) \ static struct bt_apollo_data hci_data_##inst = {}; \ - DEVICE_DT_INST_DEFINE(inst, bt_apollo_init, NULL, &hci_data_##inst, NULL, POST_KERNEL, \ - CONFIG_BT_HCI_INIT_PRIORITY, &drv) + DEVICE_INSTANCE_FROM_DT_INST(inst, bt_apollo_init, NULL, &hci_data_##inst, NULL, POST_KERNEL,\ + &drv) /* Only one instance supported right now */ HCI_DEVICE_INIT(0) diff --git a/drivers/bluetooth/hci/hci_da1469x.c b/drivers/bluetooth/hci/hci_da1469x.c index 8ffbb1b5ad268..619e5ee0c0420 100644 --- a/drivers/bluetooth/hci/hci_da1469x.c +++ b/drivers/bluetooth/hci/hci_da1469x.c @@ -518,8 +518,8 @@ static int bt_da1469x_init(const struct device *dev) #define HCI_DEVICE_INIT(inst) \ static struct hci_data hci_data_##inst = { \ }; \ - DEVICE_DT_INST_DEFINE(inst, bt_da1469x_init, NULL, &hci_data_##inst, NULL, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &drv) + DEVICE_INSTANCE_FROM_DT_INST(inst, bt_da1469x_init, NULL, &hci_data_##inst, NULL,\ + POST_KERNEL, &drv) /* Only one instance supported right now */ HCI_DEVICE_INIT(0) diff --git a/drivers/bluetooth/hci/hci_esp32.c b/drivers/bluetooth/hci/hci_esp32.c index 89597b0617963..927b4c05fcaba 100644 --- a/drivers/bluetooth/hci/hci_esp32.c +++ b/drivers/bluetooth/hci/hci_esp32.c @@ -371,8 +371,8 @@ static const struct bt_hci_driver_api drv = { #define BT_ESP32_DEVICE_INIT(inst) \ static struct bt_esp32_data bt_esp32_data_##inst = { \ }; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &bt_esp32_data_##inst, NULL, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &drv) + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &bt_esp32_data_##inst, NULL,\ + POST_KERNEL, &drv) /* Only one instance supported */ BT_ESP32_DEVICE_INIT(0) diff --git a/drivers/bluetooth/hci/hci_ifx_cyw208xx.c b/drivers/bluetooth/hci/hci_ifx_cyw208xx.c index 9146bd581abac..5e45f26ea7394 100644 --- a/drivers/bluetooth/hci/hci_ifx_cyw208xx.c +++ b/drivers/bluetooth/hci/hci_ifx_cyw208xx.c @@ -448,8 +448,8 @@ void wiced_bt_process_timer(void) #define CYW208XX_DEVICE_INIT(inst) \ static struct cyw208xx_data cyw208xx_data_##inst = { \ }; \ - DEVICE_DT_INST_DEFINE(inst, cyw208xx_hci_init, NULL, &cyw208xx_data_##inst, NULL, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &drv) + DEVICE_INSTANCE_FROM_DT_INST(inst, cyw208xx_hci_init, NULL, &cyw208xx_data_##inst, NULL,\ + POST_KERNEL, &drv) /* Only one instance supported */ CYW208XX_DEVICE_INIT(0) diff --git a/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c b/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c index 4c575c1d29bd7..3ba4ffb75b1ac 100644 --- a/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c +++ b/drivers/bluetooth/hci/hci_ifx_psoc6_bless.c @@ -274,8 +274,8 @@ static const struct bt_hci_driver_api drv = { #define PSOC6_BLESS_DEVICE_INIT(inst) \ static struct psoc6_bless_data psoc6_bless_data_##inst = { \ }; \ - DEVICE_DT_INST_DEFINE(inst, psoc6_bless_hci_init, NULL, &psoc6_bless_data_##inst, NULL, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &drv) + DEVICE_INSTANCE_FROM_DT_INST(inst, psoc6_bless_hci_init, NULL, &psoc6_bless_data_##inst, NULL,\ + POST_KERNEL, &drv) /* Only one instance supported */ PSOC6_BLESS_DEVICE_INIT(0) diff --git a/drivers/bluetooth/hci/hci_nxp.c b/drivers/bluetooth/hci/hci_nxp.c index da15356d63720..dbc1aed439a81 100644 --- a/drivers/bluetooth/hci/hci_nxp.c +++ b/drivers/bluetooth/hci/hci_nxp.c @@ -573,8 +573,8 @@ static int bt_nxp_init(const struct device *dev) #define HCI_DEVICE_INIT(inst) \ static struct bt_nxp_data hci_data_##inst = { \ }; \ - DEVICE_DT_INST_DEFINE(inst, bt_nxp_init, NULL, &hci_data_##inst, NULL, \ - POST_KERNEL, CONFIG_BT_HCI_INIT_PRIORITY, &drv) + DEVICE_INSTANCE_FROM_DT_INST(inst, bt_nxp_init, NULL, &hci_data_##inst, NULL,\ + POST_KERNEL, &drv) /* Only one instance supported right now */ HCI_DEVICE_INIT(0) diff --git a/drivers/bluetooth/hci/hci_silabs_efr32.c b/drivers/bluetooth/hci/hci_silabs_efr32.c index bd0fe0c0af771..1ebb62eb12c01 100644 --- a/drivers/bluetooth/hci/hci_silabs_efr32.c +++ b/drivers/bluetooth/hci/hci_silabs_efr32.c @@ -260,8 +260,8 @@ static const struct bt_hci_driver_api drv = { #define HCI_DEVICE_INIT(inst) \ static struct hci_data hci_data_##inst = { \ }; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &hci_data_##inst, NULL, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &drv) + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &hci_data_##inst, NULL,\ + POST_KERNEL, &drv) /* Only one instance supported right now */ HCI_DEVICE_INIT(0) diff --git a/drivers/bluetooth/hci/hci_spi_st.c b/drivers/bluetooth/hci/hci_spi_st.c index cc4d7f8b9d0e9..bac3dc285bf32 100644 --- a/drivers/bluetooth/hci/hci_spi_st.c +++ b/drivers/bluetooth/hci/hci_spi_st.c @@ -727,8 +727,8 @@ static int bt_spi_init(const struct device *dev) #define HCI_DEVICE_INIT(inst) \ static struct bt_spi_data hci_data_##inst = { \ }; \ - DEVICE_DT_INST_DEFINE(inst, bt_spi_init, NULL, &hci_data_##inst, NULL, \ - POST_KERNEL, CONFIG_BT_SPI_INIT_PRIORITY, &drv) + DEVICE_INSTANCE_FROM_DT_INST(inst, bt_spi_init, NULL, &hci_data_##inst, NULL,\ + POST_KERNEL, &drv) /* Only one instance supported right now */ HCI_DEVICE_INIT(0) diff --git a/drivers/bluetooth/hci/hci_stm32wb0.c b/drivers/bluetooth/hci/hci_stm32wb0.c index b47de037a2df3..5a07b83d9477c 100644 --- a/drivers/bluetooth/hci/hci_stm32wb0.c +++ b/drivers/bluetooth/hci/hci_stm32wb0.c @@ -496,8 +496,8 @@ static const struct bt_hci_driver_api drv = { #define HCI_DEVICE_INIT(inst) \ static struct hci_data hci_data_##inst = { \ }; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &hci_data_##inst, NULL, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &drv) + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &hci_data_##inst, NULL,\ + POST_KERNEL, &drv) /* Only one instance supported */ HCI_DEVICE_INIT(0) diff --git a/drivers/bluetooth/hci/hci_stm32wba.c b/drivers/bluetooth/hci/hci_stm32wba.c index 490f2b7258b55..f565fa28321ec 100644 --- a/drivers/bluetooth/hci/hci_stm32wba.c +++ b/drivers/bluetooth/hci/hci_stm32wba.c @@ -485,8 +485,8 @@ static const struct bt_hci_driver_api drv = { #define HCI_DEVICE_INIT(inst) \ static struct hci_data hci_data_##inst = { \ }; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &hci_data_##inst, NULL, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &drv) + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &hci_data_##inst, NULL,\ + POST_KERNEL, &drv) /* Only one instance supported */ HCI_DEVICE_INIT(0) diff --git a/drivers/bluetooth/hci/ipc.c b/drivers/bluetooth/hci/ipc.c index 9d63d12ec3286..364f3052e7ef9 100644 --- a/drivers/bluetooth/hci/ipc.c +++ b/drivers/bluetooth/hci/ipc.c @@ -398,7 +398,7 @@ static const struct bt_hci_driver_api drv = { }, \ .ipc = DEVICE_DT_GET(DT_INST_PARENT(inst)), \ }; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &ipc_data_##inst, NULL, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &drv) + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &ipc_data_##inst, NULL,\ + POST_KERNEL, &drv) DT_INST_FOREACH_STATUS_OKAY(IPC_DEVICE_INIT) diff --git a/drivers/bluetooth/hci/ipm_stm32wb.c b/drivers/bluetooth/hci/ipm_stm32wb.c index f476083dc8cb8..9adcdcf48f5cb 100644 --- a/drivers/bluetooth/hci/ipm_stm32wb.c +++ b/drivers/bluetooth/hci/ipm_stm32wb.c @@ -644,8 +644,8 @@ static int _bt_ipm_init(const struct device *dev) #define HCI_DEVICE_INIT(inst) \ static struct hci_data hci_data_##inst = { \ }; \ - DEVICE_DT_INST_DEFINE(inst, _bt_ipm_init, NULL, &hci_data_##inst, NULL, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &drv) + DEVICE_INSTANCE_FROM_DT_INST(inst, _bt_ipm_init, NULL, &hci_data_##inst, NULL,\ + POST_KERNEL, &drv) /* Only one instance supported right now */ HCI_DEVICE_INIT(0) diff --git a/drivers/bluetooth/hci/spi.c b/drivers/bluetooth/hci/spi.c index 05e46a1d182cf..e20adf4d68f01 100644 --- a/drivers/bluetooth/hci/spi.c +++ b/drivers/bluetooth/hci/spi.c @@ -452,8 +452,8 @@ static int bt_spi_init(const struct device *dev) #define HCI_DEVICE_INIT(inst) \ static struct bt_spi_data hci_data_##inst = { \ }; \ - DEVICE_DT_INST_DEFINE(inst, bt_spi_init, NULL, &hci_data_##inst, NULL, \ - POST_KERNEL, CONFIG_BT_SPI_INIT_PRIORITY, &drv) + DEVICE_INSTANCE_FROM_DT_INST(inst, bt_spi_init, NULL, &hci_data_##inst, NULL,\ + POST_KERNEL, &drv) /* Only one instance supported right now */ HCI_DEVICE_INIT(0) diff --git a/drivers/bluetooth/hci/userchan.c b/drivers/bluetooth/hci/userchan.c index aedb71a8430c5..6c7c4b064bf9b 100644 --- a/drivers/bluetooth/hci/userchan.c +++ b/drivers/bluetooth/hci/userchan.c @@ -426,8 +426,8 @@ static int uc_init(const struct device *dev) static struct uc_data uc_data_##inst = { \ .fd = -1, \ }; \ - DEVICE_DT_INST_DEFINE(inst, uc_init, NULL, &uc_data_##inst, NULL, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &uc_drv_api) + DEVICE_INSTANCE_FROM_DT_INST(inst, uc_init, NULL, &uc_data_##inst, NULL,\ + POST_KERNEL, &uc_drv_api) DT_INST_FOREACH_STATUS_OKAY(UC_DEVICE_INIT) diff --git a/drivers/can/can_esp32_twai.c b/drivers/can/can_esp32_twai.c index 6cbad32ac2ba5..1e1d7ceee82e2 100644 --- a/drivers/can/can_esp32_twai.c +++ b/drivers/can/can_esp32_twai.c @@ -296,8 +296,8 @@ const struct can_driver_api can_esp32_twai_driver_api = { static struct can_sja1000_data can_sja1000_data_##inst = \ CAN_SJA1000_DATA_INITIALIZER(NULL); \ \ - CAN_DEVICE_DT_INST_DEFINE(inst, can_esp32_twai_init, NULL, &can_sja1000_data_##inst, \ + CAN_DEVICE_INSTANCE_FROM_DT_INST(inst, can_esp32_twai_init, NULL, &can_sja1000_data_##inst,\ &can_sja1000_config_##inst, POST_KERNEL, \ - CONFIG_CAN_INIT_PRIORITY, &can_esp32_twai_driver_api); + &can_esp32_twai_driver_api); DT_INST_FOREACH_STATUS_OKAY(CAN_ESP32_TWAI_INIT) diff --git a/drivers/can/can_fake.c b/drivers/can/can_fake.c index 88666c5931c17..47bde435cd241 100644 --- a/drivers/can/can_fake.c +++ b/drivers/can/can_fake.c @@ -167,9 +167,8 @@ static const struct can_driver_api fake_can_driver_api = { \ static struct fake_can_data fake_can_data_##inst; \ \ - CAN_DEVICE_DT_INST_DEFINE(inst, fake_can_init, NULL, &fake_can_data_##inst, \ - &fake_can_config_##inst, POST_KERNEL, \ - CONFIG_CAN_INIT_PRIORITY, \ + CAN_DEVICE_INSTANCE_FROM_DT_INST(inst, fake_can_init, NULL, &fake_can_data_##inst,\ + &fake_can_config_##inst, POST_KERNEL, \ &fake_can_driver_api); DT_INST_FOREACH_STATUS_OKAY(FAKE_CAN_INIT) diff --git a/drivers/can/can_kvaser_pci.c b/drivers/can/can_kvaser_pci.c index 002ee3bade4b9..6de267c733a4d 100644 --- a/drivers/can/can_kvaser_pci.c +++ b/drivers/can/can_kvaser_pci.c @@ -175,9 +175,9 @@ const struct can_driver_api can_kvaser_pci_driver_api = { static struct can_sja1000_data can_sja1000_data_##inst = \ CAN_SJA1000_DATA_INITIALIZER(&can_kvaser_pci_data_##inst); \ \ - CAN_DEVICE_DT_INST_DEFINE(inst, can_kvaser_pci_init, NULL, &can_sja1000_data_##inst, \ + CAN_DEVICE_INSTANCE_FROM_DT_INST(inst, can_kvaser_pci_init, NULL, &can_sja1000_data_##inst,\ &can_sja1000_config_##inst, POST_KERNEL, \ - CONFIG_CAN_INIT_PRIORITY, &can_kvaser_pci_driver_api); \ + &can_kvaser_pci_driver_api); \ \ static void can_kvaser_pci_config_func_##inst(const struct device *dev) \ { \ diff --git a/drivers/can/can_loopback.c b/drivers/can/can_loopback.c index 118b6e6532976..a7f288ca98d0b 100644 --- a/drivers/can/can_loopback.c +++ b/drivers/can/can_loopback.c @@ -455,10 +455,9 @@ static int can_loopback_init(const struct device *dev) \ static struct can_loopback_data can_loopback_data_##inst; \ \ - CAN_DEVICE_DT_INST_DEFINE(inst, can_loopback_init, NULL, \ + CAN_DEVICE_INSTANCE_FROM_DT_INST(inst, can_loopback_init, NULL, \ &can_loopback_data_##inst, \ &can_loopback_config_##inst, \ - POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ - &can_loopback_driver_api); + POST_KERNEL, &can_loopback_driver_api); DT_INST_FOREACH_STATUS_OKAY(CAN_LOOPBACK_INIT) diff --git a/drivers/can/can_mcp2515.c b/drivers/can/can_mcp2515.c index 791f548cec5b4..08bbe03a09bdb 100644 --- a/drivers/can/can_mcp2515.c +++ b/drivers/can/can_mcp2515.c @@ -1014,8 +1014,7 @@ static int mcp2515_init(const struct device *dev) .osc_freq = DT_INST_PROP(inst, osc_freq), \ }; \ \ - CAN_DEVICE_DT_INST_DEFINE(inst, mcp2515_init, NULL, &mcp2515_data_##inst, \ - &mcp2515_config_##inst, POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ - &can_api_funcs); + CAN_DEVICE_INSTANCE_FROM_DT_INST(inst, mcp2515_init, NULL, &mcp2515_data_##inst, \ + &mcp2515_config_##inst, POST_KERNEL, &can_api_funcs); DT_INST_FOREACH_STATUS_OKAY(MCP2515_INIT) diff --git a/drivers/can/can_mcp251xfd.c b/drivers/can/can_mcp251xfd.c index a367284e8f053..96c13fb8b3ae6 100644 --- a/drivers/can/can_mcp251xfd.c +++ b/drivers/can/can_mcp251xfd.c @@ -1768,8 +1768,7 @@ static const struct can_driver_api mcp251xfd_api_funcs = { MCP251XFD_SET_CLOCK(inst) \ }; \ \ - CAN_DEVICE_DT_INST_DEFINE(inst, mcp251xfd_init, NULL, &mcp251xfd_data_##inst, \ - &mcp251xfd_config_##inst, POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ - &mcp251xfd_api_funcs); + CAN_DEVICE_INSTANCE_FROM_DT_INST(inst, mcp251xfd_init, NULL, &mcp251xfd_data_##inst, \ + &mcp251xfd_config_##inst, POST_KERNEL, &mcp251xfd_api_funcs); DT_INST_FOREACH_STATUS_OKAY(MCP251XFD_INIT) diff --git a/drivers/can/can_mcux_flexcan.c b/drivers/can/can_mcux_flexcan.c index cc11dadf96247..b8a2e321a8962 100644 --- a/drivers/can/can_mcux_flexcan.c +++ b/drivers/can/can_mcux_flexcan.c @@ -1419,11 +1419,10 @@ static const struct can_driver_api mcux_flexcan_fd_driver_api = { \ static struct mcux_flexcan_data mcux_flexcan_data_##id; \ \ - CAN_DEVICE_DT_INST_DEFINE(id, mcux_flexcan_init, \ + CAN_DEVICE_INSTANCE_FROM_DT_INST(id, mcux_flexcan_init, \ NULL, &mcux_flexcan_data_##id, \ &mcux_flexcan_config_##id, \ - POST_KERNEL, CONFIG_CAN_INIT_PRIORITY,\ - &FLEXCAN_DRIVER_API(id)); \ + POST_KERNEL, &FLEXCAN_DRIVER_API(id));\ \ static void mcux_flexcan_irq_config_##id(const struct device *dev) \ { \ diff --git a/drivers/can/can_mcux_mcan.c b/drivers/can/can_mcux_mcan.c index 5a984279ae554..fc96a1b169c95 100644 --- a/drivers/can/can_mcux_mcan.c +++ b/drivers/can/can_mcux_mcan.c @@ -220,12 +220,11 @@ static const struct can_mcan_ops mcux_mcan_ops = { static struct can_mcan_data can_mcan_data_##n = \ CAN_MCAN_DATA_INITIALIZER(NULL); \ \ - CAN_DEVICE_DT_INST_DEFINE(n, mcux_mcan_init, NULL, \ + CAN_DEVICE_INSTANCE_FROM_DT_INST(n, mcux_mcan_init, NULL, \ &can_mcan_data_##n, \ &can_mcan_config_##n, \ POST_KERNEL, \ - CONFIG_CAN_INIT_PRIORITY, \ - &mcux_mcan_driver_api); \ + &mcux_mcan_driver_api), \ \ static void mcux_mcan_irq_config_##n(const struct device *dev) \ { \ diff --git a/drivers/can/can_native_linux.c b/drivers/can/can_native_linux.c index 6d1ccf4848177..29b147f5dbaa8 100644 --- a/drivers/can/can_native_linux.c +++ b/drivers/can/can_native_linux.c @@ -487,11 +487,10 @@ static const struct can_native_linux_config can_native_linux_cfg_##inst = { \ \ static struct can_native_linux_data can_native_linux_data_##inst; \ \ -CAN_DEVICE_DT_INST_DEFINE(inst, can_native_linux_init, NULL, \ +CAN_DEVICE_INSTANCE_FROM_DT_INST(inst, can_native_linux_init, NULL, \ &can_native_linux_data_##inst, \ &can_native_linux_cfg_##inst, \ - POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ - &can_native_linux_driver_api); + POST_KERNEL, &can_native_linux_driver_api); DT_INST_FOREACH_STATUS_OKAY(CAN_NATIVE_LINUX_INIT) diff --git a/drivers/can/can_nrf.c b/drivers/can/can_nrf.c index 553e115f8e239..298e42a363ef5 100644 --- a/drivers/can/can_nrf.c +++ b/drivers/can/can_nrf.c @@ -199,8 +199,7 @@ static int can_nrf_init(const struct device *dev) \ static struct can_mcan_data can_mcan_nrf_data##n = CAN_MCAN_DATA_INITIALIZER(NULL); \ \ - DEVICE_DT_INST_DEFINE(n, can_nrf_init, NULL, &can_mcan_nrf_data##n, \ - &can_mcan_nrf_config##n, POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ - &can_nrf_api); + DEVICE_INSTANCE_FROM_DT_INST(n, can_nrf_init, NULL, &can_mcan_nrf_data##n, \ + &can_mcan_nrf_config##n, POST_KERNEL, &can_nrf_api); DT_INST_FOREACH_STATUS_OKAY(CAN_NRF_DEFINE) diff --git a/drivers/can/can_numaker.c b/drivers/can/can_numaker.c index 7580708052ce8..668e7d94c5c18 100644 --- a/drivers/can/can_numaker.c +++ b/drivers/can/can_numaker.c @@ -286,13 +286,12 @@ static const struct can_mcan_ops can_numaker_ops = { static struct can_mcan_data can_mcan_data_##inst = \ CAN_MCAN_DATA_INITIALIZER(&can_numaker_data_ ## inst); \ \ - CAN_DEVICE_DT_INST_DEFINE(inst, \ + CAN_DEVICE_INSTANCE_FROM_DT_INST(inst, \ can_numaker_init, \ NULL, \ &can_mcan_data_##inst, \ &can_mcan_config_##inst, \ POST_KERNEL, \ - CONFIG_CAN_INIT_PRIORITY, \ - &can_numaker_driver_api); \ + &can_numaker_driver_api), \ DT_INST_FOREACH_STATUS_OKAY(CAN_NUMAKER_INIT); diff --git a/drivers/can/can_nxp_s32_canxl.c b/drivers/can/can_nxp_s32_canxl.c index 7c6f0520be510..b5cec0ac706b5 100644 --- a/drivers/can/can_nxp_s32_canxl.c +++ b/drivers/can/can_nxp_s32_canxl.c @@ -1240,13 +1240,12 @@ static const struct can_driver_api can_nxp_s32_driver_api = { { \ return can_nxp_s32_init(dev); \ } \ - CAN_DEVICE_DT_INST_DEFINE(n, \ + CAN_DEVICE_INSTANCE_FROM_DT_INST(n, \ can_nxp_s32_##n##_init, \ NULL, \ &can_nxp_s32_data_##n, \ &can_nxp_s32_config_##n, \ POST_KERNEL, \ - CONFIG_CAN_INIT_PRIORITY, \ &can_nxp_s32_driver_api); DT_INST_FOREACH_STATUS_OKAY(CAN_NXP_S32_INIT_DEVICE) diff --git a/drivers/can/can_rcar.c b/drivers/can/can_rcar.c index 23bd82896cbe8..90ed569e3a19d 100644 --- a/drivers/can/can_rcar.c +++ b/drivers/can/can_rcar.c @@ -1205,13 +1205,12 @@ static const struct can_driver_api can_rcar_driver_api = { }; \ static struct can_rcar_data can_rcar_data_##n; \ \ - CAN_DEVICE_DT_INST_DEFINE(n, can_rcar_init, \ + CAN_DEVICE_INSTANCE_FROM_DT_INST(n, can_rcar_init, \ NULL, \ &can_rcar_data_##n, \ &can_rcar_cfg_##n, \ POST_KERNEL, \ - CONFIG_CAN_INIT_PRIORITY, \ - &can_rcar_driver_api \ + &can_rcar_driver_api, \ ); \ static void can_rcar_##n##_init(const struct device *dev) \ { \ diff --git a/drivers/can/can_renesas_ra.c b/drivers/can/can_renesas_ra.c index 1548b38c502c0..a8cab1419bbe9 100644 --- a/drivers/can/can_renesas_ra.c +++ b/drivers/can/can_renesas_ra.c @@ -1060,9 +1060,8 @@ static int can_renesas_ra_global_init(const struct device *dev) return 0; } -DEVICE_DT_DEFINE(DT_COMPAT_GET_ANY_STATUS_OKAY(renesas_ra_canfd_global), can_renesas_ra_global_init, - NULL, NULL, &g_can_renesas_ra_global_cfg, PRE_KERNEL_2, CONFIG_CAN_INIT_PRIORITY, - NULL) +DEVICE_INSTANCE(DT_COMPAT_GET_ANY_STATUS_OKAY(renesas_ra_canfd_global), can_renesas_ra_global_init, + NULL, NULL, &g_can_renesas_ra_global_cfg, PRE_KERNEL_2, NULL) #define _ELC_EVENT_CAN_COMFRX(channel) ELC_EVENT_CAN##channel##_COMFRX #define _ELC_EVENT_CAN_TX(channel) ELC_EVENT_CAN##channel##_TX diff --git a/drivers/can/can_sam.c b/drivers/can/can_sam.c index e3fc6c1839333..4975a2424276f 100644 --- a/drivers/can/can_sam.c +++ b/drivers/can/can_sam.c @@ -194,11 +194,10 @@ static void config_can_##inst##_irq(void) CAN_MCAN_DATA_INITIALIZER(NULL); #define CAN_SAM_DEVICE_INST(inst) \ - CAN_DEVICE_DT_INST_DEFINE(inst, can_sam_init, NULL, \ + CAN_DEVICE_INSTANCE_FROM_DT_INST(inst, can_sam_init, NULL, \ &can_mcan_data_##inst, \ &can_mcan_cfg_##inst, \ - POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ - &can_sam_driver_api); + POST_KERNEL, &can_sam_driver_api); #define CAN_SAM_INST(inst) \ CAN_MCAN_DT_INST_BUILD_ASSERT_MRAM_CFG(inst); \ diff --git a/drivers/can/can_sam0.c b/drivers/can/can_sam0.c index adcbf6a567db6..b95ae34018d05 100644 --- a/drivers/can/can_sam0.c +++ b/drivers/can/can_sam0.c @@ -228,11 +228,10 @@ static void config_can_##inst##_irq(void) \ CAN_MCAN_DATA_INITIALIZER(NULL); #define CAN_SAM0_DEVICE_INST(inst) \ - CAN_DEVICE_DT_INST_DEFINE(inst, can_sam0_init, NULL, \ + CAN_DEVICE_INSTANCE_FROM_DT_INST(inst, can_sam0_init, NULL, \ &can_mcan_data_##inst, \ &can_mcan_cfg_##inst, \ - POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ - &can_sam0_driver_api); + POST_KERNEL, &can_sam0_driver_api); #define CAN_SAM0_INST(inst) \ CAN_MCAN_DT_INST_BUILD_ASSERT_MRAM_CFG(inst); \ diff --git a/drivers/can/can_stm32_bxcan.c b/drivers/can/can_stm32_bxcan.c index 5c3e44dfd0c3c..b9c4e918179f2 100644 --- a/drivers/can/can_stm32_bxcan.c +++ b/drivers/can/can_stm32_bxcan.c @@ -1153,10 +1153,9 @@ static const struct can_stm32_config can_stm32_cfg_##inst = { \ static struct can_stm32_data can_stm32_dev_data_##inst; #define CAN_STM32_DEFINE_INST(inst) \ -CAN_DEVICE_DT_INST_DEFINE(inst, can_stm32_init, NULL, \ - &can_stm32_dev_data_##inst, &can_stm32_cfg_##inst, \ - POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ - &can_api_funcs); +CAN_DEVICE_INSTANCE_FROM_DT_INST(inst, can_stm32_init, NULL, \ + &can_stm32_dev_data_##inst, &can_stm32_cfg_##inst,\ + POST_KERNEL, &can_api_funcs); #define CAN_STM32_INST(inst) \ CAN_STM32_IRQ_INST(inst) \ diff --git a/drivers/can/can_stm32_fdcan.c b/drivers/can/can_stm32_fdcan.c index 3f00818e2fc49..04b87f88d17a1 100644 --- a/drivers/can/can_stm32_fdcan.c +++ b/drivers/can/can_stm32_fdcan.c @@ -604,10 +604,9 @@ static void config_can_##inst##_irq(void) \ CAN_MCAN_DATA_INITIALIZER(NULL); #define CAN_STM32FD_DEVICE_INST(inst) \ - CAN_DEVICE_DT_INST_DEFINE(inst, can_stm32fd_init, NULL, \ + CAN_DEVICE_INSTANCE_FROM_DT_INST(inst, can_stm32fd_init, NULL, \ &can_mcan_data_##inst, &can_mcan_cfg_##inst, \ - POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ - &can_stm32fd_driver_api); + POST_KERNEL, &can_stm32fd_driver_api); #define CAN_STM32FD_INST(inst) \ CAN_STM32FD_BUILD_ASSERT_MRAM_CFG(inst) \ diff --git a/drivers/can/can_stm32h7_fdcan.c b/drivers/can/can_stm32h7_fdcan.c index 4bf917a5edef6..a013845b21b23 100644 --- a/drivers/can/can_stm32h7_fdcan.c +++ b/drivers/can/can_stm32h7_fdcan.c @@ -271,11 +271,10 @@ static const struct can_mcan_ops can_stm32h7_ops = { static struct can_mcan_data can_mcan_data_##n = \ CAN_MCAN_DATA_INITIALIZER(NULL); \ \ - CAN_DEVICE_DT_INST_DEFINE(n, can_stm32h7_init, NULL, \ - &can_mcan_data_##n, \ - &can_mcan_cfg_##n, \ - POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ - &can_stm32h7_driver_api); \ + CAN_DEVICE_INSTANCE_FROM_DT_INST(n, can_stm32h7_init, NULL, \ + &can_mcan_data_##n, \ + &can_mcan_cfg_##n, \ + POST_KERNEL, &can_stm32h7_driver_api), \ \ static void stm32h7_mcan_irq_config_##n(void) \ { \ diff --git a/drivers/can/can_tcan4x5x.c b/drivers/can/can_tcan4x5x.c index a68ea5e22a485..fd58a79e3832f 100644 --- a/drivers/can/can_tcan4x5x.c +++ b/drivers/can/can_tcan4x5x.c @@ -792,8 +792,7 @@ static const struct can_mcan_ops tcan4x5x_ops = { static struct can_mcan_data can_mcan_data_##inst = \ CAN_MCAN_DATA_INITIALIZER(&tcan4x5x_data_##inst); \ \ - CAN_DEVICE_DT_INST_DEFINE(inst, tcan4x5x_init, NULL, &can_mcan_data_##inst, \ - &can_mcan_config_##inst, POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ - &tcan4x5x_driver_api); + CAN_DEVICE_INSTANCE_FROM_DT_INST(inst, tcan4x5x_init, NULL, &can_mcan_data_##inst, \ + &can_mcan_config_##inst, POST_KERNEL, &tcan4x5x_driver_api); DT_INST_FOREACH_STATUS_OKAY(TCAN4X5X_INIT) diff --git a/drivers/can/can_xmc4xxx.c b/drivers/can/can_xmc4xxx.c index 2704ef1b44edb..0f23ed9d26453 100644 --- a/drivers/can/can_xmc4xxx.c +++ b/drivers/can/can_xmc4xxx.c @@ -932,8 +932,8 @@ static const struct can_driver_api can_xmc4xxx_api_funcs = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ }; \ \ - CAN_DEVICE_DT_INST_DEFINE(inst, can_xmc4xxx_init, NULL, &can_xmc4xxx_data_##inst, \ + CAN_DEVICE_INSTANCE_FROM_DT_INST(inst, can_xmc4xxx_init, NULL, &can_xmc4xxx_data_##inst, \ &can_xmc4xxx_config_##inst, POST_KERNEL, \ - CONFIG_CAN_INIT_PRIORITY, &can_xmc4xxx_api_funcs); + &can_xmc4xxx_api_funcs); DT_INST_FOREACH_STATUS_OKAY(CAN_XMC4XXX_INIT) diff --git a/drivers/can/transceiver/can_transceiver_gpio.c b/drivers/can/transceiver/can_transceiver_gpio.c index 3f7bbca688f07..d8c606a17d048 100644 --- a/drivers/can/transceiver/can_transceiver_gpio.c +++ b/drivers/can/transceiver/can_transceiver_gpio.c @@ -130,9 +130,8 @@ static const struct can_transceiver_driver_api can_transceiver_gpio_driver_api = CAN_TRANSCEIVER_GPIO_COND(inst, standby) \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &can_transceiver_gpio_init, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &can_transceiver_gpio_init, \ NULL, NULL, &can_transceiver_gpio_config_##inst,\ - POST_KERNEL, CONFIG_CAN_TRANSCEIVER_INIT_PRIORITY, \ - &can_transceiver_gpio_driver_api); \ + POST_KERNEL, &can_transceiver_gpio_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(CAN_TRANSCEIVER_GPIO_INIT) diff --git a/drivers/charger/charger_bq24190.c b/drivers/charger/charger_bq24190.c index 9b313136fefe9..a6dd912a39bfd 100644 --- a/drivers/charger/charger_bq24190.c +++ b/drivers/charger/charger_bq24190.c @@ -486,8 +486,7 @@ static const struct charger_driver_api bq24190_driver_api = { .vreg_uv = DT_INST_PROP(inst, constant_charge_voltage_max_microvolt), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, bq24190_init, NULL, &bq24190_data_##inst, \ - &bq24190_config_##inst, POST_KERNEL, CONFIG_CHARGER_INIT_PRIORITY, \ - &bq24190_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, bq24190_init, NULL, &bq24190_data_##inst, \ + &bq24190_config_##inst, POST_KERNEL, &bq24190_driver_api); DT_INST_FOREACH_STATUS_OKAY(BQ24190_INIT) diff --git a/drivers/charger/charger_bq25180.c b/drivers/charger/charger_bq25180.c index 060ae7d9c787b..5a53553eeb7ee 100644 --- a/drivers/charger/charger_bq25180.c +++ b/drivers/charger/charger_bq25180.c @@ -392,7 +392,7 @@ static int bq25180_init(const struct device *dev) DT_INST_PROP(inst, precharge_voltage_threshold_microvolt), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, bq25180_init, NULL, NULL, &bq25180_config_##inst, POST_KERNEL, \ - CONFIG_CHARGER_INIT_PRIORITY, &bq25180_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, bq25180_init, NULL, NULL, &bq25180_config_##inst, POST_KERNEL,\ + &bq25180_api); DT_INST_FOREACH_STATUS_OKAY(CHARGER_BQ25180_INIT) diff --git a/drivers/charger/charger_max20335.c b/drivers/charger/charger_max20335.c index a58da7e573149..4792b6f19ff63 100644 --- a/drivers/charger/charger_max20335.c +++ b/drivers/charger/charger_max20335.c @@ -664,9 +664,8 @@ static const struct charger_driver_api max20335_driver_api = { .therm_mon_mode = DT_INST_PROP(inst, thermistor_monitoring_mode), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &max20335_init, NULL, &charger_max20335_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &max20335_init, NULL, &charger_max20335_data_##inst, \ &charger_max20335_config_##inst, \ - POST_KERNEL, CONFIG_MFD_INIT_PRIORITY, \ - &max20335_driver_api); + POST_KERNEL, &max20335_driver_api); DT_INST_FOREACH_STATUS_OKAY(MAX20335_DEFINE) diff --git a/drivers/charger/sbs_charger.c b/drivers/charger/sbs_charger.c index 9017e1e60b847..eab2319457407 100644 --- a/drivers/charger/sbs_charger.c +++ b/drivers/charger/sbs_charger.c @@ -169,7 +169,7 @@ static const struct charger_driver_api sbs_charger_driver_api = { .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &sbs_charger_init, NULL, NULL, &sbs_charger_config_##inst, \ - POST_KERNEL, CONFIG_CHARGER_INIT_PRIORITY, &sbs_charger_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, &sbs_charger_init, NULL, NULL, &sbs_charger_config_##inst,\ + POST_KERNEL, &sbs_charger_driver_api); DT_INST_FOREACH_STATUS_OKAY(SBS_CHARGER_INIT) diff --git a/drivers/clock_control/beetle_clock_control.c b/drivers/clock_control/beetle_clock_control.c index 33f202cbb2b35..6f2c635c45ac3 100644 --- a/drivers/clock_control/beetle_clock_control.c +++ b/drivers/clock_control/beetle_clock_control.c @@ -243,7 +243,6 @@ static const struct beetle_clock_control_cfg_t beetle_cc_cfg = { * @brief Clock Control device init * */ -DEVICE_DT_INST_DEFINE(0, beetle_clock_control_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, beetle_clock_control_init, NULL, NULL, &beetle_cc_cfg, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &beetle_clock_control_api); diff --git a/drivers/clock_control/clock_agilex.c b/drivers/clock_control/clock_agilex.c index d6ac6583682cf..902d75c91a0af 100644 --- a/drivers/clock_control/clock_agilex.c +++ b/drivers/clock_control/clock_agilex.c @@ -39,6 +39,5 @@ static const struct clock_control_driver_api clk_api = { .get_rate = clk_get_rate }; -DEVICE_DT_DEFINE(DT_NODELABEL(clock), NULL, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, - &clk_api); +DEVICE_INSTANCE(DT_NODELABEL(clock), NULL, NULL, NULL, NULL, + PRE_KERNEL_1, &clk_api); diff --git a/drivers/clock_control/clock_control_adsp.c b/drivers/clock_control/clock_control_adsp.c index b48cfceefe38f..22827a9a7f82d 100644 --- a/drivers/clock_control/clock_control_adsp.c +++ b/drivers/clock_control/clock_control_adsp.c @@ -28,6 +28,6 @@ static const struct clock_control_driver_api cavs_clock_api = { .set_rate = cavs_clock_ctrl_set_rate }; -DEVICE_DT_DEFINE(DT_NODELABEL(clkctl), cavs_clock_ctrl_init, NULL, +DEVICE_INSTANCE(DT_NODELABEL(clkctl), cavs_clock_ctrl_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &cavs_clock_api); + &cavs_clock_api); diff --git a/drivers/clock_control/clock_control_agilex5.c b/drivers/clock_control/clock_control_agilex5.c index 82ffb0b0961ac..9630518073adc 100644 --- a/drivers/clock_control/clock_control_agilex5.c +++ b/drivers/clock_control/clock_control_agilex5.c @@ -79,8 +79,8 @@ static const struct clock_control_driver_api clock_api = {.get_rate = clock_get_ DEVICE_MMIO_ROM_INIT(DT_DRV_INST(_inst)), \ }; \ \ - DEVICE_DT_INST_DEFINE(_inst, clock_init, NULL, &clock_control_data_##_inst, \ + DEVICE_INSTANCE_FROM_DT_INST(_inst, clock_init, NULL, &clock_control_data_##_inst, \ &clock_control_config_##_inst, PRE_KERNEL_1, \ - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &clock_api); + &clock_api); DT_INST_FOREACH_STATUS_OKAY(CLOCK_CONTROL_DEVICE) diff --git a/drivers/clock_control/clock_control_ambiq.c b/drivers/clock_control/clock_control_ambiq.c index a64030c2a2df7..f41c0b9d72453 100644 --- a/drivers/clock_control/clock_control_ambiq.c +++ b/drivers/clock_control/clock_control_ambiq.c @@ -131,8 +131,7 @@ static const struct clock_control_driver_api ambiq_clock_driver_api = { static const struct ambiq_clock_config ambiq_clock_config##n = { \ .clock_freq = DT_INST_PROP(n, clock_frequency), \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n)}; \ - DEVICE_DT_INST_DEFINE(n, ambiq_clock_init, NULL, NULL, &ambiq_clock_config##n, \ - POST_KERNEL, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, \ - &ambiq_clock_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, ambiq_clock_init, NULL, NULL, &ambiq_clock_config##n, \ + POST_KERNEL, &ambiq_clock_driver_api); DT_INST_FOREACH_STATUS_OKAY(AMBIQ_CLOCK_INIT) diff --git a/drivers/clock_control/clock_control_arm_scmi.c b/drivers/clock_control/clock_control_arm_scmi.c index 202f7eb05a8bb..6a24bb767cb63 100644 --- a/drivers/clock_control/clock_control_arm_scmi.c +++ b/drivers/clock_control/clock_control_arm_scmi.c @@ -97,6 +97,5 @@ static int scmi_clock_init(const struct device *dev) static struct scmi_clock_data data; -DT_INST_SCMI_PROTOCOL_DEFINE(0, &scmi_clock_init, NULL, &data, NULL, - PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, - &scmi_clock_api); +SCMI_PROTOCOL_INSTANCE_FROM_DT_INST(0, &scmi_clock_init, NULL, &data, NULL, + PRE_KERNEL_1, &scmi_clock_api); diff --git a/drivers/clock_control/clock_control_ast10x0.c b/drivers/clock_control/clock_control_ast10x0.c index f1f99cc762bdc..42f9a99310233 100644 --- a/drivers/clock_control/clock_control_ast10x0.c +++ b/drivers/clock_control/clock_control_ast10x0.c @@ -156,7 +156,7 @@ static const struct clock_control_driver_api aspeed_clk_api = { static const struct clock_aspeed_config clock_aspeed_cfg_##n = { \ .syscon = DEVICE_DT_GET(DT_NODELABEL(syscon)), \ }; \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, &clock_aspeed_cfg_##n, PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &aspeed_clk_api); + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, NULL, &clock_aspeed_cfg_##n, PRE_KERNEL_1, \ + &aspeed_clk_api); DT_INST_FOREACH_STATUS_OKAY(ASPEED_CLOCK_INIT) diff --git a/drivers/clock_control/clock_control_esp32.c b/drivers/clock_control/clock_control_esp32.c index 98762b6813f6c..1a145b77afd27 100644 --- a/drivers/clock_control/clock_control_esp32.c +++ b/drivers/clock_control/clock_control_esp32.c @@ -819,11 +819,10 @@ static const struct esp32_clock_config esp32_clock_config0 = { .rtc = esp32_rtc_clock_config0 }; -DEVICE_DT_DEFINE(DT_NODELABEL(rtc), +DEVICE_INSTANCE(DT_NODELABEL(rtc), clock_control_esp32_init, NULL, NULL, &esp32_clock_config0, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &clock_control_esp32_api); diff --git a/drivers/clock_control/clock_control_fixed_rate.c b/drivers/clock_control/clock_control_fixed_rate.c index eaa4b3979f908..62c2a522086e2 100644 --- a/drivers/clock_control/clock_control_fixed_rate.c +++ b/drivers/clock_control/clock_control_fixed_rate.c @@ -67,12 +67,11 @@ static int fixed_rate_clk_init(const struct device *dev) static const struct fixed_rate_clock_config fixed_rate_clock_config_##idx = { \ .rate = DT_INST_PROP(idx, clock_frequency), \ }; \ - DEVICE_DT_INST_DEFINE(idx, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, \ fixed_rate_clk_init, \ NULL, NULL, \ &fixed_rate_clock_config_##idx, \ PRE_KERNEL_1, \ - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, \ - &fixed_rate_clk_api \ + &fixed_rate_clk_api ,\ ); DT_INST_FOREACH_STATUS_OKAY(FIXED_CLK_INIT) diff --git a/drivers/clock_control/clock_control_gd32.c b/drivers/clock_control/clock_control_gd32.c index 52b197e2029f7..9383fac109558 100644 --- a/drivers/clock_control/clock_control_gd32.c +++ b/drivers/clock_control/clock_control_gd32.c @@ -209,6 +209,5 @@ static const struct clock_control_gd32_config config = { .base = DT_REG_ADDR(DT_INST_PARENT(0)), }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, &config, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, &config, PRE_KERNEL_1, &clock_control_gd32_api); diff --git a/drivers/clock_control/clock_control_ifx_cat1.c b/drivers/clock_control/clock_control_ifx_cat1.c index 606e06c4e467d..35ac17a8bb394 100644 --- a/drivers/clock_control/clock_control_ifx_cat1.c +++ b/drivers/clock_control/clock_control_ifx_cat1.c @@ -714,22 +714,20 @@ static const struct clock_control_driver_api clock_control_infineon_cat1_api = { }; #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_imo)) -DEVICE_DT_DEFINE(DT_NODELABEL(clk_imo), +DEVICE_INSTANCE(DT_NODELABEL(clk_imo), clock_control_infineon_cat1_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &clock_control_infineon_cat1_api); #endif #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(clk_iho)) -DEVICE_DT_DEFINE(DT_NODELABEL(clk_iho), +DEVICE_INSTANCE(DT_NODELABEL(clk_iho), clock_control_infineon_cat1_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &clock_control_infineon_cat1_api); #endif diff --git a/drivers/clock_control/clock_control_litex.c b/drivers/clock_control/clock_control_litex.c index 1d16db30a347a..213bd8a19758e 100644 --- a/drivers/clock_control/clock_control_litex.c +++ b/drivers/clock_control/clock_control_litex.c @@ -1792,6 +1792,6 @@ static const struct litex_clk_device ldev_init = { .nclkout = NCLKOUT }; -DEVICE_DT_DEFINE(DT_NODELABEL(clock0), litex_clk_init, NULL, +DEVICE_INSTANCE(DT_NODELABEL(clock0), litex_clk_init, NULL, NULL, &ldev_init, POST_KERNEL, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &litex_clk_api); + &litex_clk_api); diff --git a/drivers/clock_control/clock_control_lpc11u6x.c b/drivers/clock_control/clock_control_lpc11u6x.c index 554ec072d4da3..346c7f53158fa 100644 --- a/drivers/clock_control/clock_control_lpc11u6x.c +++ b/drivers/clock_control/clock_control_lpc11u6x.c @@ -354,9 +354,8 @@ static const struct lpc11u6x_syscon_config syscon_config = { static struct lpc11u6x_syscon_data syscon_data; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, lpc11u6x_syscon_init, NULL, &syscon_data, &syscon_config, - PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, - &lpc11u6x_clock_control_api); + PRE_KERNEL_1, &lpc11u6x_clock_control_api); diff --git a/drivers/clock_control/clock_control_max32.c b/drivers/clock_control/clock_control_max32.c index 29d7cc2fef424..c8c89605b92e4 100644 --- a/drivers/clock_control/clock_control_max32.c +++ b/drivers/clock_control/clock_control_max32.c @@ -154,5 +154,5 @@ static int max32_clkctrl_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, max32_clkctrl_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &max32_clkctrl_api); +DEVICE_INSTANCE_FROM_DT_INST(0, max32_clkctrl_init, NULL, NULL, NULL, PRE_KERNEL_1, + &max32_clkctrl_api); diff --git a/drivers/clock_control/clock_control_mchp_xec.c b/drivers/clock_control/clock_control_mchp_xec.c index 04e0286fdb9c6..f2d742566dc80 100644 --- a/drivers/clock_control/clock_control_mchp_xec.c +++ b/drivers/clock_control/clock_control_mchp_xec.c @@ -1089,10 +1089,9 @@ const struct xec_pcr_config pcr_xec_config = { .dis_internal_osc = (uint8_t)DT_INST_PROP_OR(0, internal_osc_disable, 0), }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, xec_clock_control_init, NULL, NULL, &pcr_xec_config, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &xec_clock_control_api); diff --git a/drivers/clock_control/clock_control_mcux_ccm.c b/drivers/clock_control/clock_control_mcux_ccm.c index 525125ea3ef9e..1c89f5875c25e 100644 --- a/drivers/clock_control/clock_control_mcux_ccm.c +++ b/drivers/clock_control/clock_control_mcux_ccm.c @@ -512,6 +512,5 @@ static int mcux_ccm_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, mcux_ccm_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, - &mcux_ccm_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, mcux_ccm_init, NULL, NULL, NULL, + PRE_KERNEL_1, &mcux_ccm_driver_api); diff --git a/drivers/clock_control/clock_control_mcux_ccm_rev2.c b/drivers/clock_control/clock_control_mcux_ccm_rev2.c index f0059a962405d..226811a1f56f9 100644 --- a/drivers/clock_control/clock_control_mcux_ccm_rev2.c +++ b/drivers/clock_control/clock_control_mcux_ccm_rev2.c @@ -308,6 +308,5 @@ static const struct clock_control_driver_api mcux_ccm_driver_api = { .set_rate = mcux_ccm_set_subsys_rate, }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1, &mcux_ccm_driver_api); diff --git a/drivers/clock_control/clock_control_mcux_mcg.c b/drivers/clock_control/clock_control_mcux_mcg.c index 110c3a601af86..28559e742d5f2 100644 --- a/drivers/clock_control/clock_control_mcux_mcg.c +++ b/drivers/clock_control/clock_control_mcux_mcg.c @@ -61,6 +61,5 @@ static const struct clock_control_driver_api mcux_mcg_driver_api = { .get_rate = mcux_mcg_get_rate, }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1, &mcux_mcg_driver_api); diff --git a/drivers/clock_control/clock_control_mcux_pcc.c b/drivers/clock_control/clock_control_mcux_pcc.c index 34740c1921360..1347816a6c10c 100644 --- a/drivers/clock_control/clock_control_mcux_pcc.c +++ b/drivers/clock_control/clock_control_mcux_pcc.c @@ -142,12 +142,11 @@ static uint32_t clocks[] = {}; .clock_num = ARRAY_SIZE(clocks), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ mcux_pcc_init, \ NULL, \ NULL, &mcux_pcc##inst##_config, \ PRE_KERNEL_1, \ - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, \ &mcux_pcc_api); DT_INST_FOREACH_STATUS_OKAY(MCUX_PCC_INIT) diff --git a/drivers/clock_control/clock_control_mcux_scg.c b/drivers/clock_control/clock_control_mcux_scg.c index 684cb8f2aa21c..533afaa4dfafc 100644 --- a/drivers/clock_control/clock_control_mcux_scg.c +++ b/drivers/clock_control/clock_control_mcux_scg.c @@ -150,9 +150,8 @@ static const struct clock_control_driver_api mcux_scg_driver_api = { .get_rate = mcux_scg_get_rate, }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, mcux_scg_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, - &mcux_scg_driver_api); + PRE_KERNEL_1, &mcux_scg_driver_api); diff --git a/drivers/clock_control/clock_control_mcux_scg_k4.c b/drivers/clock_control/clock_control_mcux_scg_k4.c index 7b9df3fe9e617..55e4b8f187d18 100644 --- a/drivers/clock_control/clock_control_mcux_scg_k4.c +++ b/drivers/clock_control/clock_control_mcux_scg_k4.c @@ -79,5 +79,5 @@ static const struct clock_control_driver_api mcux_scg_driver_api = { .get_rate = mcux_scg_k4_get_rate, }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &mcux_scg_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1, + &mcux_scg_driver_api); diff --git a/drivers/clock_control/clock_control_mcux_sim.c b/drivers/clock_control/clock_control_mcux_sim.c index 2b16e5d6361b8..72c2c7a5842dc 100644 --- a/drivers/clock_control/clock_control_mcux_sim.c +++ b/drivers/clock_control/clock_control_mcux_sim.c @@ -109,9 +109,8 @@ static const struct clock_control_driver_api mcux_sim_driver_api = { .get_rate = mcux_sim_get_subsys_rate, }; -DEVICE_DT_DEFINE(NXP_KINETIS_SIM_NODE, +DEVICE_INSTANCE(NXP_KINETIS_SIM_NODE, mcux_sim_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, - &mcux_sim_driver_api); + PRE_KERNEL_1, &mcux_sim_driver_api); diff --git a/drivers/clock_control/clock_control_mcux_syscon.c b/drivers/clock_control/clock_control_mcux_syscon.c index 3229c7a9ecc7a..0b4d91b013d17 100644 --- a/drivers/clock_control/clock_control_mcux_syscon.c +++ b/drivers/clock_control/clock_control_mcux_syscon.c @@ -495,7 +495,7 @@ static const struct clock_control_driver_api mcux_lpc_syscon_api = { #define LPC_CLOCK_INIT(n) \ \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, PRE_KERNEL_1, \ - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &mcux_lpc_syscon_api); + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, NULL, NULL, PRE_KERNEL_1, \ + &mcux_lpc_syscon_api); DT_INST_FOREACH_STATUS_OKAY(LPC_CLOCK_INIT) diff --git a/drivers/clock_control/clock_control_npcm.c b/drivers/clock_control/clock_control_npcm.c index ffe1ba8b47995..e5221538023bb 100644 --- a/drivers/clock_control/clock_control_npcm.c +++ b/drivers/clock_control/clock_control_npcm.c @@ -361,5 +361,5 @@ const struct npcm_pcc_config pcc_config = { .base_pmc = DT_INST_REG_ADDR_BY_NAME(0, pmc), }; -DEVICE_DT_INST_DEFINE(0, &npcm_clock_control_init, NULL, NULL, &pcc_config, PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_OBJECTS, &npcm_clock_control_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &npcm_clock_control_init, NULL, NULL, &pcc_config, PRE_KERNEL_1, + &npcm_clock_control_api); diff --git a/drivers/clock_control/clock_control_npcx.c b/drivers/clock_control/clock_control_npcx.c index 0a8b6f0e10f9d..fd8e39d7157d1 100644 --- a/drivers/clock_control/clock_control_npcx.c +++ b/drivers/clock_control/clock_control_npcx.c @@ -259,10 +259,9 @@ const struct npcx_pcc_config pcc_config = { .base_pmc = DT_INST_REG_ADDR_BY_NAME(0, pmc), }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, npcx_clock_control_init, NULL, NULL, &pcc_config, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &npcx_clock_control_api); diff --git a/drivers/clock_control/clock_control_nrf.c b/drivers/clock_control/clock_control_nrf.c index a9b1129f9a345..2aba27aeb2f9f 100644 --- a/drivers/clock_control/clock_control_nrf.c +++ b/drivers/clock_control/clock_control_nrf.c @@ -730,10 +730,9 @@ static const struct nrf_clock_control_config config = { } }; -DEVICE_DT_DEFINE(DT_NODELABEL(clock), clk_init, NULL, +DEVICE_INSTANCE(DT_NODELABEL(clock), clk_init, NULL, &data, &config, - PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, - &clock_control_api); + PRE_KERNEL_1, &clock_control_api); #if defined(CONFIG_SHELL) diff --git a/drivers/clock_control/clock_control_nrf2_fll16m.c b/drivers/clock_control/clock_control_nrf2_fll16m.c index 613e433e52749..1ccfda14e1f25 100644 --- a/drivers/clock_control/clock_control_nrf2_fll16m.c +++ b/drivers/clock_control/clock_control_nrf2_fll16m.c @@ -256,7 +256,6 @@ static const struct fll16m_dev_config fll16m_config = { .fixed_frequency = DT_INST_PROP(0, clock_frequency), }; -DEVICE_DT_INST_DEFINE(0, fll16m_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, fll16m_init, NULL, &fll16m_data, &fll16m_config, - PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, - &fll16m_drv_api); + PRE_KERNEL_1, &fll16m_drv_api); diff --git a/drivers/clock_control/clock_control_nrf2_hfxo.c b/drivers/clock_control/clock_control_nrf2_hfxo.c index 977c0aaa0d680..042938e48438e 100644 --- a/drivers/clock_control/clock_control_nrf2_hfxo.c +++ b/drivers/clock_control/clock_control_nrf2_hfxo.c @@ -190,7 +190,6 @@ static const struct dev_config_hfxo config_hfxo = { .start_up_time = K_USEC(DT_INST_PROP(0, startup_time_us)), }; -DEVICE_DT_INST_DEFINE(0, init_hfxo, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, init_hfxo, NULL, &data_hfxo, &config_hfxo, - PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, - &drv_api_hfxo); + PRE_KERNEL_1, &drv_api_hfxo); diff --git a/drivers/clock_control/clock_control_nrf2_hsfll.c b/drivers/clock_control/clock_control_nrf2_hsfll.c index 026edf9abbd58..ed3339091aeff 100644 --- a/drivers/clock_control/clock_control_nrf2_hsfll.c +++ b/drivers/clock_control/clock_control_nrf2_hsfll.c @@ -232,10 +232,10 @@ static struct nrf_clock_control_driver_api hsfll_drv_api = { static struct hsfll_dev_data hsfll_data; #endif -DEVICE_DT_INST_DEFINE(0, hsfll_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, hsfll_init, NULL, COND_CODE_1(CONFIG_NRFS_DVFS_LOCAL_DOMAIN, (&hsfll_data), (NULL)), NULL, - PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, + PRE_KERNEL_1, &hsfll_drv_api); diff --git a/drivers/clock_control/clock_control_nrf2_lfclk.c b/drivers/clock_control/clock_control_nrf2_lfclk.c index 36b8e2472977b..b5695bbe76b86 100644 --- a/drivers/clock_control/clock_control_nrf2_lfclk.c +++ b/drivers/clock_control/clock_control_nrf2_lfclk.c @@ -258,7 +258,6 @@ static const struct lfclk_dev_config lfclk_config = { .fixed_frequency = DT_INST_PROP(0, clock_frequency), }; -DEVICE_DT_INST_DEFINE(0, lfclk_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, lfclk_init, NULL, &lfclk_data, &lfclk_config, - PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, - &lfclk_drv_api); + PRE_KERNEL_1, &lfclk_drv_api); diff --git a/drivers/clock_control/clock_control_nrf_auxpll.c b/drivers/clock_control/clock_control_nrf_auxpll.c index e313b5c056046..d867025c68fbe 100644 --- a/drivers/clock_control/clock_control_nrf_auxpll.c +++ b/drivers/clock_control/clock_control_nrf_auxpll.c @@ -141,8 +141,7 @@ static int clock_control_nrf_auxpll_init(const struct device *dev) .out_div = DT_INST_PROP(n, nordic_out_div), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, clock_control_nrf_auxpll_init, NULL, NULL, &config##n, \ - PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, \ - &clock_control_nrf_auxpll_api); + DEVICE_INSTANCE_FROM_DT_INST(n, clock_control_nrf_auxpll_init, NULL, NULL, &config##n, \ + PRE_KERNEL_1, &clock_control_nrf_auxpll_api); DT_INST_FOREACH_STATUS_OKAY(CLOCK_CONTROL_NRF_AUXPLL_DEFINE) diff --git a/drivers/clock_control/clock_control_numaker_scc.c b/drivers/clock_control/clock_control_numaker_scc.c index 8f1092ad85fc4..6883c3c8a99b2 100644 --- a/drivers/clock_control/clock_control_numaker_scc.c +++ b/drivers/clock_control/clock_control_numaker_scc.c @@ -156,7 +156,7 @@ static int numaker_scc_init(const struct device *dev) .core_clock = DT_INST_PROP_OR(inst, core_clock, 0), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, numaker_scc_init, NULL, NULL, &numaker_scc_config_##inst, \ - PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &numaker_scc_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, numaker_scc_init, NULL, NULL, &numaker_scc_config_##inst,\ + PRE_KERNEL_1, &numaker_scc_api); DT_INST_FOREACH_STATUS_OKAY(NUMICRO_SCC_INIT); diff --git a/drivers/clock_control/clock_control_nxp_s32.c b/drivers/clock_control/clock_control_nxp_s32.c index 89e9c67cc5c2d..3898eaded6e94 100644 --- a/drivers/clock_control/clock_control_nxp_s32.c +++ b/drivers/clock_control/clock_control_nxp_s32.c @@ -73,8 +73,7 @@ static const struct clock_control_driver_api nxp_s32_clock_driver_api = { .get_rate = nxp_s32_clock_get_rate, }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, nxp_s32_clock_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, - &nxp_s32_clock_driver_api); + PRE_KERNEL_1, &nxp_s32_clock_driver_api); diff --git a/drivers/clock_control/clock_control_pwm.c b/drivers/clock_control/clock_control_pwm.c index 92bcd31c91fe2..473276912b45a 100644 --- a/drivers/clock_control/clock_control_pwm.c +++ b/drivers/clock_control/clock_control_pwm.c @@ -152,8 +152,8 @@ static const struct clock_control_driver_api clock_control_pwm_api = { .clock_frequency = DT_INST_PROP_OR(i, clock_frequency, 0), \ }; \ \ - DEVICE_DT_INST_DEFINE(i, clock_control_pwm_init, NULL, &clock_control_pwm_data_##i, \ + DEVICE_INSTANCE_FROM_DT_INST(i, clock_control_pwm_init, NULL, &clock_control_pwm_data_##i, \ &clock_control_pwm_config_##i, POST_KERNEL, \ - CONFIG_CLOCK_CONTROL_PWM_INIT_PRIORITY, &clock_control_pwm_api); + &clock_control_pwm_api); DT_INST_FOREACH_STATUS_OKAY(PWM_CLOCK_INIT) diff --git a/drivers/clock_control/clock_control_r8a7795_cpg_mssr.c b/drivers/clock_control/clock_control_r8a7795_cpg_mssr.c index a796c6efc6c53..8ddf24f0e0580 100644 --- a/drivers/clock_control/clock_control_r8a7795_cpg_mssr.c +++ b/drivers/clock_control/clock_control_r8a7795_cpg_mssr.c @@ -284,13 +284,12 @@ static const struct clock_control_driver_api r8a7795_cpg_mssr_api = { .cmn.set_rate_helper = r8a7795_set_rate_helper \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ r8a7795_cpg_mssr_init, \ NULL, \ &r8a7795_cpg_mssr##inst##_data, \ &r8a7795_cpg_mssr##inst##_config, \ PRE_KERNEL_1, \ - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, \ &r8a7795_cpg_mssr_api); DT_INST_FOREACH_STATUS_OKAY(R8A7795_MSSR_INIT) diff --git a/drivers/clock_control/clock_control_r8a779f0_cpg_mssr.c b/drivers/clock_control/clock_control_r8a779f0_cpg_mssr.c index ce7568a89f373..93d651f66d2e6 100644 --- a/drivers/clock_control/clock_control_r8a779f0_cpg_mssr.c +++ b/drivers/clock_control/clock_control_r8a779f0_cpg_mssr.c @@ -275,13 +275,12 @@ static const struct clock_control_driver_api r8a779f0_cpg_mssr_api = { .cmn.set_rate_helper = r8a779f0_set_rate_helper \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &r8a779f0_cpg_mssr_init, \ NULL, \ &cpg_mssr##inst##_data, \ &cpg_mssr##inst##_cfg, \ PRE_KERNEL_1, \ - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, \ &r8a779f0_cpg_mssr_api); DT_INST_FOREACH_STATUS_OKAY(R8A779F0_MSSR_INIT) diff --git a/drivers/clock_control/clock_control_renesas_ra_cgc.c b/drivers/clock_control/clock_control_renesas_ra_cgc.c index 4ed4bb30daaa2..33d3b04ebb03d 100644 --- a/drivers/clock_control/clock_control_renesas_ra_cgc.c +++ b/drivers/clock_control/clock_control_renesas_ra_cgc.c @@ -95,12 +95,11 @@ static const struct clock_control_driver_api clock_control_reneas_ra_api = { (RA_CGC_CLK_SRC(DT_CLOCKS_CTLR(node_id))), \ (RA_CGC_CLK_SRC(DT_CLOCKS_CTLR(DT_PARENT(node_id))))), \ .clk_div = DT_PROP(node_id, div)}; \ - DEVICE_DT_DEFINE(node_id, &clock_control_ra_init_pclk, NULL, NULL, \ + DEVICE_INSTANCE(node_id, &clock_control_ra_init_pclk, NULL, NULL, \ &node_id##_cfg, PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_OBJECTS, \ &clock_control_reneas_ra_api))); -DEVICE_DT_DEFINE(DT_NODELABEL(pclkblock), &clock_control_ra_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_OBJECTS, NULL); +DEVICE_INSTANCE(DT_NODELABEL(pclkblock), &clock_control_ra_init, NULL, NULL, NULL, PRE_KERNEL_1, + NULL); DT_FOREACH_CHILD_STATUS_OKAY(DT_NODELABEL(pclkblock), INIT_PCLK); diff --git a/drivers/clock_control/clock_control_rpi_pico.c b/drivers/clock_control/clock_control_rpi_pico.c index e7f058ee32b50..34401274de0c4 100644 --- a/drivers/clock_control/clock_control_rpi_pico.c +++ b/drivers/clock_control/clock_control_rpi_pico.c @@ -896,6 +896,6 @@ static struct clock_control_rpi_pico_data clock_control_rpi_pico_data = { .rosc_ph_freq = CLOCK_FREQ(rosc_ph), }; -DEVICE_DT_INST_DEFINE(0, clock_control_rpi_pico_init, NULL, &clock_control_rpi_pico_data, +DEVICE_INSTANCE_FROM_DT_INST(0, clock_control_rpi_pico_init, NULL, &clock_control_rpi_pico_data, &clock_control_rpi_pico_config, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &clock_control_rpi_pico_api); + &clock_control_rpi_pico_api); diff --git a/drivers/clock_control/clock_control_rv32m1_pcc.c b/drivers/clock_control/clock_control_rv32m1_pcc.c index 9d22b9efae0d7..a2dbe8f86359f 100644 --- a/drivers/clock_control/clock_control_rv32m1_pcc.c +++ b/drivers/clock_control/clock_control_rv32m1_pcc.c @@ -62,12 +62,11 @@ static const struct clock_control_driver_api rv32m1_pcc_api = { .base_address = DT_INST_REG_ADDR(inst) \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ NULL, \ NULL, \ NULL, &rv32m1_pcc##inst##_config, \ PRE_KERNEL_1, \ - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, \ &rv32m1_pcc_api); DT_INST_FOREACH_STATUS_OKAY(RV32M1_PCC_INIT) diff --git a/drivers/clock_control/clock_control_sam_pmc.c b/drivers/clock_control/clock_control_sam_pmc.c index 6c43e142a9cf6..3d60b3cdb7099 100644 --- a/drivers/clock_control/clock_control_sam_pmc.c +++ b/drivers/clock_control/clock_control_sam_pmc.c @@ -136,6 +136,5 @@ static const struct clock_control_driver_api atmel_sam_clock_control_api = { .get_status = atmel_sam_clock_control_get_status, }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1, &atmel_sam_clock_control_api); diff --git a/drivers/clock_control/clock_control_si32_ahb.c b/drivers/clock_control/clock_control_si32_ahb.c index aa1f90aef74bd..72c82c19a2566 100644 --- a/drivers/clock_control/clock_control_si32_ahb.c +++ b/drivers/clock_control/clock_control_si32_ahb.c @@ -99,5 +99,5 @@ static const struct clock_control_si32_ahb_config config = { .freq = DT_PROP(DT_PATH(cpus, cpu_0), clock_frequency), }; -DEVICE_DT_INST_DEFINE(0, clock_control_si32_ahb_init, NULL, NULL, &config, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &clock_control_si32_ahb_api); +DEVICE_INSTANCE_FROM_DT_INST(0, clock_control_si32_ahb_init, NULL, NULL, &config, PRE_KERNEL_1, + &clock_control_si32_ahb_api); diff --git a/drivers/clock_control/clock_control_si32_apb.c b/drivers/clock_control/clock_control_si32_apb.c index d66adfed4ec4b..342af857071d0 100644 --- a/drivers/clock_control/clock_control_si32_apb.c +++ b/drivers/clock_control/clock_control_si32_apb.c @@ -76,5 +76,5 @@ static const struct clock_control_si32_apb_config config = { .divider = DT_PROP(DT_NODELABEL(clk_apb), divider), }; -DEVICE_DT_INST_DEFINE(0, clock_control_si32_apb_init, NULL, NULL, &config, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &clock_control_si32_apb_api); +DEVICE_INSTANCE_FROM_DT_INST(0, clock_control_si32_apb_init, NULL, NULL, &config, PRE_KERNEL_1, + &clock_control_si32_apb_api); diff --git a/drivers/clock_control/clock_control_si32_pll.c b/drivers/clock_control/clock_control_si32_pll.c index 913420d32661a..bc0bc3b5b9824 100644 --- a/drivers/clock_control/clock_control_si32_pll.c +++ b/drivers/clock_control/clock_control_si32_pll.c @@ -135,5 +135,5 @@ static struct clock_control_si32_pll_data data = { .freq = 0, }; -DEVICE_DT_INST_DEFINE(0, clock_control_si32_pll_init, NULL, &data, &config, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &clock_control_si32_pll_api); +DEVICE_INSTANCE_FROM_DT_INST(0, clock_control_si32_pll_init, NULL, &data, &config, PRE_KERNEL_1, + &clock_control_si32_pll_api); diff --git a/drivers/clock_control/clock_control_silabs_series.c b/drivers/clock_control/clock_control_silabs_series.c index 90498c246e04b..fb23efcafd427 100644 --- a/drivers/clock_control/clock_control_silabs_series.c +++ b/drivers/clock_control/clock_control_silabs_series.c @@ -123,5 +123,5 @@ static const struct silabs_clock_control_config silabs_clock_control_config = { .cmu = (CMU_TypeDef *)DT_INST_REG_ADDR(0), }; -DEVICE_DT_INST_DEFINE(0, silabs_clock_control_init, NULL, NULL, &silabs_clock_control_config, - PRE_KERNEL_1, CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &silabs_clock_control_api); +DEVICE_INSTANCE_FROM_DT_INST(0, silabs_clock_control_init, NULL, NULL, &silabs_clock_control_config, + PRE_KERNEL_1, &silabs_clock_control_api); diff --git a/drivers/clock_control/clock_control_smartbond.c b/drivers/clock_control/clock_control_smartbond.c index 3d866fb4c5820..36c8dc42ee118 100644 --- a/drivers/clock_control/clock_control_smartbond.c +++ b/drivers/clock_control/clock_control_smartbond.c @@ -636,10 +636,9 @@ static int smartbond_clocks_pm_action(const struct device *dev, enum pm_device_a PM_DEVICE_DT_DEFINE(DT_NODELABEL(osc), smartbond_clocks_pm_action); -DEVICE_DT_DEFINE(DT_NODELABEL(osc), +DEVICE_INSTANCE(DT_NODELABEL(osc), smartbond_clocks_init, PM_DEVICE_DT_GET(DT_NODELABEL(osc)), NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &smartbond_clock_control_api); diff --git a/drivers/clock_control/clock_control_wch_rcc.c b/drivers/clock_control/clock_control_wch_rcc.c index 95bc004bd5e0b..b23b3782c4ace 100644 --- a/drivers/clock_control/clock_control_wch_rcc.c +++ b/drivers/clock_control/clock_control_wch_rcc.c @@ -147,8 +147,8 @@ static int clock_control_wch_rcc_init(const struct device *dev) static const struct clock_control_wch_rcc_config clock_control_wch_rcc_##idx##_config = { \ .regs = (RCC_TypeDef *)DT_INST_REG_ADDR(idx), \ }; \ - DEVICE_DT_INST_DEFINE(idx, clock_control_wch_rcc_init, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, clock_control_wch_rcc_init, NULL, NULL, \ &clock_control_wch_rcc_##idx##_config, PRE_KERNEL_1, \ - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &clock_control_wch_rcc_api); + &clock_control_wch_rcc_api); DT_INST_FOREACH_STATUS_OKAY(CLOCK_CONTROL_WCH_RCC_INIT) diff --git a/drivers/clock_control/clock_stm32_ll_common.c b/drivers/clock_control/clock_stm32_ll_common.c index f1f8b7436fca2..6ae42b4abb7db 100644 --- a/drivers/clock_control/clock_stm32_ll_common.c +++ b/drivers/clock_control/clock_stm32_ll_common.c @@ -891,10 +891,9 @@ void __weak config_regulator_voltage(uint32_t hclk_freq) {} * @brief RCC device, note that priority is intentionally set to 1 so * that the device init runs just after SOC init */ -DEVICE_DT_DEFINE(DT_NODELABEL(rcc), +DEVICE_INSTANCE(DT_NODELABEL(rcc), stm32_clock_control_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &stm32_clock_control_api); diff --git a/drivers/clock_control/clock_stm32_ll_h5.c b/drivers/clock_control/clock_stm32_ll_h5.c index 7994db07f95c8..688a5da3274a2 100644 --- a/drivers/clock_control/clock_stm32_ll_h5.c +++ b/drivers/clock_control/clock_stm32_ll_h5.c @@ -779,10 +779,9 @@ int stm32_clock_control_init(const struct device *dev) * @brief RCC device, note that priority is intentionally set to 1 so * that the device init runs just after SOC init */ -DEVICE_DT_DEFINE(DT_NODELABEL(rcc), +DEVICE_INSTANCE(DT_NODELABEL(rcc), stm32_clock_control_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &stm32_clock_control_api); diff --git a/drivers/clock_control/clock_stm32_ll_h7.c b/drivers/clock_control/clock_stm32_ll_h7.c index 8c1cc884dd3b9..edfc5544a3d2c 100644 --- a/drivers/clock_control/clock_stm32_ll_h7.c +++ b/drivers/clock_control/clock_stm32_ll_h7.c @@ -1196,10 +1196,9 @@ void HAL_RCC_CSSCallback(void) * @brief RCC device, note that priority is intentionally set to 1 so * that the device init runs just after SOC init */ -DEVICE_DT_DEFINE(DT_NODELABEL(rcc), +DEVICE_INSTANCE(DT_NODELABEL(rcc), stm32_clock_control_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &stm32_clock_control_api); diff --git a/drivers/clock_control/clock_stm32_ll_mp1.c b/drivers/clock_control/clock_stm32_ll_mp1.c index 261ca94da1806..d8b7c1215e269 100644 --- a/drivers/clock_control/clock_stm32_ll_mp1.c +++ b/drivers/clock_control/clock_stm32_ll_mp1.c @@ -409,10 +409,9 @@ static int stm32_clock_control_init(const struct device *dev) * @brief RCC device, note that priority is intentionally set to 1 so * that the device init runs just after SOC init */ -DEVICE_DT_DEFINE(DT_NODELABEL(rcc), +DEVICE_INSTANCE(DT_NODELABEL(rcc), stm32_clock_control_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &stm32_clock_control_api); diff --git a/drivers/clock_control/clock_stm32_ll_u5.c b/drivers/clock_control/clock_stm32_ll_u5.c index ad22fd84ec4aa..cad52161c912a 100644 --- a/drivers/clock_control/clock_stm32_ll_u5.c +++ b/drivers/clock_control/clock_stm32_ll_u5.c @@ -914,10 +914,9 @@ int stm32_clock_control_init(const struct device *dev) * @brief RCC device, note that priority is intentionally set to 1 so * that the device init runs just after SOC init */ -DEVICE_DT_DEFINE(DT_NODELABEL(rcc), +DEVICE_INSTANCE(DT_NODELABEL(rcc), stm32_clock_control_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &stm32_clock_control_api); diff --git a/drivers/clock_control/clock_stm32_ll_wb0.c b/drivers/clock_control/clock_stm32_ll_wb0.c index 3a08cf64067b7..c1c0667896c78 100644 --- a/drivers/clock_control/clock_stm32_ll_wb0.c +++ b/drivers/clock_control/clock_stm32_ll_wb0.c @@ -784,9 +784,8 @@ BUILD_ASSERT(IS_ENABLED(STM32_HSE_ENABLED), * Note that priority is intentionally set to 1, * so that RCC init runs just after SoC init. */ -DEVICE_DT_DEFINE(STM32_CLOCK_CONTROL_NODE, +DEVICE_INSTANCE(STM32_CLOCK_CONTROL_NODE, &stm32_clock_control_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &stm32_clock_control_api); diff --git a/drivers/clock_control/clock_stm32_ll_wba.c b/drivers/clock_control/clock_stm32_ll_wba.c index 665c61a12837b..aa9e1f9030714 100644 --- a/drivers/clock_control/clock_stm32_ll_wba.c +++ b/drivers/clock_control/clock_stm32_ll_wba.c @@ -618,10 +618,9 @@ int stm32_clock_control_init(const struct device *dev) * @brief RCC device, note that priority is intentionally set to 1 so * that the device init runs just after SOC init */ -DEVICE_DT_DEFINE(DT_NODELABEL(rcc), +DEVICE_INSTANCE(DT_NODELABEL(rcc), stm32_clock_control_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_CLOCK_CONTROL_INIT_PRIORITY, &stm32_clock_control_api); diff --git a/drivers/clock_control/clock_stm32_mco.c b/drivers/clock_control/clock_stm32_mco.c index 0e8d6faec2661..4ceab6310e7c3 100644 --- a/drivers/clock_control/clock_stm32_mco.c +++ b/drivers/clock_control/clock_stm32_mco.c @@ -75,10 +75,9 @@ const static struct stm32_mco_config stm32_mco_config_##inst = { \ (.prescaler = DT_PROP(DT_DRV_INST(inst), prescaler),)) \ }; \ \ -DEVICE_DT_INST_DEFINE(inst, stm32_mco_init, NULL, \ +DEVICE_INSTANCE_FROM_DT_INST(inst, stm32_mco_init, NULL, \ NULL, \ &stm32_mco_config_##inst, \ - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - NULL); + PRE_KERNEL_1, NULL); DT_INST_FOREACH_STATUS_OKAY(STM32_MCO_INIT); diff --git a/drivers/clock_control/clock_stm32_mux.c b/drivers/clock_control/clock_stm32_mux.c index 2616c0e2750d1..c9a306a361f70 100644 --- a/drivers/clock_control/clock_stm32_mux.c +++ b/drivers/clock_control/clock_stm32_mux.c @@ -40,9 +40,8 @@ static const struct stm32_clk_mux_config stm32_clk_mux_cfg_##id = { \ .pclken = STM32_CLOCK_INFO(0, DT_DRV_INST(id)) \ }; \ \ -DEVICE_DT_INST_DEFINE(id, stm32_clk_mux_init, NULL, \ +DEVICE_INSTANCE_FROM_DT_INST(id, stm32_clk_mux_init, NULL, \ NULL, &stm32_clk_mux_cfg_##id, \ - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_OBJECTS,\ - NULL); + PRE_KERNEL_1, NULL); DT_INST_FOREACH_STATUS_OKAY(STM32_MUX_CLK_INIT) diff --git a/drivers/comparator/comparator_fake_comp.c b/drivers/comparator/comparator_fake_comp.c index 85abbad21743e..051bf626c1f83 100644 --- a/drivers/comparator/comparator_fake_comp.c +++ b/drivers/comparator/comparator_fake_comp.c @@ -53,13 +53,12 @@ static void fake_comp_reset_rule_before(const struct ztest_unit_test *test, void ZTEST_RULE(comp_fake_comp_reset_rule, fake_comp_reset_rule_before, NULL); #endif -DEVICE_DT_INST_DEFINE( +DEVICE_INSTANCE_FROM_DT_INST( 0, NULL, NULL, NULL, NULL, POST_KERNEL, - CONFIG_COMPARATOR_INIT_PRIORITY, &fake_comp_api ); diff --git a/drivers/comparator/comparator_nrf_comp.c b/drivers/comparator/comparator_nrf_comp.c index 383b852fc33fa..5825a98ac70b6 100644 --- a/drivers/comparator/comparator_nrf_comp.c +++ b/drivers/comparator/comparator_nrf_comp.c @@ -754,11 +754,10 @@ static int shim_nrf_comp_init(const struct device *dev) PM_DEVICE_DT_INST_DEFINE(0, shim_nrf_comp_pm_callback); -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, shim_nrf_comp_init, PM_DEVICE_DT_INST_GET(0), NULL, NULL, POST_KERNEL, - CONFIG_COMPARATOR_INIT_PRIORITY, &shim_nrf_comp_api); diff --git a/drivers/comparator/comparator_nrf_lpcomp.c b/drivers/comparator/comparator_nrf_lpcomp.c index cfb64bccf2754..7bcd9046a0299 100644 --- a/drivers/comparator/comparator_nrf_lpcomp.c +++ b/drivers/comparator/comparator_nrf_lpcomp.c @@ -481,11 +481,10 @@ static int shim_nrf_lpcomp_init(const struct device *dev) PM_DEVICE_DT_INST_DEFINE(0, shim_nrf_lpcomp_pm_callback); -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, shim_nrf_lpcomp_init, PM_DEVICE_DT_INST_GET(0), NULL, NULL, POST_KERNEL, - CONFIG_COMPARATOR_INIT_PRIORITY, &shim_nrf_lpcomp_api); diff --git a/drivers/coredump/coredump_impl.c b/drivers/coredump/coredump_impl.c index 7694620da3fe5..bb02e4b2a5b09 100644 --- a/drivers/coredump/coredump_impl.c +++ b/drivers/coredump/coredump_impl.c @@ -172,13 +172,12 @@ static const struct coredump_driver_api coredump_api = { .length = 0, \ )) \ }; \ - DEVICE_DT_INST_DEFINE(n, \ - coredump_init, \ - NULL, \ - &coredump_data_##n, \ - &coredump_config##n, \ - PRE_KERNEL_1, \ - CONFIG_COREDUMP_DEVICE_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ + coredump_init, \ + NULL, \ + &coredump_data_##n,\ + &coredump_config##n,\ + PRE_KERNEL_1, \ &coredump_api); DT_INST_FOREACH_STATUS_OKAY(CREATE_COREDUMP_DEVICE) diff --git a/drivers/counter/counter_ace_v1x_art.c b/drivers/counter/counter_ace_v1x_art.c index 7073275d0acfa..c2fb439b00d6c 100644 --- a/drivers/counter/counter_ace_v1x_art.c +++ b/drivers/counter/counter_ace_v1x_art.c @@ -106,6 +106,5 @@ static const struct counter_driver_api ace_v1x_art_counter_apis = { .get_value_64 = counter_ace_v1x_art_get_value }; -DEVICE_DT_DEFINE(DT_NODELABEL(ace_art_counter), NULL, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &ace_v1x_art_counter_apis); +DEVICE_INSTANCE(DT_NODELABEL(ace_art_counter), NULL, NULL, NULL, NULL, + PRE_KERNEL_1, &ace_v1x_art_counter_apis); diff --git a/drivers/counter/counter_ace_v1x_rtc.c b/drivers/counter/counter_ace_v1x_rtc.c index 1ce2d82cf074b..97579ffbc52bb 100644 --- a/drivers/counter/counter_ace_v1x_rtc.c +++ b/drivers/counter/counter_ace_v1x_rtc.c @@ -39,6 +39,5 @@ static const struct counter_driver_api ace_v1x_rtc_counter_apis = { .get_value_64 = counter_ace_v1x_rtc_get_value }; -DEVICE_DT_DEFINE(DT_NODELABEL(ace_rtc_counter), counter_ace_v1x_rtc_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &ace_v1x_rtc_counter_apis); +DEVICE_INSTANCE(DT_NODELABEL(ace_rtc_counter), counter_ace_v1x_rtc_init, NULL, NULL, NULL, + PRE_KERNEL_1, &ace_v1x_rtc_counter_apis); diff --git a/drivers/counter/counter_ambiq_timer.c b/drivers/counter/counter_ambiq_timer.c index 2036102138dd1..2ec0e3db8c4df 100644 --- a/drivers/counter/counter_ambiq_timer.c +++ b/drivers/counter/counter_ambiq_timer.c @@ -304,7 +304,6 @@ static void counter_ambiq_isr(void *arg) .irq_config_func = counter_irq_config_func_##idx, \ }; \ AMBIQ_COUNTER_CONFIG_FUNC(idx) \ - DEVICE_DT_INST_DEFINE(idx, counter_ambiq_init, NULL, &counter_data_##idx, \ - &counter_config_##idx, PRE_KERNEL_1, CONFIG_COUNTER_INIT_PRIORITY, \ - &counter_api); + DEVICE_INSTANCE_FROM_DT_INST(idx, counter_ambiq_init, NULL, &counter_data_##idx, \ + &counter_config_##idx, PRE_KERNEL_1, &counter_api); DT_INST_FOREACH_STATUS_OKAY(AMBIQ_COUNTER_INIT); diff --git a/drivers/counter/counter_andes_atcpit100.c b/drivers/counter/counter_andes_atcpit100.c index 3fc69215f60cc..2b1ac37c1c737 100644 --- a/drivers/counter/counter_andes_atcpit100.c +++ b/drivers/counter/counter_andes_atcpit100.c @@ -494,13 +494,12 @@ static const struct counter_driver_api atcpit100_driver_api = { .cfg_func = counter_atcpit100_cfg_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ counter_atcpit100_init, \ NULL, \ &atcpit100_data_##n, \ &atcpit100_config_##n, \ PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ &atcpit100_driver_api); \ \ static void counter_atcpit100_cfg_##n(void) \ diff --git a/drivers/counter/counter_cmos.c b/drivers/counter/counter_cmos.c index 3edd718b9fecd..d083f12ebea1c 100644 --- a/drivers/counter/counter_cmos.c +++ b/drivers/counter/counter_cmos.c @@ -203,5 +203,5 @@ static const struct counter_driver_api api = { .get_value = get_value }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, &info, POST_KERNEL, - CONFIG_COUNTER_INIT_PRIORITY, &api); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, &info, POST_KERNEL, + &api); diff --git a/drivers/counter/counter_dw_timer.c b/drivers/counter/counter_dw_timer.c index 74a456de483b4..ff5db887af46c 100644 --- a/drivers/counter/counter_dw_timer.c +++ b/drivers/counter/counter_dw_timer.c @@ -385,11 +385,10 @@ static int counter_dw_timer_init(const struct device *timer_dev) (DW_SNPS_TIMER_SNPS_RESET_SPEC_INIT(inst))) \ .irq_config = counter_dw_timer_irq_config_##inst, \ }; \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ counter_dw_timer_init, \ NULL, &timer_data_##inst, \ &timer_config_##inst, POST_KERNEL, \ - CONFIG_COUNTER_INIT_PRIORITY, \ &dw_timer_driver_api); \ static void counter_dw_timer_irq_config_##inst(void) \ { \ diff --git a/drivers/counter/counter_esp32_rtc.c b/drivers/counter/counter_esp32_rtc.c index 71544ed8b7a32..fa5adcd522e29 100644 --- a/drivers/counter/counter_esp32_rtc.c +++ b/drivers/counter/counter_esp32_rtc.c @@ -241,11 +241,10 @@ static void counter_esp32_isr(void *arg) } } -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, &counter_esp32_init, NULL, &counter_data, &counter_config, POST_KERNEL, - CONFIG_COUNTER_INIT_PRIORITY, &rtc_timer_esp32_api); diff --git a/drivers/counter/counter_esp32_tmr.c b/drivers/counter/counter_esp32_tmr.c index 34ddec926174d..a1fca91be636a 100644 --- a/drivers/counter/counter_esp32_tmr.c +++ b/drivers/counter/counter_esp32_tmr.c @@ -291,8 +291,7 @@ static void counter_esp32_isr(void *arg) .irq_priority = DT_INST_IRQ_BY_IDX(idx, 0, priority), \ .irq_flags = DT_INST_IRQ_BY_IDX(idx, 0, flags)}; \ \ - DEVICE_DT_INST_DEFINE(idx, counter_esp32_init, NULL, &counter_data_##idx, \ - &counter_config_##idx, PRE_KERNEL_1, CONFIG_COUNTER_INIT_PRIORITY, \ - &counter_api); + DEVICE_INSTANCE_FROM_DT_INST(idx, counter_esp32_init, NULL, &counter_data_##idx, \ + &counter_config_##idx, PRE_KERNEL_1, &counter_api); DT_INST_FOREACH_STATUS_OKAY(ESP32_COUNTER_INIT); diff --git a/drivers/counter/counter_gd32_timer.c b/drivers/counter/counter_gd32_timer.c index 3cc5854e6ec68..95e5441caba29 100644 --- a/drivers/counter/counter_gd32_timer.c +++ b/drivers/counter/counter_gd32_timer.c @@ -524,9 +524,8 @@ static const struct counter_driver_api counter_api = { .get_irq_pending = get_irq_pending_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, counter_gd32_timer_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, counter_gd32_timer_init, NULL, \ &timer_data_##n, &timer_config_##n, \ - PRE_KERNEL_1, CONFIG_COUNTER_INIT_PRIORITY, \ - &counter_api); + PRE_KERNEL_1, &counter_api); DT_INST_FOREACH_STATUS_OKAY(GD32_TIMER_INIT); diff --git a/drivers/counter/counter_gecko_rtcc.c b/drivers/counter/counter_gecko_rtcc.c index 242fad3e29785..ff6725debbfba 100644 --- a/drivers/counter/counter_gecko_rtcc.c +++ b/drivers/counter/counter_gecko_rtcc.c @@ -376,7 +376,6 @@ static const struct counter_gecko_config counter_gecko_0_config = { static struct counter_gecko_data counter_gecko_0_data; -DEVICE_DT_INST_DEFINE(0, counter_gecko_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, counter_gecko_init, NULL, &counter_gecko_0_data, &counter_gecko_0_config, - PRE_KERNEL_1, CONFIG_COUNTER_INIT_PRIORITY, - &counter_gecko_driver_api); + PRE_KERNEL_1, &counter_gecko_driver_api); diff --git a/drivers/counter/counter_gecko_stimer.c b/drivers/counter/counter_gecko_stimer.c index 263bb20ca8e5d..80ae32046312f 100644 --- a/drivers/counter/counter_gecko_stimer.c +++ b/drivers/counter/counter_gecko_stimer.c @@ -298,5 +298,5 @@ static const struct counter_gecko_config counter_gecko_0_config = { static struct counter_gecko_data counter_gecko_0_data; -DEVICE_DT_INST_DEFINE(0, counter_gecko_init, NULL, &counter_gecko_0_data, &counter_gecko_0_config, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &counter_gecko_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, counter_gecko_init, NULL, &counter_gecko_0_data, &counter_gecko_0_config, + PRE_KERNEL_1, &counter_gecko_driver_api); diff --git a/drivers/counter/counter_ifx_cat1.c b/drivers/counter/counter_ifx_cat1.c index 0c0d6175d4900..005b254d750f3 100644 --- a/drivers/counter/counter_ifx_cat1.c +++ b/drivers/counter/counter_ifx_cat1.c @@ -520,8 +520,8 @@ static const struct counter_driver_api counter_api = { .irqn = DT_INST_IRQN(n), \ .external_pin = \ (cyhal_gpio_t)DT_INST_GET_CYHAL_GPIO_OR(n, external_trigger_gpios, NC)}; \ - DEVICE_DT_INST_DEFINE(n, ifx_cat1_counter_init, NULL, &ifx_cat1_counter##n##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(n, ifx_cat1_counter_init, NULL, &ifx_cat1_counter##n##_data, \ &ifx_cat1_counter##n##_config, PRE_KERNEL_1, \ - CONFIG_COUNTER_INIT_PRIORITY, &counter_api); + &counter_api); DT_INST_FOREACH_STATUS_OKAY(INFINEON_CAT1_COUNTER_INIT); diff --git a/drivers/counter/counter_imx_epit.c b/drivers/counter/counter_imx_epit.c index c7fc3c19ad497..e70c759d51d54 100644 --- a/drivers/counter/counter_imx_epit.c +++ b/drivers/counter/counter_imx_epit.c @@ -157,12 +157,11 @@ static const struct imx_epit_config imx_epit_##idx##z_config = { \ .prescaler = DT_INST_PROP(idx, prescaler), \ }; \ static struct imx_epit_data imx_epit_##idx##_data; \ -DEVICE_DT_INST_DEFINE(idx, \ - &imx_epit_config_func_##idx, \ - NULL, \ - &imx_epit_##idx##_data, &imx_epit_##idx##z_config.info, \ - PRE_KERNEL_1, CONFIG_COUNTER_INIT_PRIORITY, \ - &imx_epit_driver_api); \ +DEVICE_INSTANCE_FROM_DT_INST(idx, \ + &imx_epit_config_func_##idx, \ + NULL, \ + &imx_epit_##idx##_data, &imx_epit_##idx##z_config.info, \ + PRE_KERNEL_1, &imx_epit_driver_api); \ static int imx_epit_config_func_##idx(const struct device *dev) \ { \ imx_epit_init(dev); \ diff --git a/drivers/counter/counter_ll_stm32_rtc.c b/drivers/counter/counter_ll_stm32_rtc.c index 4c6ac7fb3e698..d265083d2c3ad 100644 --- a/drivers/counter/counter_ll_stm32_rtc.c +++ b/drivers/counter/counter_ll_stm32_rtc.c @@ -688,9 +688,9 @@ static const struct counter_driver_api rtc_stm32_driver_api = { PM_DEVICE_DT_INST_DEFINE(0, rtc_stm32_pm_action); -DEVICE_DT_INST_DEFINE(0, &rtc_stm32_init, PM_DEVICE_DT_INST_GET(0), +DEVICE_INSTANCE_FROM_DT_INST(0, &rtc_stm32_init, PM_DEVICE_DT_INST_GET(0), &rtc_data, &rtc_config, PRE_KERNEL_1, - CONFIG_COUNTER_INIT_PRIORITY, &rtc_stm32_driver_api); + &rtc_stm32_driver_api); static void rtc_stm32_irq_config(const struct device *dev) { diff --git a/drivers/counter/counter_ll_stm32_timer.c b/drivers/counter/counter_ll_stm32_timer.c index 22bcb7b7a9725..55213dfaf53d9 100644 --- a/drivers/counter/counter_ll_stm32_timer.c +++ b/drivers/counter/counter_ll_stm32_timer.c @@ -668,12 +668,11 @@ void counter_stm32_irq_handler(const struct device *dev) .reset = RESET_DT_SPEC_GET(TIMER(idx)), \ }; \ \ - DEVICE_DT_INST_DEFINE(idx, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, \ counter_stm32_init_timer, \ NULL, \ &counter##idx##_data, \ &counter##idx##_config, \ - PRE_KERNEL_1, CONFIG_COUNTER_INIT_PRIORITY, \ - &counter_stm32_driver_api); + PRE_KERNEL_1, &counter_stm32_driver_api); DT_INST_FOREACH_STATUS_OKAY(COUNTER_DEVICE_INIT) diff --git a/drivers/counter/counter_max32_rtc.c b/drivers/counter/counter_max32_rtc.c index b1e3b217381e5..9027bec6f7069 100644 --- a/drivers/counter/counter_max32_rtc.c +++ b/drivers/counter/counter_max32_rtc.c @@ -259,8 +259,8 @@ static const struct counter_driver_api counter_rtc_max32_driver_api = { .irq_func = max32_rtc_irq_init_##_num, \ }; \ \ - DEVICE_DT_INST_DEFINE(_num, &rtc_max32_init, NULL, &rtc_max32_data_##_num, \ + DEVICE_INSTANCE_FROM_DT_INST(_num, &rtc_max32_init, NULL, &rtc_max32_data_##_num, \ &rtc_max32_config_##_num, PRE_KERNEL_1, \ - CONFIG_COUNTER_INIT_PRIORITY, &counter_rtc_max32_driver_api); + &counter_rtc_max32_driver_api); DT_INST_FOREACH_STATUS_OKAY(COUNTER_RTC_MAX32_INIT) diff --git a/drivers/counter/counter_max32_timer.c b/drivers/counter/counter_max32_timer.c index f666d38a58a2d..7f02f13debf2e 100644 --- a/drivers/counter/counter_max32_timer.c +++ b/drivers/counter/counter_max32_timer.c @@ -338,8 +338,8 @@ static const struct counter_driver_api counter_max32_driver_api = { .wakeup_source = DT_PROP(TIMER(_num), wakeup_source), \ }; \ static struct max32_tmr_data max32_tmr_data##_num; \ - DEVICE_DT_INST_DEFINE(_num, &max32_counter_init, NULL, &max32_tmr_data##_num, \ + DEVICE_INSTANCE_FROM_DT_INST(_num, &max32_counter_init, NULL, &max32_tmr_data##_num, \ &max32_tmr_config_##_num, PRE_KERNEL_1, \ - CONFIG_COUNTER_INIT_PRIORITY, &counter_max32_driver_api); + &counter_max32_driver_api); DT_INST_FOREACH_STATUS_OKAY(COUNTER_MAX32_DEFINE) diff --git a/drivers/counter/counter_mchp_xec.c b/drivers/counter/counter_mchp_xec.c index 580e4f30908b2..908a1ad4fad8c 100644 --- a/drivers/counter/counter_mchp_xec.c +++ b/drivers/counter/counter_mchp_xec.c @@ -332,13 +332,12 @@ static int counter_xec_init(const struct device *dev) .girq_bit = DT_INST_PROP_BY_IDX(0, girqs, 1), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ counter_xec_init, \ NULL, \ &counter_xec_dev_data_##inst, \ &counter_xec_dev_config_##inst, \ POST_KERNEL, \ - CONFIG_COUNTER_INIT_PRIORITY, \ &counter_xec_api); \ \ static void counter_xec_irq_config_##inst(void) \ diff --git a/drivers/counter/counter_mcux_ctimer.c b/drivers/counter/counter_mcux_ctimer.c index 5ae3b3cacae16..540f56ae9c726 100644 --- a/drivers/counter/counter_mcux_ctimer.c +++ b/drivers/counter/counter_mcux_ctimer.c @@ -307,9 +307,9 @@ static const struct counter_driver_api mcux_ctimer_driver_api = { .irq_config_func = mcux_lpc_ctimer_irq_config_##id, \ }; \ static struct mcux_lpc_ctimer_data mcux_lpc_ctimer_data_##id; \ - DEVICE_DT_INST_DEFINE(id, &mcux_lpc_ctimer_init, NULL, &mcux_lpc_ctimer_data_##id, \ + DEVICE_INSTANCE_FROM_DT_INST(id, &mcux_lpc_ctimer_init, NULL, &mcux_lpc_ctimer_data_##id, \ &mcux_lpc_ctimer_config_##id, POST_KERNEL, \ - CONFIG_COUNTER_INIT_PRIORITY, &mcux_ctimer_driver_api); \ + &mcux_ctimer_driver_api); \ static void mcux_lpc_ctimer_irq_config_##id(const struct device *dev) \ { \ IRQ_CONNECT(DT_INST_IRQN(id), DT_INST_IRQ(id, priority), mcux_lpc_ctimer_isr, \ diff --git a/drivers/counter/counter_mcux_lpc_rtc.c b/drivers/counter/counter_mcux_lpc_rtc.c index 433fef0683cd0..3b6fe5de981e3 100644 --- a/drivers/counter/counter_mcux_lpc_rtc.c +++ b/drivers/counter/counter_mcux_lpc_rtc.c @@ -245,10 +245,9 @@ static const struct counter_driver_api mcux_rtc_driver_api = { .wakeup_source = DT_INST_PROP(id, wakeup_source) \ }; \ static struct mcux_lpc_rtc_data mcux_lpc_rtc_data_##id; \ - DEVICE_DT_INST_DEFINE(id, &mcux_lpc_rtc_init, NULL, \ - &mcux_lpc_rtc_data_##id, &mcux_lpc_rtc_config_##id.info, \ - POST_KERNEL, CONFIG_COUNTER_INIT_PRIORITY, \ - &mcux_rtc_driver_api); \ + DEVICE_INSTANCE_FROM_DT_INST(id, &mcux_lpc_rtc_init, NULL, \ + &mcux_lpc_rtc_data_##id, &mcux_lpc_rtc_config_##id.info,\ + POST_KERNEL, &mcux_rtc_driver_api); \ static void mcux_lpc_rtc_irq_config_##id(const struct device *dev) \ { \ IRQ_CONNECT(DT_INST_IRQN(id), \ @@ -450,11 +449,10 @@ static const struct counter_driver_api mcux_rtc_highres_driver_api = { .wakeup_source = DT_INST_PROP(id, wakeup_source) \ }; \ static struct mcux_lpc_rtc_data mcux_lpc_rtc_highres_data_##id; \ - DEVICE_DT_INST_DEFINE(id, &mcux_lpc_rtc_highres_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(id, &mcux_lpc_rtc_highres_init, NULL, \ &mcux_lpc_rtc_highres_data_##id, \ &mcux_lpc_rtc_highres_config_##id.info, \ - POST_KERNEL, CONFIG_COUNTER_INIT_PRIORITY, \ - &mcux_rtc_highres_driver_api); \ + POST_KERNEL, &mcux_rtc_highres_driver_api); \ static void mcux_lpc_rtc_highres_irq_config_##id(const struct device *dev) \ { \ COND_CODE_1(IS_ENABLED(DT_HAS_COMPAT_STATUS_OKAY(nxp_lpc_rtc)), \ diff --git a/drivers/counter/counter_mcux_lptmr.c b/drivers/counter/counter_mcux_lptmr.c index 6713b85cd9d10..94cd556da590a 100644 --- a/drivers/counter/counter_mcux_lptmr.c +++ b/drivers/counter/counter_mcux_lptmr.c @@ -199,11 +199,10 @@ static const struct counter_driver_api mcux_lptmr_driver_api = { .irq_config_func = mcux_lptmr_irq_config_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &mcux_lptmr_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &mcux_lptmr_init, NULL, \ &mcux_lptmr_data_##n, \ &mcux_lptmr_config_##n, \ - POST_KERNEL, CONFIG_COUNTER_INIT_PRIORITY, \ - &mcux_lptmr_driver_api); + POST_KERNEL, &mcux_lptmr_driver_api); DT_INST_FOREACH_STATUS_OKAY(COUNTER_MCUX_LPTMR_DEVICE_INIT) diff --git a/drivers/counter/counter_mcux_qtmr.c b/drivers/counter/counter_mcux_qtmr.c index 4697a92dfd0dd..5d68e1b8df7b5 100644 --- a/drivers/counter/counter_mcux_qtmr.c +++ b/drivers/counter/counter_mcux_qtmr.c @@ -328,13 +328,12 @@ static const struct counter_driver_api mcux_qtmr_driver_api = { .mode = DT_INST_ENUM_IDX(n, mode), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ mcux_qtmr_init, \ NULL, \ &mcux_qtmr_data_ ## n, \ &mcux_qtmr_config_ ## n, \ POST_KERNEL, \ - CONFIG_COUNTER_INIT_PRIORITY, \ &mcux_qtmr_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(TMR_DEVICE_INIT_MCUX) diff --git a/drivers/counter/counter_mcux_rtc.c b/drivers/counter/counter_mcux_rtc.c index 1e71022269934..1bdaee6f5676d 100644 --- a/drivers/counter/counter_mcux_rtc.c +++ b/drivers/counter/counter_mcux_rtc.c @@ -289,10 +289,9 @@ static struct mcux_rtc_config mcux_rtc_config_0 = { }, }; -DEVICE_DT_INST_DEFINE(0, &mcux_rtc_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &mcux_rtc_init, NULL, &mcux_rtc_data_0, &mcux_rtc_config_0.info, - POST_KERNEL, CONFIG_COUNTER_INIT_PRIORITY, - &mcux_rtc_driver_api); + POST_KERNEL, &mcux_rtc_driver_api); static void mcux_rtc_irq_config_0(const struct device *dev) { diff --git a/drivers/counter/counter_mcux_snvs.c b/drivers/counter/counter_mcux_snvs.c index 172b4b894a306..00d646f75fea8 100644 --- a/drivers/counter/counter_mcux_snvs.c +++ b/drivers/counter/counter_mcux_snvs.c @@ -327,11 +327,10 @@ static struct mcux_snvs_config mcux_snvs_config_0 = { .irq_config_func = mcux_snvs_irq_config_0, }; -DEVICE_DT_INST_DEFINE(0, &mcux_snvs_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &mcux_snvs_init, NULL, &mcux_snvs_data_0, &mcux_snvs_config_0, - POST_KERNEL, CONFIG_COUNTER_INIT_PRIORITY, - &mcux_snvs_driver_api); + POST_KERNEL, &mcux_snvs_driver_api); static void mcux_snvs_irq_config_0(const struct device *dev) { diff --git a/drivers/counter/counter_native_posix.c b/drivers/counter/counter_native_posix.c index 0e408442ac61b..61074186349be 100644 --- a/drivers/counter/counter_native_posix.c +++ b/drivers/counter/counter_native_posix.c @@ -245,6 +245,6 @@ static const struct counter_config_info ctr_config = { .flags = DRIVER_CONFIG_INFO_FLAGS }; -DEVICE_DT_INST_DEFINE(0, ctr_init, +DEVICE_INSTANCE_FROM_DT_INST(0, ctr_init, NULL, NULL, &ctr_config, PRE_KERNEL_1, - CONFIG_COUNTER_INIT_PRIORITY, &ctr_api); + &ctr_api); diff --git a/drivers/counter/counter_nrfx_rtc.c b/drivers/counter/counter_nrfx_rtc.c index f6d7a936dba1f..f03794d8870c6 100644 --- a/drivers/counter/counter_nrfx_rtc.c +++ b/drivers/counter/counter_nrfx_rtc.c @@ -742,12 +742,11 @@ static const struct counter_driver_api counter_nrfx_driver_api = { (.fixed_top = DT_INST_PROP(idx, fixed_top),)) \ LOG_INSTANCE_PTR_INIT(log, LOG_MODULE_NAME, idx) \ }; \ - DEVICE_DT_INST_DEFINE(idx, \ - counter_##idx##_init, \ - NULL, \ - &counter_##idx##_data, \ - &nrfx_counter_##idx##_config.info, \ - PRE_KERNEL_1, CONFIG_COUNTER_INIT_PRIORITY, \ - &counter_nrfx_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(idx, \ + counter_##idx##_init, \ + NULL, \ + &counter_##idx##_data, \ + &nrfx_counter_##idx##_config.info, \ + PRE_KERNEL_1, &counter_nrfx_driver_api); DT_INST_FOREACH_STATUS_OKAY(COUNTER_NRF_RTC_DEVICE) diff --git a/drivers/counter/counter_nrfx_timer.c b/drivers/counter/counter_nrfx_timer.c index 333a436c80e46..27f4e49c6e208 100644 --- a/drivers/counter/counter_nrfx_timer.c +++ b/drivers/counter/counter_nrfx_timer.c @@ -466,12 +466,11 @@ static const struct counter_driver_api counter_nrfx_driver_api = { LOG_INSTANCE_PTR_INIT(log, LOG_MODULE_NAME, idx) \ }; \ CHECK_MAX_FREQ(idx); \ - DEVICE_DT_INST_DEFINE(idx, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, \ counter_##idx##_init, \ NULL, \ &counter_##idx##_data, \ &nrfx_counter_##idx##_config.info, \ - PRE_KERNEL_1, CONFIG_COUNTER_INIT_PRIORITY, \ - &counter_nrfx_driver_api); + PRE_KERNEL_1, &counter_nrfx_driver_api); DT_INST_FOREACH_STATUS_OKAY(COUNTER_NRFX_TIMER_DEVICE) diff --git a/drivers/counter/counter_nxp_mrt.c b/drivers/counter/counter_nxp_mrt.c index 2ad62385d8e37..a458c92206374 100644 --- a/drivers/counter/counter_nxp_mrt.c +++ b/drivers/counter/counter_nxp_mrt.c @@ -278,11 +278,11 @@ struct counter_driver_api nxp_mrt_api = { /* Creates a device for a channel (needed for counter API) */ #define NXP_MRT_CHANNEL_DEV_INIT(node, mrt_inst) \ - DEVICE_DT_DEFINE(node, NULL, NULL, \ + DEVICE_INSTANCE(node, NULL, NULL, \ (void *) \ &nxp_mrt_##mrt_inst##_channel_datas[DT_REG_ADDR(node)], \ &nxp_mrt_##mrt_inst##_config, \ - POST_KERNEL, CONFIG_COUNTER_INIT_PRIORITY, \ + POST_KERNEL, \ &nxp_mrt_api); \ /* Creates a data struct for a channel device */ @@ -349,9 +349,9 @@ struct counter_driver_api nxp_mrt_api = { }; \ \ /* Init parent device in order to handle ISR and init. */ \ - DEVICE_DT_INST_DEFINE(n, &nxp_mrt_init, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &nxp_mrt_init, NULL, NULL, \ &nxp_mrt_##n##_config, \ POST_KERNEL, \ - CONFIG_COUNTER_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(NXP_MRT_INIT) diff --git a/drivers/counter/counter_nxp_pit.c b/drivers/counter/counter_nxp_pit.c index 6640b1aa2f2ad..e9ae6f46bd181 100644 --- a/drivers/counter/counter_nxp_pit.c +++ b/drivers/counter/counter_nxp_pit.c @@ -247,11 +247,11 @@ static const struct counter_driver_api nxp_pit_driver_api = { /* Creates a device for a channel (needed for counter API) */ #define NXP_PIT_CHANNEL_DEV_INIT(node, pit_inst) \ - DEVICE_DT_DEFINE(node, NULL, NULL, \ + DEVICE_INSTANCE(node, NULL, NULL, \ (void *) \ &nxp_pit_##pit_inst##_channel_datas[DT_REG_ADDR(node)], \ &nxp_pit_##pit_inst##_config, \ - POST_KERNEL, CONFIG_COUNTER_INIT_PRIORITY, \ + POST_KERNEL, \ &nxp_pit_driver_api); /* Creates a decleration for each pit channel */ @@ -366,9 +366,9 @@ static const struct counter_driver_api nxp_pit_driver_api = { }; \ \ /* Init parent device in order to handle ISR and init. */ \ - DEVICE_DT_INST_DEFINE(n, &nxp_pit_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &nxp_pit_init, NULL, \ NULL, &nxp_pit_##n##_config, POST_KERNEL, \ - CONFIG_COUNTER_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(COUNTER_NXP_PIT_DEVICE_INIT) diff --git a/drivers/counter/counter_nxp_s32_sys_timer.c b/drivers/counter/counter_nxp_s32_sys_timer.c index bd955eed0336a..58241b63cff07 100644 --- a/drivers/counter/counter_nxp_s32_sys_timer.c +++ b/drivers/counter/counter_nxp_s32_sys_timer.c @@ -412,13 +412,12 @@ static const struct counter_driver_api nxp_s32_sys_timer_driver_api = { .irqn = DT_INST_IRQN(n), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ nxp_s32_sys_timer_##n##_init, \ NULL, \ &nxp_s32_sys_timer_data_##n, \ &nxp_s32_sys_timer_config_##n, \ POST_KERNEL, \ - CONFIG_COUNTER_INIT_PRIORITY, \ &nxp_s32_sys_timer_driver_api); DT_INST_FOREACH_STATUS_OKAY(SYS_TIMER_INIT_DEVICE) diff --git a/drivers/counter/counter_renesas_ra_agt.c b/drivers/counter/counter_renesas_ra_agt.c index 4fd8a4fe8c533..a1de6ebee1c9a 100644 --- a/drivers/counter/counter_renesas_ra_agt.c +++ b/drivers/counter/counter_renesas_ra_agt.c @@ -586,8 +586,7 @@ static const struct counter_driver_api ra_agt_driver_api = { return counter_ra_agt_init(dev); \ } \ \ - DEVICE_DT_INST_DEFINE(n, counter_ra_agt_##n##_init, NULL, &counter_ra_agt_data_##n, \ - &ra_agt_config_##n, POST_KERNEL, CONFIG_COUNTER_INIT_PRIORITY, \ - &ra_agt_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, counter_ra_agt_##n##_init, NULL, &counter_ra_agt_data_##n, \ + &ra_agt_config_##n, POST_KERNEL, &ra_agt_driver_api); DT_INST_FOREACH_STATUS_OKAY(AGT_DEVICE_INIT_RA) diff --git a/drivers/counter/counter_rpi_pico_timer.c b/drivers/counter/counter_rpi_pico_timer.c index c2140d5877748..a33518a20abd1 100644 --- a/drivers/counter/counter_rpi_pico_timer.c +++ b/drivers/counter/counter_rpi_pico_timer.c @@ -234,8 +234,8 @@ static const struct counter_driver_api counter_rpi_pico_driver_api = { .clk_id = (clock_control_subsys_t)DT_INST_PHA_BY_IDX(inst, clocks, 0, clk_id), \ .reset = RESET_DT_SPEC_INST_GET(inst), \ }; \ - DEVICE_DT_INST_DEFINE(inst, counter_rpi_pico_timer_init, NULL, &counter_##inst##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, counter_rpi_pico_timer_init, NULL, &counter_##inst##_data,\ &counter_##inst##_config, PRE_KERNEL_1, \ - CONFIG_COUNTER_INIT_PRIORITY, &counter_rpi_pico_driver_api); + &counter_rpi_pico_driver_api); DT_INST_FOREACH_STATUS_OKAY(COUNTER_RPI_PICO_TIMER) diff --git a/drivers/counter/counter_sam0_tc32.c b/drivers/counter/counter_sam0_tc32.c index 7dde721febd84..11a9c3f774b0e 100644 --- a/drivers/counter/counter_sam0_tc32.c +++ b/drivers/counter/counter_sam0_tc32.c @@ -441,13 +441,12 @@ static const struct counter_driver_api counter_sam0_tc32_driver_api = { \ static struct counter_sam0_tc32_data counter_sam0_tc32_dev_data_##n;\ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &counter_sam0_tc32_initialize, \ NULL, \ &counter_sam0_tc32_dev_data_##n, \ &counter_sam0_tc32_dev_config_##n, \ PRE_KERNEL_1, \ - CONFIG_COUNTER_INIT_PRIORITY, \ &counter_sam0_tc32_driver_api); \ \ static void counter_sam0_tc32_config_##n(const struct device *dev) \ diff --git a/drivers/counter/counter_sam_tc.c b/drivers/counter/counter_sam_tc.c index 413391c2f7df4..e4d8f75a36345 100644 --- a/drivers/counter/counter_sam_tc.c +++ b/drivers/counter/counter_sam_tc.c @@ -392,10 +392,9 @@ static const struct counter_sam_dev_cfg counter_##n##_sam_config = { \ \ static struct counter_sam_dev_data counter_##n##_sam_data; \ \ -DEVICE_DT_INST_DEFINE(n, counter_sam_initialize, NULL, \ - &counter_##n##_sam_data, &counter_##n##_sam_config, \ - PRE_KERNEL_1, CONFIG_COUNTER_INIT_PRIORITY, \ - &counter_sam_driver_api); \ +DEVICE_INSTANCE_FROM_DT_INST(n, counter_sam_initialize, NULL,\ + &counter_##n##_sam_data, &counter_##n##_sam_config,\ + PRE_KERNEL_1, &counter_sam_driver_api); \ \ static void counter_##n##_sam_config_func(const struct device *dev) \ { \ diff --git a/drivers/counter/counter_smartbond_timer.c b/drivers/counter/counter_smartbond_timer.c index 1869c3e6911e6..267a00fdd6c88 100644 --- a/drivers/counter/counter_smartbond_timer.c +++ b/drivers/counter/counter_smartbond_timer.c @@ -525,12 +525,11 @@ void counter_smartbond_irq_handler(const struct device *dev) }; \ \ PM_DEVICE_DT_INST_DEFINE(idx, counter_smartbond_pm_action); \ - DEVICE_DT_INST_DEFINE(idx, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, \ counter_smartbond_init_timer, \ - PM_DEVICE_DT_INST_GET(idx), \ + PM_DEVICE_DT_INST_GET(idx), \ &counter##idx##_data, \ &counter##idx##_config, \ - PRE_KERNEL_1, CONFIG_COUNTER_INIT_PRIORITY, \ - &counter_smartbond_driver_api); + PRE_KERNEL_1, &counter_smartbond_driver_api); DT_INST_FOREACH_STATUS_OKAY(COUNTER_DEVICE_INIT) diff --git a/drivers/counter/counter_xlnx_axi_timer.c b/drivers/counter/counter_xlnx_axi_timer.c index 7d8f282cc1b9e..edffa03150167 100644 --- a/drivers/counter/counter_xlnx_axi_timer.c +++ b/drivers/counter/counter_xlnx_axi_timer.c @@ -339,12 +339,11 @@ static const struct counter_driver_api xlnx_axi_timer_driver_api = { \ static struct xlnx_axi_timer_data xlnx_axi_timer_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, &xlnx_axi_timer_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &xlnx_axi_timer_init, \ NULL, \ &xlnx_axi_timer_data_##n, \ &xlnx_axi_timer_config_##n, \ POST_KERNEL, \ - CONFIG_COUNTER_INIT_PRIORITY, \ &xlnx_axi_timer_driver_api); \ \ static void xlnx_axi_timer_config_func_##n(const struct device *dev) \ diff --git a/drivers/counter/maxim_ds3231.c b/drivers/counter/maxim_ds3231.c index 3fd63b1e17c84..23996691fc742 100644 --- a/drivers/counter/maxim_ds3231.c +++ b/drivers/counter/maxim_ds3231.c @@ -1299,10 +1299,9 @@ static struct ds3231_data ds3231_0_data; #error CONFIG_COUNTER_INIT_PRIORITY must be greater than I2C_INIT_PRIORITY #endif -DEVICE_DT_INST_DEFINE(0, ds3231_init, NULL, &ds3231_0_data, +DEVICE_INSTANCE_FROM_DT_INST(0, ds3231_init, NULL, &ds3231_0_data, &ds3231_0_config, - POST_KERNEL, CONFIG_COUNTER_INIT_PRIORITY, - &ds3231_api); + POST_KERNEL, &ds3231_api); #ifdef CONFIG_USERSPACE diff --git a/drivers/counter/rtc_mcp7940n.c b/drivers/counter/rtc_mcp7940n.c index 7b441fb05a8f9..bbd1a76e7ea65 100644 --- a/drivers/counter/rtc_mcp7940n.c +++ b/drivers/counter/rtc_mcp7940n.c @@ -759,11 +759,10 @@ static const struct counter_driver_api mcp7940n_api = { .int_gpios = GPIO_DT_SPEC_INST_GET_OR(index, int_gpios, {0}), \ }; \ \ - DEVICE_DT_INST_DEFINE(index, mcp7940n_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(index, mcp7940n_init, NULL, \ &mcp7940n_data_##index, \ &mcp7940n_config_##index, \ POST_KERNEL, \ - CONFIG_COUNTER_INIT_PRIORITY, \ &mcp7940n_api); DT_INST_FOREACH_STATUS_OKAY(INST_DT_MCP7904N); diff --git a/drivers/counter/timer_dtmr_cmsdk_apb.c b/drivers/counter/timer_dtmr_cmsdk_apb.c index 2f6b4cc7f547f..5855d81d62b75 100644 --- a/drivers/counter/timer_dtmr_cmsdk_apb.c +++ b/drivers/counter/timer_dtmr_cmsdk_apb.c @@ -198,12 +198,11 @@ static int dtmr_cmsdk_apb_init(const struct device *dev) .load = UINT_MAX, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ dtmr_cmsdk_apb_init, \ - NULL, \ + NULL, \ &dtmr_cmsdk_apb_dev_data_##inst, \ &dtmr_cmsdk_apb_cfg_##inst, POST_KERNEL, \ - CONFIG_COUNTER_INIT_PRIORITY, \ &dtmr_cmsdk_apb_api); \ \ static void dtimer_cmsdk_apb_config_##inst(const struct device *dev) \ diff --git a/drivers/counter/timer_tmr_cmsdk_apb.c b/drivers/counter/timer_tmr_cmsdk_apb.c index b0bbfbe547e3d..9a195d44114fe 100644 --- a/drivers/counter/timer_tmr_cmsdk_apb.c +++ b/drivers/counter/timer_tmr_cmsdk_apb.c @@ -190,12 +190,11 @@ static int tmr_cmsdk_apb_init(const struct device *dev) .load = UINT32_MAX, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ tmr_cmsdk_apb_init, \ - NULL, \ + NULL, \ &tmr_cmsdk_apb_dev_data_##inst, \ &tmr_cmsdk_apb_cfg_##inst, POST_KERNEL, \ - CONFIG_COUNTER_INIT_PRIORITY, \ &tmr_cmsdk_apb_api); \ \ static void timer_cmsdk_apb_config_##inst(const struct device *dev) \ diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index a1b147b12bfae..012386f244183 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig @@ -43,7 +43,7 @@ config CRYPTO_TINYCRYPT_SHIM_MAX_SESSION config CRYPTO_TINYCRYPT_SHIM_DRV_NAME string "Device name for TinyCrypt Pseudo device" - default "CRYPTO_TC" + default "crypto_tinycrypt" depends on CRYPTO_TINYCRYPT_SHIM help Device name for TinyCrypt Pseudo device. @@ -61,7 +61,7 @@ config CRYPTO_MBEDTLS_SHIM config CRYPTO_MBEDTLS_SHIM_DRV_NAME string "Device name for mbedTLS Pseudo device" - default "CRYPTO_MTLS" + default "crypto_mtls" depends on CRYPTO_MBEDTLS_SHIM help Device name for mbedTLS Pseudo device. diff --git a/drivers/crypto/crypto_ataes132a.c b/drivers/crypto/crypto_ataes132a.c index 4696272fc5619..9bd8fe512fe9a 100644 --- a/drivers/crypto/crypto_ataes132a.c +++ b/drivers/crypto/crypto_ataes132a.c @@ -884,7 +884,6 @@ static struct crypto_driver_api crypto_enc_funcs = { struct ataes132a_device_data ataes132a_data; -DEVICE_DT_INST_DEFINE(0, ataes132a_init, +DEVICE_INSTANCE_FROM_DT_INST(0, ataes132a_init, NULL, &ataes132a_data, &ataes132a_config, - POST_KERNEL, CONFIG_CRYPTO_INIT_PRIORITY, - (void *)&crypto_enc_funcs); + POST_KERNEL, (void *)&crypto_enc_funcs); diff --git a/drivers/crypto/crypto_intel_sha.c b/drivers/crypto/crypto_intel_sha.c index c0722fa18ce17..5e08ece6691a9 100644 --- a/drivers/crypto/crypto_intel_sha.c +++ b/drivers/crypto/crypto_intel_sha.c @@ -336,7 +336,7 @@ static struct crypto_driver_api hash_enc_funcs = { static struct sha_container sha_data_##inst = { \ .dfsha = (volatile struct sha_hw_regs *)DT_INST_REG_ADDR_BY_IDX(inst, 0) \ }; \ -DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &sha_data_##inst, NULL, \ - POST_KERNEL, CONFIG_CRYPTO_INIT_PRIORITY, (void *)&hash_enc_funcs); +DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &sha_data_##inst, NULL, \ + POST_KERNEL, (void *)&hash_enc_funcs); DT_INST_FOREACH_STATUS_OKAY(INTEL_SHA_DEVICE_INIT) diff --git a/drivers/crypto/crypto_it8xxx2_sha.c b/drivers/crypto/crypto_it8xxx2_sha.c index 3fea42f217d28..8404eff5e090d 100644 --- a/drivers/crypto/crypto_it8xxx2_sha.c +++ b/drivers/crypto/crypto_it8xxx2_sha.c @@ -221,5 +221,5 @@ static const struct crypto_driver_api it8xxx2_crypto_api = { .query_hw_caps = it8xxx2_query_hw_caps, }; -DEVICE_DT_INST_DEFINE(0, &it8xxx2_sha_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_CRYPTO_INIT_PRIORITY, &it8xxx2_crypto_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &it8xxx2_sha_init, NULL, NULL, NULL, POST_KERNEL, + &it8xxx2_crypto_api); diff --git a/drivers/crypto/crypto_it8xxx2_sha_v2.c b/drivers/crypto/crypto_it8xxx2_sha_v2.c index 6da1cff4c2942..1e68b2b68d6b8 100644 --- a/drivers/crypto/crypto_it8xxx2_sha_v2.c +++ b/drivers/crypto/crypto_it8xxx2_sha_v2.c @@ -346,5 +346,5 @@ static const struct crypto_driver_api it8xxx2_crypto_api = { .query_hw_caps = it8xxx2_query_hw_caps, }; -DEVICE_DT_INST_DEFINE(0, &it8xxx2_sha_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_CRYPTO_INIT_PRIORITY, &it8xxx2_crypto_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &it8xxx2_sha_init, NULL, NULL, NULL, POST_KERNEL, + &it8xxx2_crypto_api); diff --git a/drivers/crypto/crypto_mchp_xec_symcr.c b/drivers/crypto/crypto_mchp_xec_symcr.c index 6bcf4f17c854a..adcf5e94d245f 100644 --- a/drivers/crypto/crypto_mchp_xec_symcr.c +++ b/drivers/crypto/crypto_mchp_xec_symcr.c @@ -540,9 +540,8 @@ static const struct crypto_driver_api xec_symcr_api = { .girq_pos = DT_INST_PROP_BY_IDX(inst, girqs, 1), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &xec_symcr_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &xec_symcr_init, NULL, \ &xec_symcr_data_##inst, &xec_symcr_cfg_##inst, \ - POST_KERNEL, CONFIG_CRYPTO_INIT_PRIORITY, \ - &xec_symcr_api); + POST_KERNEL, &xec_symcr_api); DT_INST_FOREACH_STATUS_OKAY(XEC_SYMCR_INIT) diff --git a/drivers/crypto/crypto_mcux_dcp.c b/drivers/crypto/crypto_mcux_dcp.c index 23232ed9b57cd..f87ae923431db 100644 --- a/drivers/crypto/crypto_mcux_dcp.c +++ b/drivers/crypto/crypto_mcux_dcp.c @@ -344,8 +344,8 @@ static const struct crypto_driver_api crypto_dcp_api = { .base = (DCP_Type *)DT_INST_REG_ADDR(inst), \ }; \ static struct crypto_dcp_data crypto_dcp_data_##inst; \ - DEVICE_DT_INST_DEFINE(inst, crypto_dcp_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, crypto_dcp_init, NULL, \ &crypto_dcp_data_##inst, &crypto_dcp_config_##inst, \ - POST_KERNEL, CONFIG_CRYPTO_INIT_PRIORITY, &crypto_dcp_api); + POST_KERNEL, &crypto_dcp_api); DT_INST_FOREACH_STATUS_OKAY(CRYPTO_DCP_DEFINE) diff --git a/drivers/crypto/crypto_mtls_shim.c b/drivers/crypto/crypto_mtls_shim.c index 071b3593f338d..6b5bb9c35fcd8 100644 --- a/drivers/crypto/crypto_mtls_shim.c +++ b/drivers/crypto/crypto_mtls_shim.c @@ -608,6 +608,4 @@ static struct crypto_driver_api mtls_crypto_funcs = { .query_hw_caps = mtls_query_caps, }; -DEVICE_DEFINE(crypto_mtls, CONFIG_CRYPTO_MBEDTLS_SHIM_DRV_NAME, - NULL, NULL, NULL, NULL, POST_KERNEL, CONFIG_CRYPTO_INIT_PRIORITY, - (void *)&mtls_crypto_funcs); +DEVICE_INSTANCE(crypto_mtls, NULL, NULL, NULL, NULL, POST_KERNEL, (void *)&mtls_crypto_funcs); diff --git a/drivers/crypto/crypto_npcx_sha.c b/drivers/crypto/crypto_npcx_sha.c index 20c817f1cf903..ff2c96daa9d53 100644 --- a/drivers/crypto/crypto_npcx_sha.c +++ b/drivers/crypto/crypto_npcx_sha.c @@ -208,7 +208,6 @@ static const struct crypto_driver_api npcx_crypto_api = { .query_hw_caps = npcx_query_caps, }; -DEVICE_DT_INST_DEFINE(0, npcx_hash_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_CRYPTO_INIT_PRIORITY, - &npcx_crypto_api); +DEVICE_INSTANCE_FROM_DT_INST(0, npcx_hash_init, NULL, NULL, NULL, POST_KERNEL, &npcx_crypto_api); BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, "only one 'nuvoton,npcx-sha' compatible node can be supported"); diff --git a/drivers/crypto/crypto_nrf_ecb.c b/drivers/crypto/crypto_nrf_ecb.c index 9fa354738ae55..146935250c079 100644 --- a/drivers/crypto/crypto_nrf_ecb.c +++ b/drivers/crypto/crypto_nrf_ecb.c @@ -139,7 +139,6 @@ static const struct crypto_driver_api crypto_enc_funcs = { .query_hw_caps = nrf_ecb_query_caps, }; -DEVICE_DT_INST_DEFINE(0, nrf_ecb_driver_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, nrf_ecb_driver_init, NULL, NULL, NULL, - POST_KERNEL, CONFIG_CRYPTO_INIT_PRIORITY, - &crypto_enc_funcs); + POST_KERNEL, &crypto_enc_funcs); diff --git a/drivers/crypto/crypto_si32.c b/drivers/crypto/crypto_si32.c index e933852e7a5fa..b081b22c13c0e 100644 --- a/drivers/crypto/crypto_si32.c +++ b/drivers/crypto/crypto_si32.c @@ -1200,5 +1200,5 @@ static const struct crypto_driver_api crypto_si32_api = { .cipher_free_session = crypto_si32_free_session, }; -DEVICE_DT_INST_DEFINE(0, crypto_si32_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_CRYPTO_INIT_PRIORITY, &crypto_si32_api); +DEVICE_INSTANCE_FROM_DT_INST(0, crypto_si32_init, NULL, NULL, NULL, POST_KERNEL, + &crypto_si32_api); diff --git a/drivers/crypto/crypto_smartbond.c b/drivers/crypto/crypto_smartbond.c index 9899f46dd33f5..9d29ea24b62e1 100644 --- a/drivers/crypto/crypto_smartbond.c +++ b/drivers/crypto/crypto_smartbond.c @@ -998,12 +998,11 @@ static int crypto_smartbond_init(const struct device *dev) \ static struct crypto_smartbond_data crypto_smartbond_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(0, \ - crypto_smartbond_init, \ - PM_DEVICE_DT_INST_GET(inst), \ - &crypto_smartbond_data_##inst, NULL, \ - POST_KERNEL, \ - CONFIG_CRYPTO_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(0, \ + crypto_smartbond_init, \ + PM_DEVICE_DT_INST_GET(inst), \ + &crypto_smartbond_data_##inst, NULL, \ + POST_KERNEL, \ &crypto_smartbond_driver_api); DT_INST_FOREACH_STATUS_OKAY(SMARTBOND_CRYPTO_INIT) diff --git a/drivers/crypto/crypto_stm32.c b/drivers/crypto/crypto_stm32.c index bd7e05a2ddcdd..3bc57c90292a6 100644 --- a/drivers/crypto/crypto_stm32.c +++ b/drivers/crypto/crypto_stm32.c @@ -562,7 +562,7 @@ static const struct crypto_stm32_config crypto_stm32_dev_config = { } }; -DEVICE_DT_INST_DEFINE(0, crypto_stm32_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, crypto_stm32_init, NULL, &crypto_stm32_dev_data, &crypto_stm32_dev_config, POST_KERNEL, - CONFIG_CRYPTO_INIT_PRIORITY, (void *)&crypto_enc_funcs); + (void *)&crypto_enc_funcs); diff --git a/drivers/crypto/crypto_tc_shim.c b/drivers/crypto/crypto_tc_shim.c index 71616250be05e..126a276e17a4b 100644 --- a/drivers/crypto/crypto_tc_shim.c +++ b/drivers/crypto/crypto_tc_shim.c @@ -321,7 +321,5 @@ static struct crypto_driver_api crypto_enc_funcs = { .query_hw_caps = tc_query_caps, }; -DEVICE_DEFINE(crypto_tinycrypt, CONFIG_CRYPTO_TINYCRYPT_SHIM_DRV_NAME, - &tc_shim_init, NULL, NULL, NULL, - POST_KERNEL, CONFIG_CRYPTO_INIT_PRIORITY, - (void *)&crypto_enc_funcs); +DEVICE_INSTANCE(crypto_tinycrypt, &tc_shim_init, NULL, NULL, NULL, + POST_KERNEL, (void *)&crypto_enc_funcs); diff --git a/drivers/dac/dac_ad559x.c b/drivers/dac/dac_ad559x.c index b0b3d0ab761a1..8a5993c9c408b 100644 --- a/drivers/dac/dac_ad559x.c +++ b/drivers/dac/dac_ad559x.c @@ -127,8 +127,7 @@ static int dac_ad559x_init(const struct device *dev) \ struct dac_ad559x_data dac_ad559x_data##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, dac_ad559x_init, NULL, &dac_ad559x_data##inst, \ - &dac_ad559x_config##inst, POST_KERNEL, CONFIG_MFD_INIT_PRIORITY, \ - &dac_ad559x_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, dac_ad559x_init, NULL, &dac_ad559x_data##inst, \ + &dac_ad559x_config##inst, POST_KERNEL, &dac_ad559x_api); DT_INST_FOREACH_STATUS_OKAY(DAC_AD559X_DEFINE) diff --git a/drivers/dac/dac_ad569x.c b/drivers/dac/dac_ad569x.c index afe3b095ba702..606272680eae9 100644 --- a/drivers/dac/dac_ad569x.c +++ b/drivers/dac/dac_ad569x.c @@ -174,8 +174,8 @@ static const struct dac_driver_api ad569x_driver_api = { .power_down_mode = DT_INST_ENUM_IDX(index, power_down_mode), \ }; \ \ - DEVICE_DT_INST_DEFINE(index, ad569x_init, NULL, NULL, &config_##name##_##index, \ - POST_KERNEL, CONFIG_DAC_INIT_PRIORITY, &ad569x_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(index, ad569x_init, NULL, NULL, &config_##name##_##index, \ + POST_KERNEL, &ad569x_driver_api); #define DT_DRV_COMPAT adi_ad5691 #if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) diff --git a/drivers/dac/dac_ad56xx.c b/drivers/dac/dac_ad56xx.c index 232b6a289c3a0..891fae0e4241d 100644 --- a/drivers/dac/dac_ad56xx.c +++ b/drivers/dac/dac_ad56xx.c @@ -177,9 +177,9 @@ BUILD_ASSERT(CONFIG_DAC_AD56XX_INIT_PRIORITY > CONFIG_SPI_INIT_PRIORITY, .channel_addresses = channels, \ .channel_count = channels_count, \ }; \ - DEVICE_DT_INST_DEFINE(index, ad56xx_init, NULL, &data_##name##_##index, \ + DEVICE_INSTANCE_FROM_DT_INST(index, ad56xx_init, NULL, &data_##name##_##index, \ &config_##name##_##index, POST_KERNEL, \ - CONFIG_DAC_AD56XX_INIT_PRIORITY, &ad56xx_driver_api); + &ad56xx_driver_api); #define DT_DRV_COMPAT adi_ad5628 #if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) diff --git a/drivers/dac/dac_dacx0501.c b/drivers/dac/dac_dacx0501.c index 411011cfa4ec4..5e16dc1da2bd4 100644 --- a/drivers/dac/dac_dacx0501.c +++ b/drivers/dac/dac_dacx0501.c @@ -189,8 +189,7 @@ static const struct dac_driver_api dacx0501_driver_api = { _CONCAT(REF_, DT_STRING_UPPER_TOKEN(DT_DRV_INST(n), voltage_reference)), \ .output_gain = _CONCAT(VM_, DT_STRING_UPPER_TOKEN(DT_DRV_INST(n), output_gain)), \ }; \ - DEVICE_DT_INST_DEFINE(n, &dacx0501_init, NULL, &dacx0501_data_##n, &dacx0501_config_##n, \ - POST_KERNEL, CONFIG_DAC_DACX0501_INIT_PRIORITY, \ - &dacx0501_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &dacx0501_init, NULL, &dacx0501_data_##n, &dacx0501_config_##n,\ + POST_KERNEL, &dacx0501_driver_api); DT_INST_FOREACH_STATUS_OKAY(DACX0501_DEFINE) diff --git a/drivers/dac/dac_dacx0508.c b/drivers/dac/dac_dacx0508.c index 404709a3dfb7a..cd786279ed492 100644 --- a/drivers/dac/dac_dacx0508.c +++ b/drivers/dac/dac_dacx0508.c @@ -386,11 +386,10 @@ static const struct dac_driver_api dacx0508_driver_api = { .gain[6] = DT_PROP(INST_DT_DACX0508(n, t), channel6_gain), \ .gain[7] = DT_PROP(INST_DT_DACX0508(n, t), channel7_gain), \ }; \ - DEVICE_DT_DEFINE(INST_DT_DACX0508(n, t), \ + DEVICE_INSTANCE(INST_DT_DACX0508(n, t), \ &dacx0508_init, NULL, \ &dac##t##_data_##n, \ &dac##t##_config_##n, POST_KERNEL, \ - CONFIG_DAC_DACX0508_INIT_PRIORITY, \ &dacx0508_driver_api); /* diff --git a/drivers/dac/dac_dacx3608.c b/drivers/dac/dac_dacx3608.c index cb6210c4483ce..a8b2efdd31aa3 100644 --- a/drivers/dac/dac_dacx3608.c +++ b/drivers/dac/dac_dacx3608.c @@ -259,11 +259,10 @@ static const struct dac_driver_api dacx3608_driver_api = { .bus = I2C_DT_SPEC_GET(INST_DT_DACX3608(n, t)), \ .resolution = res, \ }; \ - DEVICE_DT_DEFINE(INST_DT_DACX3608(n, t), \ + DEVICE_INSTANCE(INST_DT_DACX3608(n, t), \ &dacx3608_init, NULL, \ &dac##t##_data_##n, \ &dac##t##_config_##n, POST_KERNEL, \ - CONFIG_DAC_DACX3608_INIT_PRIORITY, \ &dacx3608_driver_api) /* diff --git a/drivers/dac/dac_esp32.c b/drivers/dac/dac_esp32.c index 6dcac59b3a030..e93c9668e502a 100644 --- a/drivers/dac/dac_esp32.c +++ b/drivers/dac/dac_esp32.c @@ -89,13 +89,12 @@ static const struct dac_driver_api dac_esp32_driver_api = { .clock_subsys = (clock_control_subsys_t) DT_INST_CLOCKS_CELL(id, offset), \ }; \ \ - DEVICE_DT_INST_DEFINE(id, \ + DEVICE_INSTANCE_FROM_DT_INST(id, \ &dac_esp32_init, \ NULL, \ NULL, \ &dac_esp32_config_##id, \ POST_KERNEL, \ - CONFIG_DAC_INIT_PRIORITY, \ &dac_esp32_driver_api); DT_INST_FOREACH_STATUS_OKAY(ESP32_DAC_INIT); diff --git a/drivers/dac/dac_gd32.c b/drivers/dac/dac_gd32.c index be58e034c7e57..4a86c151259f7 100644 --- a/drivers/dac/dac_gd32.c +++ b/drivers/dac/dac_gd32.c @@ -181,6 +181,5 @@ static const struct dac_gd32_config dac_gd32_cfg_0 = { .reset_val = DT_INST_PROP(0, reset_val), }; -DEVICE_DT_INST_DEFINE(0, &dac_gd32_init, NULL, &dac_gd32_data_0, - &dac_gd32_cfg_0, POST_KERNEL, CONFIG_DAC_INIT_PRIORITY, - &dac_gd32_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &dac_gd32_init, NULL, &dac_gd32_data_0, + &dac_gd32_cfg_0, POST_KERNEL, &dac_gd32_driver_api); diff --git a/drivers/dac/dac_ltc166x.c b/drivers/dac/dac_ltc166x.c index ee804e4c46bc1..4d072360f708f 100644 --- a/drivers/dac/dac_ltc166x.c +++ b/drivers/dac/dac_ltc166x.c @@ -119,11 +119,10 @@ static const struct dac_driver_api ltc166x_driver_api = { .resolution = res, \ .nchannels = nchan, \ }; \ - DEVICE_DT_DEFINE(INST_DT_LTC166X(n, t), \ + DEVICE_INSTANCE(INST_DT_LTC166X(n, t), \ <c166x_init, NULL, \ NULL, \ <c##t##_config_##n, POST_KERNEL, \ - CONFIG_DAC_LTC166X_INIT_PRIORITY, \ <c166x_driver_api) /* diff --git a/drivers/dac/dac_mcp4725.c b/drivers/dac/dac_mcp4725.c index eb9286cbae4eb..1a065c562e584 100644 --- a/drivers/dac/dac_mcp4725.c +++ b/drivers/dac/dac_mcp4725.c @@ -140,11 +140,10 @@ static const struct dac_driver_api mcp4725_driver_api = { .i2c = I2C_DT_SPEC_INST_GET(index), \ }; \ \ - DEVICE_DT_INST_DEFINE(index, dac_mcp4725_init, \ + DEVICE_INSTANCE_FROM_DT_INST(index, dac_mcp4725_init, \ NULL, \ NULL, \ &mcp4725_config_##index, POST_KERNEL, \ - CONFIG_DAC_MCP4725_INIT_PRIORITY, \ &mcp4725_driver_api); DT_INST_FOREACH_STATUS_OKAY(INST_DT_MCP4725); diff --git a/drivers/dac/dac_mcp4728.c b/drivers/dac/dac_mcp4728.c index e02e22f3cddf3..5e96f0bd7b4b6 100644 --- a/drivers/dac/dac_mcp4728.c +++ b/drivers/dac/dac_mcp4728.c @@ -105,10 +105,9 @@ static const struct dac_driver_api mcp4728_driver_api = { .gain = DT_INST_PROP_OR(index, gain, {0}), \ }; \ \ - DEVICE_DT_INST_DEFINE(index, dac_mcp4728_init, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(index, dac_mcp4728_init, NULL, NULL, \ &mcp4728_config_##index, \ POST_KERNEL, \ - CONFIG_DAC_MCP4728_INIT_PRIORITY, \ &mcp4728_driver_api); DT_INST_FOREACH_STATUS_OKAY(INST_DT_MCP4728); diff --git a/drivers/dac/dac_mcux_dac.c b/drivers/dac/dac_mcux_dac.c index 8af883c6e0cd4..d3a547c36817c 100644 --- a/drivers/dac/dac_mcux_dac.c +++ b/drivers/dac/dac_mcux_dac.c @@ -105,10 +105,9 @@ static const struct dac_driver_api mcux_dac_driver_api = { .low_power = DT_INST_PROP(n, low_power_mode), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, \ &mcux_dac_data_##n, \ &mcux_dac_config_##n, \ - POST_KERNEL, CONFIG_DAC_INIT_PRIORITY, \ - &mcux_dac_driver_api); + POST_KERNEL, &mcux_dac_driver_api); DT_INST_FOREACH_STATUS_OKAY(MCUX_DAC_INIT) diff --git a/drivers/dac/dac_mcux_dac32.c b/drivers/dac/dac_mcux_dac32.c index a1ba991b2c226..d06ecc94a25cd 100644 --- a/drivers/dac/dac_mcux_dac32.c +++ b/drivers/dac/dac_mcux_dac32.c @@ -123,10 +123,9 @@ static const struct dac_driver_api mcux_dac32_driver_api = { .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, mcux_dac32_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, mcux_dac32_init, NULL, \ &mcux_dac32_data_##n, \ &mcux_dac32_config_##n, \ - POST_KERNEL, CONFIG_DAC_INIT_PRIORITY, \ - &mcux_dac32_driver_api); + POST_KERNEL, &mcux_dac32_driver_api); DT_INST_FOREACH_STATUS_OKAY(MCUX_DAC32_INIT) diff --git a/drivers/dac/dac_mcux_gau.c b/drivers/dac/dac_mcux_gau.c index 6924132afe964..5a7dfe6daea33 100644 --- a/drivers/dac/dac_mcux_gau.c +++ b/drivers/dac/dac_mcux_gau.c @@ -112,10 +112,9 @@ static int nxp_gau_dac_init(const struct device *dev) }; \ \ \ - DEVICE_DT_INST_DEFINE(inst, &nxp_gau_dac_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &nxp_gau_dac_init, NULL, \ NULL, \ &nxp_gau_dac_##inst##_config, \ - POST_KERNEL, CONFIG_DAC_INIT_PRIORITY, \ - &nxp_gau_dac_driver_api); + POST_KERNEL, &nxp_gau_dac_driver_api); DT_INST_FOREACH_STATUS_OKAY(NXP_GAU_DAC_INIT) diff --git a/drivers/dac/dac_mcux_lpdac.c b/drivers/dac/dac_mcux_lpdac.c index 099033740e1bd..0128dca49a2e9 100644 --- a/drivers/dac/dac_mcux_lpdac.c +++ b/drivers/dac/dac_mcux_lpdac.c @@ -105,8 +105,7 @@ static const struct dac_driver_api mcux_lpdac_driver_api = { .low_power = DT_INST_PROP(n, low_power_mode), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, mcux_lpdac_init, NULL, &mcux_lpdac_data_##n, \ - &mcux_lpdac_config_##n, POST_KERNEL, CONFIG_DAC_INIT_PRIORITY, \ - &mcux_lpdac_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, mcux_lpdac_init, NULL, &mcux_lpdac_data_##n, \ + &mcux_lpdac_config_##n, POST_KERNEL, &mcux_lpdac_driver_api); DT_INST_FOREACH_STATUS_OKAY(MCUX_LPDAC_INIT) diff --git a/drivers/dac/dac_sam.c b/drivers/dac/dac_sam.c index 80fecfa3338e2..0fc3e593b9307 100644 --- a/drivers/dac/dac_sam.c +++ b/drivers/dac/dac_sam.c @@ -188,6 +188,5 @@ static const struct dac_sam_dev_cfg dacc_sam_config = { static struct dac_sam_dev_data dacc_sam_data; -DEVICE_DT_INST_DEFINE(0, dac_sam_init, NULL, &dacc_sam_data, &dacc_sam_config, - POST_KERNEL, CONFIG_DAC_INIT_PRIORITY, - &dac_sam_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, dac_sam_init, NULL, &dacc_sam_data, &dacc_sam_config, + POST_KERNEL, &dac_sam_driver_api); diff --git a/drivers/dac/dac_sam0.c b/drivers/dac/dac_sam0.c index d831eb44e75b3..1d3d1511c8a72 100644 --- a/drivers/dac/dac_sam0.c +++ b/drivers/dac/dac_sam0.c @@ -125,9 +125,8 @@ static const struct dac_driver_api api_sam0_driver_api = { .refsel = UTIL_CAT(SAM0_DAC_REFSEL_, SAM0_DAC_REFSEL(n)), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &dac_sam0_init, NULL, NULL, \ - &dac_sam0_cfg_##n, POST_KERNEL, \ - CONFIG_DAC_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &dac_sam0_init, NULL, NULL, \ + &dac_sam0_cfg_##n, POST_KERNEL, \ &api_sam0_driver_api) DT_INST_FOREACH_STATUS_OKAY(SAM0_DAC_INIT); diff --git a/drivers/dac/dac_stm32.c b/drivers/dac/dac_stm32.c index f2cbe9b15af5b..8a106cd4fa936 100644 --- a/drivers/dac/dac_stm32.c +++ b/drivers/dac/dac_stm32.c @@ -190,10 +190,9 @@ static struct dac_stm32_data dac_stm32_data_##index = { \ .channel_count = STM32_CHANNEL_COUNT \ }; \ \ -DEVICE_DT_INST_DEFINE(index, &dac_stm32_init, NULL, \ +DEVICE_INSTANCE_FROM_DT_INST(index, &dac_stm32_init, NULL, \ &dac_stm32_data_##index, \ &dac_stm32_cfg_##index, POST_KERNEL, \ - CONFIG_DAC_INIT_PRIORITY, \ &api_stm32_driver_api); DT_INST_FOREACH_STATUS_OKAY(STM32_DAC_INIT) diff --git a/drivers/dac/dac_test.c b/drivers/dac/dac_test.c index 24880c5bcc45f..cb9c632f27f5c 100644 --- a/drivers/dac/dac_test.c +++ b/drivers/dac/dac_test.c @@ -39,7 +39,7 @@ static int vnd_dac_init(const struct device *dev) } #define VND_DAC_INIT(index) \ - DEVICE_DT_INST_DEFINE(index, &vnd_dac_init, NULL, NULL, NULL, POST_KERNEL, \ - CONFIG_DAC_INIT_PRIORITY, &vnd_dac_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(index, &vnd_dac_init, NULL, NULL, NULL, POST_KERNEL, \ + &vnd_dac_driver_api); DT_INST_FOREACH_STATUS_OKAY(VND_DAC_INIT) diff --git a/drivers/dai/intel/alh/alh.c b/drivers/dai/intel/alh/alh.c index c371198787118..6acde4db67c28 100644 --- a/drivers/dai/intel/alh/alh.c +++ b/drivers/dai/intel/alh/alh.c @@ -219,11 +219,10 @@ static const struct dai_driver_api dai_intel_alh_api_funcs = { }, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ NULL, NULL, \ &dai_intel_alh_data_##n, \ &dai_intel_alh_config_##n, \ - POST_KERNEL, 32, \ - &dai_intel_alh_api_funcs); + POST_KERNEL, &dai_intel_alh_api_funcs); DT_INST_FOREACH_STATUS_OKAY(DAI_INTEL_ALH_DEVICE_INIT) diff --git a/drivers/dai/intel/dmic/dmic.c b/drivers/dai/intel/dmic/dmic.c index e528e96f38d12..080f478f0581f 100644 --- a/drivers/dai/intel/dmic/dmic.c +++ b/drivers/dai/intel/dmic/dmic.c @@ -931,13 +931,12 @@ static int dai_dmic_initialize_device(const struct device *dev) \ PM_DEVICE_DT_INST_DEFINE(n, dmic_pm_action); \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ dai_dmic_initialize_device, \ PM_DEVICE_DT_INST_GET(n), \ &dai_intel_dmic_data_##n, \ &dai_intel_dmic_properties_##n, \ POST_KERNEL, \ - CONFIG_DAI_INIT_PRIORITY, \ &dai_dmic_ops); DT_INST_FOREACH_STATUS_OKAY(DAI_INTEL_DMIC_DEVICE_INIT) diff --git a/drivers/dai/intel/hda/hda.c b/drivers/dai/intel/hda/hda.c index 220089d523df8..ed0205d5a919e 100644 --- a/drivers/dai/intel/hda/hda.c +++ b/drivers/dai/intel/hda/hda.c @@ -122,11 +122,10 @@ static const struct dai_driver_api dai_intel_hda_api_funcs = { \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ NULL, NULL, \ &dai_intel_hda_data_##n, \ &dai_intel_hda_config_##n, \ - POST_KERNEL, 32, \ - &dai_intel_hda_api_funcs); + POST_KERNEL, &dai_intel_hda_api_funcs); DT_INST_FOREACH_STATUS_OKAY(DAI_INTEL_HDA_DEVICE_INIT) diff --git a/drivers/dai/intel/ssp/ssp.c b/drivers/dai/intel/ssp/ssp.c index 0670003fff44f..1482d63055169 100644 --- a/drivers/dai/intel/ssp/ssp.c +++ b/drivers/dai/intel/ssp/ssp.c @@ -2723,11 +2723,10 @@ static struct dai_driver_api dai_intel_ssp_api_funcs = { \ PM_DEVICE_DT_INST_DEFINE(n, ssp_pm_action); \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ ssp_init, PM_DEVICE_DT_INST_GET(n), \ &dai_intel_ssp_data_##n, \ &dai_intel_ssp_config_##n, \ - POST_KERNEL, 42, \ - &dai_intel_ssp_api_funcs); + POST_KERNEL, &dai_intel_ssp_api_funcs); DT_INST_FOREACH_STATUS_OKAY(DAI_INTEL_SSP_DEVICE_INIT) diff --git a/drivers/dai/nxp/esai/esai.c b/drivers/dai/nxp/esai/esai.c index bcc0542f9eb35..980df84390220 100644 --- a/drivers/dai/nxp/esai/esai.c +++ b/drivers/dai/nxp/esai/esai.c @@ -756,9 +756,8 @@ static struct esai_data esai_data_##inst = { \ .cfg.dai_index = DT_INST_PROP_OR(inst, dai_index, 0), \ }; \ \ -DEVICE_DT_INST_DEFINE(inst, &esai_init, NULL, \ +DEVICE_INSTANCE_FROM_DT_INST(inst, &esai_init, NULL, \ &esai_data_##inst, &esai_config_##inst, \ - POST_KERNEL, CONFIG_DAI_INIT_PRIORITY, \ - &esai_api); \ + POST_KERNEL, &esai_api); \ DT_INST_FOREACH_STATUS_OKAY(ESAI_INIT); diff --git a/drivers/dai/nxp/sai/sai.c b/drivers/dai/nxp/sai/sai.c index 927e382688d32..4f838cf2ee115 100644 --- a/drivers/dai/nxp/sai/sai.c +++ b/drivers/dai/nxp/sai/sai.c @@ -992,9 +992,8 @@ static struct sai_data sai_data_##inst = { \ \ PM_DEVICE_DT_INST_DEFINE(inst, sai_pm_action); \ \ -DEVICE_DT_INST_DEFINE(inst, &sai_init, PM_DEVICE_DT_INST_GET(inst), \ +DEVICE_INSTANCE_FROM_DT_INST(inst, &sai_init, PM_DEVICE_DT_INST_GET(inst), \ &sai_data_##inst, &sai_config_##inst, \ - POST_KERNEL, CONFIG_DAI_INIT_PRIORITY, \ - &sai_api); \ + POST_KERNEL, &sai_api); \ DT_INST_FOREACH_STATUS_OKAY(SAI_INIT); diff --git a/drivers/disk/mmc_subsys.c b/drivers/disk/mmc_subsys.c index b8e81cd528f5e..3cc3974ccad59 100644 --- a/drivers/disk/mmc_subsys.c +++ b/drivers/disk/mmc_subsys.c @@ -134,13 +134,12 @@ static int disk_mmc_init(const struct device *dev) .disk_info = &mmc_disk_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ - &disk_mmc_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ + &disk_mmc_init, \ NULL, \ - &mmc_data_##n, \ + &mmc_data_##n, \ &mmc_config_##n, \ POST_KERNEL, \ - CONFIG_SD_INIT_PRIORITY, \ NULL); DT_INST_FOREACH_STATUS_OKAY(DISK_ACCESS_MMC_INIT) diff --git a/drivers/disk/nvme/nvme_controller.c b/drivers/disk/nvme/nvme_controller.c index e1d8c166c580d..5ae63b8dd245e 100644 --- a/drivers/disk/nvme/nvme_controller.c +++ b/drivers/disk/nvme/nvme_controller.c @@ -482,9 +482,9 @@ static int nvme_controller_init(const struct device *dev) DEVICE_PCIE_INST_INIT(n, pcie), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &nvme_controller_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &nvme_controller_init, \ NULL, &nvme_ctrlr_data_##n, \ &nvme_ctrlr_cfg_##n, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(NVME_CONTROLLER_DEVICE_INIT) diff --git a/drivers/disk/ramdisk.c b/drivers/disk/ramdisk.c index d4da37ea9d9d4..390cd6c961529 100644 --- a/drivers/disk/ramdisk.c +++ b/drivers/disk/ramdisk.c @@ -167,9 +167,8 @@ static const struct disk_operations ram_disk_ops = { \ RAMDISK_DEVICE_CONFIG_DEFINE(n); \ \ - DEVICE_DT_INST_DEFINE(n, disk_ram_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, disk_ram_init, NULL, \ &disk_info_##n, &disk_config_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &ram_disk_ops); + POST_KERNEL, &ram_disk_ops); DT_INST_FOREACH_STATUS_OKAY(RAMDISK_DEVICE_DEFINE) diff --git a/drivers/disk/sdmmc_stm32.c b/drivers/disk/sdmmc_stm32.c index 114e7d6b467ab..2b2a0a38def38 100644 --- a/drivers/disk/sdmmc_stm32.c +++ b/drivers/disk/sdmmc_stm32.c @@ -817,8 +817,7 @@ static struct stm32_sdmmc_priv stm32_sdmmc_priv_1 = { SDMMC_DMA_CHANNEL(tx, TX) }; -DEVICE_DT_INST_DEFINE(0, disk_stm32_sdmmc_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, disk_stm32_sdmmc_init, NULL, &stm32_sdmmc_priv_1, NULL, POST_KERNEL, - CONFIG_SD_INIT_PRIORITY, NULL); #endif diff --git a/drivers/disk/sdmmc_subsys.c b/drivers/disk/sdmmc_subsys.c index 500471d4d659d..95c58fb85efcd 100644 --- a/drivers/disk/sdmmc_subsys.c +++ b/drivers/disk/sdmmc_subsys.c @@ -135,13 +135,12 @@ static int disk_sdmmc_init(const struct device *dev) .disk_info = &sdmmc_disk_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &disk_sdmmc_init, \ NULL, \ &sdmmc_data_##n, \ &sdmmc_config_##n, \ POST_KERNEL, \ - CONFIG_SD_INIT_PRIORITY, \ NULL); DT_INST_FOREACH_STATUS_OKAY(DISK_ACCESS_SDMMC_INIT) diff --git a/drivers/display/display_dummy.c b/drivers/display/display_dummy.c index 1a11ee2bf36d7..42b5237c00fd6 100644 --- a/drivers/display/display_dummy.c +++ b/drivers/display/display_dummy.c @@ -124,11 +124,10 @@ static const struct display_driver_api dummy_display_api = { \ static struct dummy_display_data dd_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, &dummy_display_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &dummy_display_init, NULL, \ &dd_data_##n, \ &dd_config_##n, \ POST_KERNEL, \ - CONFIG_DISPLAY_INIT_PRIORITY, \ &dummy_display_api); \ DT_INST_FOREACH_STATUS_OKAY(DISPLAY_DUMMY_DEFINE) diff --git a/drivers/display/display_gc9x01x.c b/drivers/display/display_gc9x01x.c index 7a3ca1ea12eb6..e52f2fee24ba3 100644 --- a/drivers/display/display_gc9x01x.c +++ b/drivers/display/display_gc9x01x.c @@ -637,8 +637,8 @@ static const struct display_driver_api gc9x01x_api = { }; \ static struct gc9x01x_data gc9x01x_data_##inst; \ PM_DEVICE_DT_INST_DEFINE(inst, gc9x01x_pm_action); \ - DEVICE_DT_INST_DEFINE(inst, &gc9x01x_init, PM_DEVICE_DT_INST_GET(inst), \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &gc9x01x_init, PM_DEVICE_DT_INST_GET(inst), \ &gc9x01x_data_##inst, &gc9x01x_config_##inst, POST_KERNEL, \ - CONFIG_DISPLAY_INIT_PRIORITY, &gc9x01x_api); + &gc9x01x_api); DT_INST_FOREACH_STATUS_OKAY(GC9X01X_INIT) diff --git a/drivers/display/display_hx8394.c b/drivers/display/display_hx8394.c index e6e67161d32b9..a9b09b78e2ccc 100644 --- a/drivers/display/display_hx8394.c +++ b/drivers/display/display_hx8394.c @@ -791,13 +791,12 @@ static int hx8394_init(const struct device *dev) .panel_height = DT_INST_PROP(id, height), \ .channel = DT_INST_REG_ADDR(id), \ }; \ - DEVICE_DT_INST_DEFINE(id, \ + DEVICE_INSTANCE_FROM_DT_INST(id, \ &hx8394_init, \ NULL, \ NULL, \ &hx8394_config_##id, \ POST_KERNEL, \ - CONFIG_APPLICATION_INIT_PRIORITY, \ &hx8394_api); DT_INST_FOREACH_STATUS_OKAY(HX8394_PANEL) diff --git a/drivers/display/display_ili9xxx.c b/drivers/display/display_ili9xxx.c index b5bbc9733278f..99a528f2be965 100644 --- a/drivers/display/display_ili9xxx.c +++ b/drivers/display/display_ili9xxx.c @@ -541,10 +541,9 @@ static const struct ili9xxx_quirks ili9488_quirks = { \ static struct ili9xxx_data ili9xxx_data_##n; \ \ - DEVICE_DT_DEFINE(INST_DT_ILI9XXX(n, t), ili9xxx_init, \ + DEVICE_INSTANCE(INST_DT_ILI9XXX(n, t), ili9xxx_init, \ NULL, &ili9xxx_data_##n, \ - &ili9xxx_config_##n, POST_KERNEL, \ - CONFIG_DISPLAY_INIT_PRIORITY, &ili9xxx_api) + &ili9xxx_config_##n, POST_KERNEL, &ili9xxx_api) #define DT_INST_FOREACH_ILI9XXX_STATUS_OKAY(t) \ LISTIFY(DT_NUM_INST_STATUS_OKAY(ilitek_ili##t), ILI9XXX_INIT, (;), t) diff --git a/drivers/display/display_intel_multibootfb.c b/drivers/display/display_intel_multibootfb.c index e2b93b60940c7..9abacd908b53f 100644 --- a/drivers/display/display_intel_multibootfb.c +++ b/drivers/display/display_intel_multibootfb.c @@ -155,6 +155,5 @@ static const struct framebuf_dev_config config = { static struct framebuf_dev_data data; -DEVICE_DT_INST_DEFINE(0, multiboot_framebuf_init, NULL, &data, &config, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &framebuf_display_api); +DEVICE_INSTANCE_FROM_DT_INST(0, multiboot_framebuf_init, NULL, &data, &config, + PRE_KERNEL_1, &framebuf_display_api); diff --git a/drivers/display/display_ist3931.c b/drivers/display/display_ist3931.c index 6170207653a76..33e4752b6bf68 100644 --- a/drivers/display/display_ist3931.c +++ b/drivers/display/display_ist3931.c @@ -283,7 +283,7 @@ static const struct display_driver_api ist3931_api = { .y_offset = DT_INST_PROP(inst, y_offset), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &ist3931_init, NULL, NULL, &ist3931_config_##inst, \ - POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, &ist3931_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, &ist3931_init, NULL, NULL, &ist3931_config_##inst, \ + POST_KERNEL, &ist3931_api); DT_INST_FOREACH_STATUS_OKAY(IST3931_INIT) diff --git a/drivers/display/display_led_strip_matrix.c b/drivers/display/display_led_strip_matrix.c index 0f562eeb66cd3..b5770542e644e 100644 --- a/drivers/display/display_led_strip_matrix.c +++ b/drivers/display/display_led_strip_matrix.c @@ -276,8 +276,7 @@ static int led_strip_matrix_init(const struct device *dev) BUILD_ASSERT((DT_INST_PROP(inst, height) % DT_INST_PROP(inst, vertical_modules)) == 0); \ LISTIFY(DT_INST_PROP_LEN(inst, led_strips), VALIDATE_CHAIN_LENGTH, (;), inst); \ \ - DEVICE_DT_INST_DEFINE(inst, led_strip_matrix_init, NULL, NULL, &dd_config_##inst, \ - POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY, \ - &led_strip_matrix_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, led_strip_matrix_init, NULL, NULL, &dd_config_##inst, \ + POST_KERNEL, &led_strip_matrix_api); DT_INST_FOREACH_STATUS_OKAY(LED_STRIP_MATRIX_DEFINE) diff --git a/drivers/display/display_max7219.c b/drivers/display/display_max7219.c index f3ccc52c9d49d..f42ccae70a0d1 100644 --- a/drivers/display/display_max7219.c +++ b/drivers/display/display_max7219.c @@ -337,8 +337,8 @@ static int max7219_init(const struct device *dev) .intensity = DT_INST_PROP(n, intensity), \ .scan_limit = DT_INST_PROP(n, scan_limit), \ }; \ - DEVICE_DT_INST_DEFINE(n, max7219_init, NULL, &max7219_data_##n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, max7219_init, NULL, &max7219_data_##n, \ &max7219_config_##n, POST_KERNEL, \ - CONFIG_DISPLAY_INIT_PRIORITY, &max7219_api); + &max7219_api); DT_INST_FOREACH_STATUS_OKAY(DISPLAY_MAX7219_INIT) diff --git a/drivers/display/display_mcux_dcnano_lcdif.c b/drivers/display/display_mcux_dcnano_lcdif.c index 27a357fa64cca..cf907727200ad 100644 --- a/drivers/display/display_mcux_dcnano_lcdif.c +++ b/drivers/display/display_mcux_dcnano_lcdif.c @@ -338,13 +338,12 @@ static const struct display_driver_api mcux_dcnano_lcdif_api = { .fb_ptr = MCUX_DCNANO_LCDIF_FRAMEBUFFER(n), \ .fb_bytes = MCUX_DCNANO_LCDIF_FB_SIZE(n), \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &mcux_dcnano_lcdif_init, \ NULL, \ &mcux_dcnano_lcdif_data_##n, \ &mcux_dcnano_lcdif_config_##n, \ POST_KERNEL, \ - CONFIG_DISPLAY_INIT_PRIORITY, \ &mcux_dcnano_lcdif_api); DT_INST_FOREACH_STATUS_OKAY(MCUX_DCNANO_LCDIF_DEVICE_INIT) diff --git a/drivers/display/display_mcux_elcdif.c b/drivers/display/display_mcux_elcdif.c index b38a1f65b2f23..c99a28fc0967f 100644 --- a/drivers/display/display_mcux_elcdif.c +++ b/drivers/display/display_mcux_elcdif.c @@ -404,9 +404,8 @@ static const struct display_driver_api mcux_elcdif_api = { .next_idx = 0, \ .pixel_format = DT_INST_PROP(id, pixel_format), \ }; \ - DEVICE_DT_INST_DEFINE(id, &mcux_elcdif_init, NULL, &mcux_elcdif_data_##id, \ - &mcux_elcdif_config_##id, POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, \ - &mcux_elcdif_api); \ + DEVICE_INSTANCE_FROM_DT_INST(id, &mcux_elcdif_init, NULL, &mcux_elcdif_data_##id, \ + &mcux_elcdif_config_##id, POST_KERNEL, &mcux_elcdif_api); \ static void mcux_elcdif_config_func_##id(const struct device *dev) \ { \ IRQ_CONNECT(DT_INST_IRQN(id), DT_INST_IRQ(id, priority), mcux_elcdif_isr, \ diff --git a/drivers/display/display_nrf_led_matrix.c b/drivers/display/display_nrf_led_matrix.c index d88bc760e76ad..71fce8bccd934 100644 --- a/drivers/display/display_nrf_led_matrix.c +++ b/drivers/display/display_nrf_led_matrix.c @@ -560,7 +560,7 @@ static const struct display_drv_config instance_config = { #endif }; -DEVICE_DT_DEFINE(MATRIX_NODE, +DEVICE_INSTANCE(MATRIX_NODE, instance_init, NULL, &instance_data, &instance_config, - POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, &driver_api); + POST_KERNEL, &driver_api); diff --git a/drivers/display/display_nt35510.c b/drivers/display/display_nt35510.c index 6d0bb85fecbca..88d9e4bc1d025 100644 --- a/drivers/display/display_nt35510.c +++ b/drivers/display/display_nt35510.c @@ -433,7 +433,7 @@ static const struct display_driver_api nt35510_api = { static struct nt35510_data nt35510_data_##n = { \ .pixel_format = DT_INST_PROP(n, pixel_format), \ }; \ - DEVICE_DT_INST_DEFINE(n, &nt35510_init, NULL, &nt35510_data_##n, &nt35510_config_##n, \ - POST_KERNEL, CONFIG_DISPLAY_NT35510_INIT_PRIORITY, &nt35510_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &nt35510_init, NULL, &nt35510_data_##n, &nt35510_config_##n,\ + POST_KERNEL, &nt35510_api); DT_INST_FOREACH_STATUS_OKAY(NT35510_DEFINE) diff --git a/drivers/display/display_otm8009a.c b/drivers/display/display_otm8009a.c index 5f00ac3a13c5b..841130f7d21d8 100644 --- a/drivers/display/display_otm8009a.c +++ b/drivers/display/display_otm8009a.c @@ -713,8 +713,8 @@ static int otm8009a_init(const struct device *dev) static struct otm8009a_data otm8009a_data_##inst = { \ .dsi_pixel_format = DT_INST_PROP(inst, pixel_format), \ }; \ - DEVICE_DT_INST_DEFINE(inst, &otm8009a_init, NULL, &otm8009a_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &otm8009a_init, NULL, &otm8009a_data_##inst, \ &otm8009a_config_##inst, POST_KERNEL, \ - CONFIG_DISPLAY_OTM8009A_INIT_PRIORITY, &otm8009a_api); \ + &otm8009a_api); \ DT_INST_FOREACH_STATUS_OKAY(OTM8009A_DEVICE) diff --git a/drivers/display/display_renesas_lcdc.c b/drivers/display/display_renesas_lcdc.c index b51ba33585abe..75f882958fe25 100644 --- a/drivers/display/display_renesas_lcdc.c +++ b/drivers/display/display_renesas_lcdc.c @@ -671,11 +671,10 @@ static const struct display_driver_api display_smartbond_driver_api = { }; \ \ \ - DEVICE_DT_INST_DEFINE(inst, display_smartbond_init, PM_DEVICE_DT_INST_GET(inst), \ - &display_smartbond_data_## inst, \ - &display_smartbond_config_## inst, \ - POST_KERNEL, \ - CONFIG_DISPLAY_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, display_smartbond_init, PM_DEVICE_DT_INST_GET(inst),\ + &display_smartbond_data_## inst, \ + &display_smartbond_config_## inst, \ + POST_KERNEL, \ &display_smartbond_driver_api); SMARTBOND_DISPLAY_INIT(0); diff --git a/drivers/display/display_rm67162.c b/drivers/display/display_rm67162.c index e63a44618101d..2bee68716cbbd 100644 --- a/drivers/display/display_rm67162.c +++ b/drivers/display/display_rm67162.c @@ -600,13 +600,12 @@ static const struct display_driver_api rm67162_api = { .pixel_format = DT_INST_PROP(id, pixel_format), \ }; \ PM_DEVICE_DT_INST_DEFINE(id, rm67162_pm_action); \ - DEVICE_DT_INST_DEFINE(id, \ + DEVICE_INSTANCE_FROM_DT_INST(id, \ &rm67162_init, \ PM_DEVICE_DT_INST_GET(id), \ &rm67162_data_##id, \ &rm67162_config_##id, \ POST_KERNEL, \ - CONFIG_APPLICATION_INIT_PRIORITY, \ &rm67162_api); DT_INST_FOREACH_STATUS_OKAY(RM67162_PANEL) diff --git a/drivers/display/display_rm68200.c b/drivers/display/display_rm68200.c index 7048790bdf396..f8b782ab882e0 100644 --- a/drivers/display/display_rm68200.c +++ b/drivers/display/display_rm68200.c @@ -1043,13 +1043,12 @@ static int rm68200_init(const struct device *dev) .panel_height = DT_INST_PROP(id, height), \ .channel = DT_INST_REG_ADDR(id), \ }; \ - DEVICE_DT_INST_DEFINE(id, \ + DEVICE_INSTANCE_FROM_DT_INST(id, \ &rm68200_init, \ NULL, \ NULL, \ &rm68200_config_##id, \ POST_KERNEL, \ - CONFIG_APPLICATION_INIT_PRIORITY, \ &rm68200_api); DT_INST_FOREACH_STATUS_OKAY(RM68200_PANEL) diff --git a/drivers/display/display_sdl.c b/drivers/display/display_sdl.c index 125c5624ef02e..57b1065f5dec5 100644 --- a/drivers/display/display_sdl.c +++ b/drivers/display/display_sdl.c @@ -525,11 +525,10 @@ static const struct display_driver_api sdl_display_api = { .read_buf = sdl_read_buf_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &sdl_display_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &sdl_display_init, NULL, \ &sdl_data_##n, \ &sdl_config_##n, \ POST_KERNEL, \ - CONFIG_DISPLAY_INIT_PRIORITY, \ &sdl_display_api); \ \ static void sdl_display_cleanup_##n(void) \ diff --git a/drivers/display/display_st7735r.c b/drivers/display/display_st7735r.c index a12ddf3ecfbc4..30484ad3aedf1 100644 --- a/drivers/display/display_st7735r.c +++ b/drivers/display/display_st7735r.c @@ -527,9 +527,8 @@ static const struct display_driver_api st7735r_api = { \ PM_DEVICE_DT_INST_DEFINE(inst, st7735r_pm_action); \ \ - DEVICE_DT_INST_DEFINE(inst, st7735r_init, PM_DEVICE_DT_INST_GET(inst), \ + DEVICE_INSTANCE_FROM_DT_INST(inst, st7735r_init, PM_DEVICE_DT_INST_GET(inst),\ &st7735r_data_ ## inst, &st7735r_config_ ## inst, \ - POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, \ - &st7735r_api); + POST_KERNEL, &st7735r_api); DT_INST_FOREACH_STATUS_OKAY(ST7735R_INIT) diff --git a/drivers/display/display_st7789v.c b/drivers/display/display_st7789v.c index 95fc6b5bda0ce..85a18ee3aab0a 100644 --- a/drivers/display/display_st7789v.c +++ b/drivers/display/display_st7789v.c @@ -407,9 +407,8 @@ static const struct display_driver_api st7789v_api = { \ PM_DEVICE_DT_INST_DEFINE(inst, st7789v_pm_action); \ \ - DEVICE_DT_INST_DEFINE(inst, &st7789v_init, PM_DEVICE_DT_INST_GET(inst), \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &st7789v_init, PM_DEVICE_DT_INST_GET(inst), \ &st7789v_data_ ## inst, &st7789v_config_ ## inst, \ - POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, \ - &st7789v_api); + POST_KERNEL, &st7789v_api); DT_INST_FOREACH_STATUS_OKAY(ST7789V_INIT) diff --git a/drivers/display/display_st7796s.c b/drivers/display/display_st7796s.c index f7c31cde347d5..4075d0530250a 100644 --- a/drivers/display/display_st7796s.c +++ b/drivers/display/display_st7796s.c @@ -387,11 +387,10 @@ static const struct display_driver_api st7796s_api = { .rgb_is_inverted = DT_INST_PROP(n, rgb_is_inverted), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, st7796s_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, st7796s_init, \ NULL, \ NULL, \ &st7796s_config_##n, \ - POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, \ - &st7796s_api); + POST_KERNEL, &st7796s_api); DT_INST_FOREACH_STATUS_OKAY(ST7796S_INIT) diff --git a/drivers/display/display_stm32_ltdc.c b/drivers/display/display_stm32_ltdc.c index 068c9e9eb0c7b..0e88e27115395 100644 --- a/drivers/display/display_stm32_ltdc.c +++ b/drivers/display/display_stm32_ltdc.c @@ -623,13 +623,12 @@ static const struct display_driver_api stm32_ltdc_display_api = { .display_controller = DEVICE_DT_GET_OR_NULL( \ DT_INST_PHANDLE(inst, display_controller)), \ }; \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &stm32_ltdc_init, \ PM_DEVICE_DT_INST_GET(inst), \ &stm32_ltdc_data_##inst, \ &stm32_ltdc_config_##inst, \ POST_KERNEL, \ - CONFIG_DISPLAY_INIT_PRIORITY, \ &stm32_ltdc_display_api); DT_INST_FOREACH_STATUS_OKAY(STM32_LTDC_DEVICE) diff --git a/drivers/display/ls0xx.c b/drivers/display/ls0xx.c index 0616148e93267..f12ee4590ae03 100644 --- a/drivers/display/ls0xx.c +++ b/drivers/display/ls0xx.c @@ -286,5 +286,5 @@ static const struct display_driver_api ls0xx_driver_api = { .set_pixel_format = ls0xx_set_pixel_format, }; -DEVICE_DT_INST_DEFINE(0, ls0xx_init, NULL, NULL, &ls0xx_config, POST_KERNEL, - CONFIG_DISPLAY_INIT_PRIORITY, &ls0xx_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, ls0xx_init, NULL, NULL, &ls0xx_config, POST_KERNEL, + &ls0xx_driver_api); diff --git a/drivers/display/ssd1306.c b/drivers/display/ssd1306.c index 4f3d6b813490b..d04420927e433 100644 --- a/drivers/display/ssd1306.c +++ b/drivers/display/ssd1306.c @@ -524,8 +524,8 @@ static const struct display_driver_api ssd1306_driver_api = { (SSD1306_CONFIG_I2C(node_id))) \ }; \ \ - DEVICE_DT_DEFINE(node_id, ssd1306_init, NULL, &data##node_id, &config##node_id, \ - POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, &ssd1306_driver_api); + DEVICE_INSTANCE(node_id, ssd1306_init, NULL, &data##node_id, &config##node_id, \ + POST_KERNEL, &ssd1306_driver_api); DT_FOREACH_STATUS_OKAY(solomon_ssd1306fb, SSD1306_DEFINE) DT_FOREACH_STATUS_OKAY(sinowealth_sh1106, SSD1306_DEFINE) diff --git a/drivers/display/ssd1322.c b/drivers/display/ssd1322.c index 9dee7d3d4c5f5..eb0d593151fc5 100644 --- a/drivers/display/ssd1322.c +++ b/drivers/display/ssd1322.c @@ -386,7 +386,7 @@ static struct display_driver_api ssd1322_driver_api = { .conversion_buf_size = sizeof(conversion_buf##node_id), \ }; \ \ - DEVICE_DT_DEFINE(node_id, ssd1322_init, NULL, NULL, &config##node_id, POST_KERNEL, \ - CONFIG_DISPLAY_INIT_PRIORITY, &ssd1322_driver_api); + DEVICE_INSTANCE(node_id, ssd1322_init, NULL, NULL, &config##node_id, POST_KERNEL, \ + &ssd1322_driver_api); DT_FOREACH_STATUS_OKAY(solomon_ssd1322, SSD1322_DEFINE) diff --git a/drivers/display/ssd1327.c b/drivers/display/ssd1327.c index 65c9054c66e98..0ac6acf22a4ed 100644 --- a/drivers/display/ssd1327.c +++ b/drivers/display/ssd1327.c @@ -346,7 +346,7 @@ static struct display_driver_api ssd1327_driver_api = { .color_inversion = DT_PROP(node_id, inversion_on), \ }; \ \ - DEVICE_DT_DEFINE(node_id, ssd1327_init, NULL, &data##node_id, &config##node_id, \ - POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, &ssd1327_driver_api); + DEVICE_INSTANCE(node_id, ssd1327_init, NULL, &data##node_id, &config##node_id, \ + POST_KERNEL, &ssd1327_driver_api); DT_FOREACH_STATUS_OKAY(solomon_ssd1327fb, SSD1327_DEFINE) diff --git a/drivers/display/ssd16xx.c b/drivers/display/ssd16xx.c index 7dfaa1211771b..1ed787bfa9c18 100644 --- a/drivers/display/ssd16xx.c +++ b/drivers/display/ssd16xx.c @@ -1075,12 +1075,11 @@ static struct ssd16xx_quirks quirks_solomon_ssd1681 = { \ static struct ssd16xx_data ssd16xx_data_ ## n; \ \ - DEVICE_DT_DEFINE(n, \ + DEVICE_INSTANCE(n, \ ssd16xx_init, NULL, \ &ssd16xx_data_ ## n, \ &ssd16xx_cfg_ ## n, \ POST_KERNEL, \ - CONFIG_DISPLAY_INIT_PRIORITY, \ &ssd16xx_driver_api) DT_FOREACH_STATUS_OKAY_VARGS(solomon_ssd1608, SSD16XX_DEFINE, diff --git a/drivers/display/uc81xx.c b/drivers/display/uc81xx.c index cac7d1d20c67c..4a028440cd639 100644 --- a/drivers/display/uc81xx.c +++ b/drivers/display/uc81xx.c @@ -797,11 +797,10 @@ static const struct display_driver_api uc81xx_driver_api = { \ static struct uc81xx_data uc81xx_data_##n = {}; \ \ - DEVICE_DT_DEFINE(n, uc81xx_init, NULL, \ + DEVICE_INSTANCE(n, uc81xx_init, NULL, \ &uc81xx_data_ ## n, \ &uc81xx_cfg_ ## n, \ POST_KERNEL, \ - CONFIG_DISPLAY_INIT_PRIORITY, \ &uc81xx_driver_api); DT_FOREACH_STATUS_OKAY_VARGS(ultrachip_uc8175, UC81XX_DEFINE, diff --git a/drivers/dma/dma_andes_atcdmac300.c b/drivers/dma/dma_andes_atcdmac300.c index 8f67a3cacd901..8877876a3df48 100644 --- a/drivers/dma/dma_andes_atcdmac300.c +++ b/drivers/dma/dma_andes_atcdmac300.c @@ -513,13 +513,12 @@ static const struct dma_driver_api dma_atcdmac300_api = { \ static struct dma_atcdmac300_data dma_data_##n; \ \ - DEVICE_DT_INST_DEFINE(0, \ + DEVICE_INSTANCE_FROM_DT_INST(0, \ dma_atcdmac300_init, \ NULL, \ &dma_data_##n, \ &dma_config_##n, \ POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &dma_atcdmac300_api); \ \ static void dma_atcdmac300_irq_config_##n(void) \ diff --git a/drivers/dma/dma_dw.c b/drivers/dma/dma_dw.c index 138f428049cd9..97be4c1d62e08 100644 --- a/drivers/dma/dma_dw.c +++ b/drivers/dma/dma_dw.c @@ -104,12 +104,11 @@ static const struct dma_driver_api dw_dma_driver_api = { .channel_data = &dmac##inst, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &dw_dma_init, \ NULL, \ &dw_dma##inst##_data, \ &dw_dma##inst##_config, POST_KERNEL, \ - CONFIG_DMA_INIT_PRIORITY, \ &dw_dma_driver_api); \ \ static void dw_dma##inst##_irq_config(void) \ diff --git a/drivers/dma/dma_dw_axi.c b/drivers/dma/dma_dw_axi.c index 917f7008876ac..dd3ae086058ec 100644 --- a/drivers/dma/dma_dw_axi.c +++ b/drivers/dma/dma_dw_axi.c @@ -896,12 +896,11 @@ static const struct dma_driver_api dma_dw_axi_driver_api = { .irq_config = dw_dma_irq_config_##inst, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &dma_dw_axi_init, \ NULL, \ &dma_dw_axi_data_##inst, \ &dma_dw_axi_config_##inst, POST_KERNEL, \ - CONFIG_DMA_INIT_PRIORITY, \ &dma_dw_axi_driver_api); \ \ static void dw_dma_irq_config_##inst(void) \ diff --git a/drivers/dma/dma_emul.c b/drivers/dma/dma_emul.c index 60c3486bf36bc..96ab54b8baf1e 100644 --- a/drivers/dma/dma_emul.c +++ b/drivers/dma/dma_emul.c @@ -610,8 +610,8 @@ static int dma_emul_init(const struct device *dev) \ PM_DEVICE_DT_INST_DEFINE(_inst, dma_emul_pm_device_pm_action); \ \ - DEVICE_DT_INST_DEFINE(_inst, dma_emul_init, PM_DEVICE_DT_INST_GET(_inst), \ + DEVICE_INSTANCE_FROM_DT_INST(_inst, dma_emul_init, PM_DEVICE_DT_INST_GET(_inst), \ &dma_emul_data_##_inst, &dma_emul_config_##_inst, POST_KERNEL, \ - CONFIG_DMA_INIT_PRIORITY, &dma_emul_driver_api); + &dma_emul_driver_api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_DMA_EMUL) diff --git a/drivers/dma/dma_esp32_gdma.c b/drivers/dma/dma_esp32_gdma.c index 7fb5da72b43b6..82ca34d0facbb 100644 --- a/drivers/dma/dma_esp32_gdma.c +++ b/drivers/dma/dma_esp32_gdma.c @@ -701,7 +701,7 @@ static void *irq_handlers[] = { }, \ }; \ \ - DEVICE_DT_INST_DEFINE(idx, &dma_esp32_init, NULL, &dma_data_##idx, &dma_config_##idx, \ - PRE_KERNEL_1, CONFIG_DMA_INIT_PRIORITY, &dma_esp32_api); + DEVICE_INSTANCE_FROM_DT_INST(idx, &dma_esp32_init, NULL, &dma_data_##idx, &dma_config_##idx,\ + PRE_KERNEL_1, &dma_esp32_api); DT_INST_FOREACH_STATUS_OKAY(DMA_ESP32_INIT) diff --git a/drivers/dma/dma_gd32.c b/drivers/dma/dma_gd32.c index 1bea14bb32ad3..c372a62ea4ad3 100644 --- a/drivers/dma/dma_gd32.c +++ b/drivers/dma/dma_gd32.c @@ -696,9 +696,9 @@ static const struct dma_driver_api dma_gd32_driver_api = { .channels = dma_gd32##inst##_channels, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &dma_gd32_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &dma_gd32_init, NULL, \ &dma_gd32##inst##_data, \ &dma_gd32##inst##_config, POST_KERNEL, \ - CONFIG_DMA_INIT_PRIORITY, &dma_gd32_driver_api); + &dma_gd32_driver_api); DT_INST_FOREACH_STATUS_OKAY(GD32_DMA_INIT) diff --git a/drivers/dma/dma_intel_adsp_gpdma.c b/drivers/dma/dma_intel_adsp_gpdma.c index bed6296adf8fd..c8a700153d77b 100644 --- a/drivers/dma/dma_intel_adsp_gpdma.c +++ b/drivers/dma/dma_intel_adsp_gpdma.c @@ -554,12 +554,11 @@ static const struct dma_driver_api intel_adsp_gpdma_driver_api = { \ PM_DEVICE_DT_INST_DEFINE(inst, gpdma_pm_action); \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &intel_adsp_gpdma_init, \ PM_DEVICE_DT_INST_GET(inst), \ &intel_adsp_gpdma##inst##_data, \ &intel_adsp_gpdma##inst##_config, POST_KERNEL,\ - CONFIG_DMA_INIT_PRIORITY, \ &intel_adsp_gpdma_driver_api); \ \ static void intel_adsp_gpdma##inst##_irq_config(void) \ diff --git a/drivers/dma/dma_intel_adsp_hda_host_in.c b/drivers/dma/dma_intel_adsp_hda_host_in.c index a6114b0540426..99b06511fa03d 100644 --- a/drivers/dma/dma_intel_adsp_hda_host_in.c +++ b/drivers/dma/dma_intel_adsp_hda_host_in.c @@ -35,12 +35,11 @@ static const struct dma_driver_api intel_adsp_hda_dma_host_in_api = { \ PM_DEVICE_DT_INST_DEFINE(inst, intel_adsp_hda_dma_pm_action); \ \ - DEVICE_DT_INST_DEFINE(inst, &intel_adsp_hda_dma_init, \ - PM_DEVICE_DT_INST_GET(inst), \ - &intel_adsp_hda_dma##inst##_data, \ - &intel_adsp_hda_dma##inst##_config, POST_KERNEL, \ - CONFIG_DMA_INIT_PRIORITY, \ - &intel_adsp_hda_dma_host_in_api); \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &intel_adsp_hda_dma_init, \ + PM_DEVICE_DT_INST_GET(inst), \ + &intel_adsp_hda_dma##inst##_data, \ + &intel_adsp_hda_dma##inst##_config, POST_KERNEL, \ + &intel_adsp_hda_dma_host_in_api); \ \ static void intel_adsp_hda_dma##inst##_irq_config(void) \ { \ diff --git a/drivers/dma/dma_intel_adsp_hda_host_out.c b/drivers/dma/dma_intel_adsp_hda_host_out.c index f06d177ed2963..471672a43ed01 100644 --- a/drivers/dma/dma_intel_adsp_hda_host_out.c +++ b/drivers/dma/dma_intel_adsp_hda_host_out.c @@ -39,12 +39,11 @@ static const struct dma_driver_api intel_adsp_hda_dma_host_out_api = { \ PM_DEVICE_DT_INST_DEFINE(inst, intel_adsp_hda_dma_pm_action); \ \ - DEVICE_DT_INST_DEFINE(inst, &intel_adsp_hda_dma_init, \ - PM_DEVICE_DT_INST_GET(inst), \ - &intel_adsp_hda_dma##inst##_data, \ - &intel_adsp_hda_dma##inst##_config, POST_KERNEL, \ - CONFIG_DMA_INIT_PRIORITY, \ - &intel_adsp_hda_dma_host_out_api); \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &intel_adsp_hda_dma_init, \ + PM_DEVICE_DT_INST_GET(inst), \ + &intel_adsp_hda_dma##inst##_data, \ + &intel_adsp_hda_dma##inst##_config, POST_KERNEL, \ + &intel_adsp_hda_dma_host_out_api); \ \ static void intel_adsp_hda_dma##inst##_irq_config(void) \ { \ diff --git a/drivers/dma/dma_intel_adsp_hda_link_in.c b/drivers/dma/dma_intel_adsp_hda_link_in.c index fc631d136f0c7..2ddcac3cd909e 100644 --- a/drivers/dma/dma_intel_adsp_hda_link_in.c +++ b/drivers/dma/dma_intel_adsp_hda_link_in.c @@ -37,11 +37,10 @@ static const struct dma_driver_api intel_adsp_hda_dma_link_in_api = { \ PM_DEVICE_DT_INST_DEFINE(inst, intel_adsp_hda_dma_pm_action); \ \ - DEVICE_DT_INST_DEFINE(inst, &intel_adsp_hda_dma_init, \ - PM_DEVICE_DT_INST_GET(inst), \ - &intel_adsp_hda_dma##inst##_data, \ - &intel_adsp_hda_dma##inst##_config, POST_KERNEL, \ - CONFIG_DMA_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &intel_adsp_hda_dma_init, \ + PM_DEVICE_DT_INST_GET(inst), \ + &intel_adsp_hda_dma##inst##_data, \ + &intel_adsp_hda_dma##inst##_config, POST_KERNEL, \ &intel_adsp_hda_dma_link_in_api); DT_INST_FOREACH_STATUS_OKAY(INTEL_ADSP_HDA_DMA_LINK_IN_INIT) diff --git a/drivers/dma/dma_intel_adsp_hda_link_out.c b/drivers/dma/dma_intel_adsp_hda_link_out.c index eefa50189f0ec..4ec55f2849f2b 100644 --- a/drivers/dma/dma_intel_adsp_hda_link_out.c +++ b/drivers/dma/dma_intel_adsp_hda_link_out.c @@ -37,11 +37,10 @@ static const struct dma_driver_api intel_adsp_hda_dma_link_out_api = { \ PM_DEVICE_DT_INST_DEFINE(inst, intel_adsp_hda_dma_pm_action); \ \ - DEVICE_DT_INST_DEFINE(inst, &intel_adsp_hda_dma_init, \ - PM_DEVICE_DT_INST_GET(inst), \ - &intel_adsp_hda_dma##inst##_data, \ - &intel_adsp_hda_dma##inst##_config, POST_KERNEL, \ - CONFIG_DMA_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &intel_adsp_hda_dma_init, \ + PM_DEVICE_DT_INST_GET(inst), \ + &intel_adsp_hda_dma##inst##_data, \ + &intel_adsp_hda_dma##inst##_config, POST_KERNEL, \ &intel_adsp_hda_dma_link_out_api); DT_INST_FOREACH_STATUS_OKAY(INTEL_ADSP_HDA_DMA_LINK_OUT_INIT) diff --git a/drivers/dma/dma_intel_lpss.c b/drivers/dma/dma_intel_lpss.c index ad004fc1cf865..6c9cb0212758a 100644 --- a/drivers/dma/dma_intel_lpss.c +++ b/drivers/dma/dma_intel_lpss.c @@ -161,12 +161,11 @@ static const struct dma_driver_api dma_intel_lpss_driver_api = { .channel_data = &dma_intel_lpss##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ NULL, \ NULL, \ &dma_intel_lpss##n##_data, \ &dma_intel_lpss##n##_config, PRE_KERNEL_1, \ - CONFIG_DMA_INIT_PRIORITY, \ &dma_intel_lpss_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(DMA_INTEL_LPSS_INIT) diff --git a/drivers/dma/dma_iproc_pax_v1.c b/drivers/dma/dma_iproc_pax_v1.c index 9acfeabd37481..5203d80249042 100644 --- a/drivers/dma/dma_iproc_pax_v1.c +++ b/drivers/dma/dma_iproc_pax_v1.c @@ -981,11 +981,10 @@ static const struct dma_iproc_pax_cfg pax_dma_cfg = { .pcie_dev = DEVICE_DT_GET(DT_INST_PHANDLE(0, pcie_ep)), }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, &dma_iproc_pax_init, NULL, &pax_dma_data, &pax_dma_cfg, POST_KERNEL, - CONFIG_DMA_INIT_PRIORITY, &pax_dma_driver_api); diff --git a/drivers/dma/dma_iproc_pax_v2.c b/drivers/dma/dma_iproc_pax_v2.c index 556af62ae75e9..d5efa2b8dd0d0 100644 --- a/drivers/dma/dma_iproc_pax_v2.c +++ b/drivers/dma/dma_iproc_pax_v2.c @@ -1097,11 +1097,10 @@ static const struct dma_iproc_pax_cfg pax_dma_cfg = { .pcie_dev = DEVICE_DT_GET(DT_INST_PHANDLE(0, pcie_ep)), }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, &dma_iproc_pax_init, NULL, &pax_dma_data, &pax_dma_cfg, POST_KERNEL, - CONFIG_DMA_IPROC_PAX_V2_INIT_PRIORITY, &pax_dma_driver_api); diff --git a/drivers/dma/dma_max32.c b/drivers/dma/dma_max32.c index 100c14629bf18..9938ae9818610 100644 --- a/drivers/dma/dma_max32.c +++ b/drivers/dma/dma_max32.c @@ -347,7 +347,7 @@ static const struct dma_driver_api max32_dma_driver_api = { .channels = DT_INST_PROP(inst, dma_channels), \ .irq_configure = max32_dma##inst##_irq_configure, \ }; \ - DEVICE_DT_INST_DEFINE(inst, &max32_dma_init, NULL, &dma##inst##_data, &dma##inst##_cfg, \ - PRE_KERNEL_1, CONFIG_DMA_INIT_PRIORITY, &max32_dma_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, &max32_dma_init, NULL, &dma##inst##_data, &dma##inst##_cfg,\ + PRE_KERNEL_1, &max32_dma_driver_api); DT_INST_FOREACH_STATUS_OKAY(MAX32_DMA_INIT) diff --git a/drivers/dma/dma_mchp_xec.c b/drivers/dma/dma_mchp_xec.c index 699aa5deef815..a5b3626a87630 100644 --- a/drivers/dma/dma_mchp_xec.c +++ b/drivers/dma/dma_mchp_xec.c @@ -833,10 +833,9 @@ static int dma_xec_init(const struct device *dev) .irq_connect = dma_xec_irq_connect##i, \ }; \ PM_DEVICE_DT_DEFINE(i, dmac_xec_pm_action); \ - DEVICE_DT_INST_DEFINE(i, &dma_xec_init, \ + DEVICE_INSTANCE_FROM_DT_INST(i, &dma_xec_init, \ PM_DEVICE_DT_GET(i), \ &dma_xec_data##i, &dma_xec_cfg##i, \ - PRE_KERNEL_1, CONFIG_DMA_INIT_PRIORITY, \ - &dma_xec_api); + PRE_KERNEL_1, &dma_xec_api); DT_INST_FOREACH_STATUS_OKAY(DMA_XEC_DEVICE) diff --git a/drivers/dma/dma_mcux_edma.c b/drivers/dma/dma_mcux_edma.c index 5c9cbcf40df7a..8a4815b139095 100644 --- a/drivers/dma/dma_mcux_edma.c +++ b/drivers/dma/dma_mcux_edma.c @@ -944,11 +944,10 @@ static int dma_mcux_edma_init(const struct device *dev) .channels_atomic = dma_channels_atomic_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &dma_mcux_edma_init, NULL, \ &dma_data_##n, &dma_config_##n, \ - PRE_KERNEL_1, CONFIG_DMA_INIT_PRIORITY, \ - &dma_mcux_edma_api); \ + PRE_KERNEL_1, &dma_mcux_edma_api); \ \ DMA_MCUX_EDMA_CONFIG_FUNC(n); diff --git a/drivers/dma/dma_mcux_lpc.c b/drivers/dma/dma_mcux_lpc.c index 3ef75ac11767a..4d1cf4c526a90 100644 --- a/drivers/dma/dma_mcux_lpc.c +++ b/drivers/dma/dma_mcux_lpc.c @@ -913,12 +913,11 @@ static const struct dma_mcux_lpc_config dma_##n##_config = { \ .otrig_array = dma_##n##_otrig_arr, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &dma_mcux_lpc_init, \ NULL, \ &dma_data_##n, &dma_##n##_config, \ - PRE_KERNEL_1, CONFIG_DMA_INIT_PRIORITY, \ - &dma_mcux_lpc_api); \ + PRE_KERNEL_1, &dma_mcux_lpc_api); \ \ DMA_MCUX_LPC_CONFIG_FUNC(n) \ DMA_MCUX_LPC_INIT_CFG(n); diff --git a/drivers/dma/dma_mcux_pxp.c b/drivers/dma/dma_mcux_pxp.c index 64f3154807c32..998cbcd312786 100644 --- a/drivers/dma/dma_mcux_pxp.c +++ b/drivers/dma/dma_mcux_pxp.c @@ -218,7 +218,7 @@ static int dma_mcux_pxp_init(const struct device *dev) \ static struct dma_mcux_pxp_data dma_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, &dma_mcux_pxp_init, NULL, &dma_data_##n, &dma_config_##n, \ - PRE_KERNEL_1, CONFIG_DMA_INIT_PRIORITY, &dma_mcux_pxp_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &dma_mcux_pxp_init, NULL, &dma_data_##n, &dma_config_##n, \ + PRE_KERNEL_1, &dma_mcux_pxp_api); DT_INST_FOREACH_STATUS_OKAY(DMA_INIT) diff --git a/drivers/dma/dma_mcux_smartdma.c b/drivers/dma/dma_mcux_smartdma.c index 86663dd02e8b7..0dee782b31d35 100644 --- a/drivers/dma/dma_mcux_smartdma.c +++ b/drivers/dma/dma_mcux_smartdma.c @@ -152,11 +152,10 @@ static const struct dma_driver_api dma_mcux_smartdma_api = { }; \ static struct dma_mcux_smartdma_data smartdma_##n##_data; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &dma_mcux_smartdma_init, \ NULL, \ &smartdma_##n##_data, &smartdma_##n##_config, \ - POST_KERNEL, CONFIG_DMA_INIT_PRIORITY, \ - &dma_mcux_smartdma_api); + POST_KERNEL, &dma_mcux_smartdma_api); DT_INST_FOREACH_STATUS_OKAY(SMARTDMA_INIT) diff --git a/drivers/dma/dma_nios2_msgdma.c b/drivers/dma/dma_nios2_msgdma.c index ccc7b1e58ad17..5074a4caf0467 100644 --- a/drivers/dma/dma_nios2_msgdma.c +++ b/drivers/dma/dma_nios2_msgdma.c @@ -229,6 +229,6 @@ static struct nios2_msgdma_dev_data dma0_nios2_data = { .msgdma_dev = &msgdma_dev0, }; -DEVICE_DT_INST_DEFINE(0, &nios2_msgdma0_initialize, +DEVICE_INSTANCE_FROM_DT_INST(0, &nios2_msgdma0_initialize, NULL, &dma0_nios2_data, NULL, POST_KERNEL, - CONFIG_DMA_INIT_PRIORITY, &nios2_msgdma_driver_api); + &nios2_msgdma_driver_api); diff --git a/drivers/dma/dma_nxp_edma.c b/drivers/dma/dma_nxp_edma.c index 7d4f6e8b44958..c212d7054106e 100644 --- a/drivers/dma/dma_nxp_edma.c +++ b/drivers/dma/dma_nxp_edma.c @@ -698,9 +698,8 @@ static struct edma_data edma_data_##inst = { \ .ctx.magic = DMA_MAGIC, \ }; \ \ -DEVICE_DT_INST_DEFINE(inst, &edma_init, NULL, \ +DEVICE_INSTANCE_FROM_DT_INST(inst, &edma_init, NULL, \ &edma_data_##inst, &edma_config_##inst, \ - PRE_KERNEL_1, CONFIG_DMA_INIT_PRIORITY, \ - &edma_api); \ + PRE_KERNEL_1, &edma_api); \ DT_INST_FOREACH_STATUS_OKAY(EDMA_INIT); diff --git a/drivers/dma/dma_nxp_sof_host_dma.c b/drivers/dma/dma_nxp_sof_host_dma.c index baafd69551eca..0980b35b6199b 100644 --- a/drivers/dma/dma_nxp_sof_host_dma.c +++ b/drivers/dma/dma_nxp_sof_host_dma.c @@ -303,7 +303,6 @@ static struct sof_host_dma_data sof_host_dma_data = { }; /* assumption: only 1 SOF_HOST_DMA instance */ -DEVICE_DT_INST_DEFINE(0, sof_host_dma_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, sof_host_dma_init, NULL, &sof_host_dma_data, NULL, - PRE_KERNEL_1, CONFIG_DMA_INIT_PRIORITY, - &sof_host_dma_api); + PRE_KERNEL_1, &sof_host_dma_api); diff --git a/drivers/dma/dma_pl330.c b/drivers/dma/dma_pl330.c index 5bc161c512196..d665254136a85 100644 --- a/drivers/dma/dma_pl330.c +++ b/drivers/dma/dma_pl330.c @@ -581,7 +581,6 @@ static const struct dma_pl330_config pl330_config = { static struct dma_pl330_dev_data pl330_data; -DEVICE_DT_INST_DEFINE(0, &dma_pl330_initialize, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &dma_pl330_initialize, NULL, &pl330_data, &pl330_config, - POST_KERNEL, CONFIG_DMA_INIT_PRIORITY, - &pl330_driver_api); + POST_KERNEL, &pl330_driver_api); diff --git a/drivers/dma/dma_rpi_pico.c b/drivers/dma/dma_rpi_pico.c index 57c23ced657f1..021aeb4a9d573 100644 --- a/drivers/dma/dma_rpi_pico.c +++ b/drivers/dma/dma_rpi_pico.c @@ -377,8 +377,7 @@ static const struct dma_driver_api dma_rpi_pico_driver_api = { .channels = dma_rpi_pico##inst##_channels, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &dma_rpi_pico_init, NULL, &dma_rpi_pico##inst##_data, \ - &dma_rpi_pico##inst##_config, POST_KERNEL, CONFIG_DMA_INIT_PRIORITY, \ - &dma_rpi_pico_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, &dma_rpi_pico_init, NULL, &dma_rpi_pico##inst##_data, \ + &dma_rpi_pico##inst##_config, POST_KERNEL, &dma_rpi_pico_driver_api); DT_INST_FOREACH_STATUS_OKAY(RPI_PICO_DMA_INIT) diff --git a/drivers/dma/dma_sam0.c b/drivers/dma/dma_sam0.c index fde5a250e84ec..ae1d83d84d072 100644 --- a/drivers/dma/dma_sam0.c +++ b/drivers/dma/dma_sam0.c @@ -454,6 +454,6 @@ static const struct dma_driver_api dma_sam0_api = { .get_status = dma_sam0_get_status, }; -DEVICE_DT_INST_DEFINE(0, &dma_sam0_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &dma_sam0_init, NULL, &dmac_data, NULL, PRE_KERNEL_1, - CONFIG_DMA_INIT_PRIORITY, &dma_sam0_api); + &dma_sam0_api); diff --git a/drivers/dma/dma_sam_xdmac.c b/drivers/dma/dma_sam_xdmac.c index 569085e5766cd..d7c7896205266 100644 --- a/drivers/dma/dma_sam_xdmac.c +++ b/drivers/dma/dma_sam_xdmac.c @@ -424,6 +424,6 @@ static const struct sam_xdmac_dev_cfg dma0_sam_config = { static struct sam_xdmac_dev_data dma0_sam_data; -DEVICE_DT_INST_DEFINE(0, &sam_xdmac_initialize, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &sam_xdmac_initialize, NULL, &dma0_sam_data, &dma0_sam_config, POST_KERNEL, - CONFIG_DMA_INIT_PRIORITY, &sam_xdmac_driver_api); + &sam_xdmac_driver_api); diff --git a/drivers/dma/dma_sedi.c b/drivers/dma/dma_sedi.c index 03f43e87580ae..99759847bd630 100644 --- a/drivers/dma/dma_sedi.c +++ b/drivers/dma/dma_sedi.c @@ -375,9 +375,9 @@ static int dma_sedi_init(const struct device *dev) .chn_num = DT_INST_PROP(inst, dma_channels), \ .irq_config = dma_sedi_##inst##_irq_config \ }; \ - DEVICE_DT_DEFINE(DT_INST(inst, DT_DRV_COMPAT), &dma_sedi_init, \ + DEVICE_INSTANCE(DT_INST(inst, DT_DRV_COMPAT), &dma_sedi_init, \ NULL, &dma_sedi_dev_data_##inst, &dma_sedi_config_data_##inst, PRE_KERNEL_2, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, (void *)&dma_funcs); \ + (void *)&dma_funcs); \ \ static void dma_sedi_##inst##_irq_config(void) \ { \ diff --git a/drivers/dma/dma_si32.c b/drivers/dma/dma_si32.c index f6b8a46f1177c..ce1b8d1f3e6a1 100644 --- a/drivers/dma/dma_si32.c +++ b/drivers/dma/dma_si32.c @@ -423,5 +423,4 @@ static const struct dma_driver_api dma_si32_driver_api = { .stop = dma_si32_stop, }; -DEVICE_DT_INST_DEFINE(0, &dma_si32_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_DMA_INIT_PRIORITY, - &dma_si32_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &dma_si32_init, NULL, NULL, NULL, POST_KERNEL, &dma_si32_driver_api); diff --git a/drivers/dma/dma_smartbond.c b/drivers/dma/dma_smartbond.c index ced9580dbfe5c..98b6de00e2db7 100644 --- a/drivers/dma/dma_smartbond.c +++ b/drivers/dma/dma_smartbond.c @@ -1038,11 +1038,10 @@ static int dma_smartbond_init(const struct device *dev) \ static struct dma_smartbond_data dma_smartbond_data_ ## inst; \ \ - DEVICE_DT_INST_DEFINE(0, dma_smartbond_init, \ - PM_DEVICE_DT_INST_GET(inst), \ - &dma_smartbond_data_ ## inst, NULL, \ - POST_KERNEL, \ - CONFIG_DMA_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(0, dma_smartbond_init,\ + PM_DEVICE_DT_INST_GET(inst), \ + &dma_smartbond_data_ ## inst, NULL, \ + POST_KERNEL, \ &dma_smartbond_driver_api); DT_INST_FOREACH_STATUS_OKAY(SMARTBOND_DMA_INIT) diff --git a/drivers/dma/dma_stm32.c b/drivers/dma/dma_stm32.c index 8afc07792b55f..6888ed407b266 100644 --- a/drivers/dma/dma_stm32.c +++ b/drivers/dma/dma_stm32.c @@ -714,12 +714,11 @@ const struct dma_stm32_config dma_stm32_config_##index = { \ static struct dma_stm32_data dma_stm32_data_##index = { \ }; \ \ -DEVICE_DT_INST_DEFINE(index, \ +DEVICE_INSTANCE_FROM_DT_INST(index, \ &dma_stm32_init, \ NULL, \ &dma_stm32_data_##index, &dma_stm32_config_##index, \ - PRE_KERNEL_1, CONFIG_DMA_INIT_PRIORITY, \ - &dma_funcs) + PRE_KERNEL_1, &dma_funcs) #ifdef CONFIG_DMA_STM32_SHARED_IRQS diff --git a/drivers/dma/dma_stm32_bdma.c b/drivers/dma/dma_stm32_bdma.c index 1e814e8481543..1e2cdef0dbb0d 100644 --- a/drivers/dma/dma_stm32_bdma.c +++ b/drivers/dma/dma_stm32_bdma.c @@ -882,12 +882,11 @@ const struct bdma_stm32_config bdma_stm32_config_##index = { \ static struct bdma_stm32_data bdma_stm32_data_##index = { \ }; \ \ -DEVICE_DT_INST_DEFINE(index, \ +DEVICE_INSTANCE_FROM_DT_INST(index, \ &bdma_stm32_init, \ NULL, \ &bdma_stm32_data_##index, &bdma_stm32_config_##index, \ - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ - &dma_funcs) + PRE_KERNEL_1, &dma_funcs) #define BDMA_STM32_DEFINE_IRQ_HANDLER(bdma, chan) \ static void bdma_stm32_irq_##bdma##_##chan(const struct device *dev) \ diff --git a/drivers/dma/dma_stm32u5.c b/drivers/dma/dma_stm32u5.c index ca57ee8f36a90..e21190557ad5b 100644 --- a/drivers/dma/dma_stm32u5.c +++ b/drivers/dma/dma_stm32u5.c @@ -786,11 +786,10 @@ const struct dma_stm32_config dma_stm32_config_##index = { \ static struct dma_stm32_data dma_stm32_data_##index = { \ }; \ \ -DEVICE_DT_INST_DEFINE(index, \ +DEVICE_INSTANCE_FROM_DT_INST(index, \ &dma_stm32_init, \ NULL, \ &dma_stm32_data_##index, &dma_stm32_config_##index, \ - PRE_KERNEL_1, CONFIG_DMA_INIT_PRIORITY, \ - &dma_funcs); + PRE_KERNEL_1, &dma_funcs); DT_INST_FOREACH_STATUS_OKAY(DMA_STM32_INIT_DEV) diff --git a/drivers/dma/dma_xilinx_axi_dma.c b/drivers/dma/dma_xilinx_axi_dma.c index 7138fbe212764..b3f8e336f8196 100644 --- a/drivers/dma/dma_xilinx_axi_dma.c +++ b/drivers/dma/dma_xilinx_axi_dma.c @@ -1117,10 +1117,10 @@ static int dma_xilinx_axi_dma_init(const struct device *dev) .channels = dma_xilinx_axi_dma##inst##_channels, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &dma_xilinx_axi_dma_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &dma_xilinx_axi_dma_init, NULL, \ &dma_xilinx_axi_dma##inst##_data, \ &dma_xilinx_axi_dma##inst##_config, POST_KERNEL, \ - CONFIG_DMA_INIT_PRIORITY, &dma_xilinx_axi_dma_driver_api); + &dma_xilinx_axi_dma_driver_api); /* two different compatibles match the very same Xilinx AXI DMA, */ /* depending on if it is used in the AXI Ethernet subsystem or not */ diff --git a/drivers/dma/dma_xmc4xxx.c b/drivers/dma/dma_xmc4xxx.c index ffe7b964aba85..5cb03b84e47ad 100644 --- a/drivers/dma/dma_xmc4xxx.c +++ b/drivers/dma/dma_xmc4xxx.c @@ -495,9 +495,9 @@ static const struct dma_driver_api dma_xmc4xxx_driver_api = { .channels = dma_xmc4xxx##inst##_channels, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &dma_xmc4xxx_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &dma_xmc4xxx_init, NULL, \ &dma_xmc4xxx##inst##_data, \ &dma_xmc4xxx##inst##_config, PRE_KERNEL_1, \ - CONFIG_DMA_INIT_PRIORITY, &dma_xmc4xxx_driver_api); + &dma_xmc4xxx_driver_api); DT_INST_FOREACH_STATUS_OKAY(XMC4XXX_DMA_INIT) diff --git a/drivers/dma/dmamux_stm32.c b/drivers/dma/dmamux_stm32.c index 71a470f532851..f82855f3afabf 100644 --- a/drivers/dma/dmamux_stm32.c +++ b/drivers/dma/dmamux_stm32.c @@ -388,12 +388,11 @@ const struct dmamux_stm32_config dmamux_stm32_config_##index = { \ \ static struct dmamux_stm32_data dmamux_stm32_data_##index; \ \ -DEVICE_DT_INST_DEFINE(index, \ +DEVICE_INSTANCE_FROM_DT_INST(index, \ &dmamux_stm32_init, \ NULL, \ &dmamux_stm32_data_##index, &dmamux_stm32_config_##index,\ - PRE_KERNEL_1, CONFIG_DMAMUX_STM32_INIT_PRIORITY, \ - &dma_funcs); + PRE_KERNEL_1, &dma_funcs); DT_INST_FOREACH_STATUS_OKAY(DMAMUX_INIT) diff --git a/drivers/dp/swdp_bitbang.c b/drivers/dp/swdp_bitbang.c index 8dec65b6c1055..d94adde8c148c 100644 --- a/drivers/dp/swdp_bitbang.c +++ b/drivers/dp/swdp_bitbang.c @@ -734,9 +734,8 @@ static struct swdp_api swdp_bitbang_api = { \ static struct sw_cfg_data sw_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, sw_gpio_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, sw_gpio_init, NULL, \ &sw_data_##n, &sw_cfg_##n, \ - POST_KERNEL, CONFIG_DP_DRIVER_INIT_PRIO, \ - &swdp_bitbang_api); + POST_KERNEL, &swdp_bitbang_api); DT_INST_FOREACH_STATUS_OKAY(SW_DEVICE_DEFINE) diff --git a/drivers/edac/edac_ibecc.c b/drivers/edac/edac_ibecc.c index f8ea556f434ba..3699345eb8106 100644 --- a/drivers/edac/edac_ibecc.c +++ b/drivers/edac/edac_ibecc.c @@ -347,9 +347,9 @@ static int edac_ibecc_init(const struct device *dev) static struct ibecc_data ibecc_data; -DEVICE_DT_DEFINE(DEVICE_NODE, &edac_ibecc_init, +DEVICE_INSTANCE(DEVICE_NODE, &edac_ibecc_init, NULL, &ibecc_data, NULL, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &api); + &api); /** * An IBECC error causes SERR_NMI_STS set and is indicated by diff --git a/drivers/eeprom/eeprom_at2x.c b/drivers/eeprom/eeprom_at2x.c index 31161554659e9..65f76b963cd03 100644 --- a/drivers/eeprom/eeprom_at2x.c +++ b/drivers/eeprom/eeprom_at2x.c @@ -648,10 +648,9 @@ static const struct eeprom_driver_api eeprom_at2x_api = { .write_fn = eeprom_at##t##_write, \ }; \ static struct eeprom_at2x_data eeprom_at##t##_data_##n; \ - DEVICE_DT_DEFINE(INST_DT_AT2X(n, t), &eeprom_at2x_init, \ + DEVICE_INSTANCE(INST_DT_AT2X(n, t), &eeprom_at2x_init, \ NULL, &eeprom_at##t##_data_##n, \ &eeprom_at##t##_config_##n, POST_KERNEL, \ - CONFIG_EEPROM_AT2X_INIT_PRIORITY, \ &eeprom_at2x_api) #define EEPROM_AT24_DEVICE(n) EEPROM_AT2X_DEVICE(n, 24) diff --git a/drivers/eeprom/eeprom_emulator.c b/drivers/eeprom/eeprom_emulator.c index 4e5f3e9254030..925207a0914a6 100644 --- a/drivers/eeprom/eeprom_emulator.c +++ b/drivers/eeprom/eeprom_emulator.c @@ -800,9 +800,9 @@ static const struct eeprom_driver_api eeprom_emu_api = { .rambuf = EEPROM_EMU_RAMBUF_LINK(n), \ }; \ static struct eeprom_emu_data eeprom_emu_##n##_data; \ - DEVICE_DT_INST_DEFINE(n, &eeprom_emu_init, \ - NULL, &eeprom_emu_##n##_data, \ - &eeprom_emu_##n##_config, POST_KERNEL, \ - CONFIG_EEPROM_INIT_PRIORITY, &eeprom_emu_api); \ + DEVICE_INSTANCE_FROM_DT_INST(n, &eeprom_emu_init,\ + NULL, &eeprom_emu_##n##_data, \ + &eeprom_emu_##n##_config, POST_KERNEL,\ + &eeprom_emu_api); \ DT_INST_FOREACH_STATUS_OKAY(EEPROM_EMU_INIT) diff --git a/drivers/eeprom/eeprom_fake.c b/drivers/eeprom/eeprom_fake.c index f925671fba8ad..3c81a292238d5 100644 --- a/drivers/eeprom/eeprom_fake.c +++ b/drivers/eeprom/eeprom_fake.c @@ -70,9 +70,8 @@ static int fake_eeprom_init(const struct device *dev) .size = DT_INST_PROP(inst, size), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &fake_eeprom_init, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &fake_eeprom_init, NULL, NULL, \ &fake_eeprom_config_##inst, \ - POST_KERNEL, CONFIG_EEPROM_INIT_PRIORITY, \ - &fake_eeprom_driver_api); + POST_KERNEL, &fake_eeprom_driver_api); DT_INST_FOREACH_STATUS_OKAY(FAKE_EEPROM_INIT) diff --git a/drivers/eeprom/eeprom_lpc11u6x.c b/drivers/eeprom/eeprom_lpc11u6x.c index ef9f7d6fc8ed4..f3490d7fff224 100644 --- a/drivers/eeprom/eeprom_lpc11u6x.c +++ b/drivers/eeprom/eeprom_lpc11u6x.c @@ -111,5 +111,5 @@ static const struct eeprom_lpc11u6x_config eeprom_config = { .size = DT_INST_PROP(0, size), }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, &eeprom_config, POST_KERNEL, - CONFIG_EEPROM_INIT_PRIORITY, &eeprom_lpc11u6x_api); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, &eeprom_config, POST_KERNEL, + &eeprom_lpc11u6x_api); diff --git a/drivers/eeprom/eeprom_mb85rcxx.c b/drivers/eeprom/eeprom_mb85rcxx.c index 7d63f845ddd45..b08c566eb1a77 100644 --- a/drivers/eeprom/eeprom_mb85rcxx.c +++ b/drivers/eeprom/eeprom_mb85rcxx.c @@ -226,8 +226,7 @@ static const struct eeprom_driver_api mb85rcxx_driver_api = { .addr_width = DT_INST_PROP(inst, address_width), \ .readonly = DT_INST_PROP(inst, read_only)}; \ \ - DEVICE_DT_INST_DEFINE(inst, mb85rcxx_init, NULL, &mb85rcxx_data_##inst, \ - &mb85rcxx_config_##inst, POST_KERNEL, CONFIG_EEPROM_INIT_PRIORITY, \ - &mb85rcxx_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, mb85rcxx_init, NULL, &mb85rcxx_data_##inst, \ + &mb85rcxx_config_##inst, POST_KERNEL, &mb85rcxx_driver_api); DT_INST_FOREACH_STATUS_OKAY(MB85RCXX_DEFINE) diff --git a/drivers/eeprom/eeprom_mb85rsxx.c b/drivers/eeprom/eeprom_mb85rsxx.c index 70891a28e92a7..3c9e56d506258 100644 --- a/drivers/eeprom/eeprom_mb85rsxx.c +++ b/drivers/eeprom/eeprom_mb85rsxx.c @@ -311,8 +311,8 @@ static const struct eeprom_driver_api mb85rsxx_driver_api = { .readonly = DT_INST_PROP(inst, read_only), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, eeprom_mb85rsxx_init, NULL, &eeprom_mb85rsxx_data_##inst, \ - &eeprom_mb85rsxx_config_##inst, POST_KERNEL, \ - CONFIG_EEPROM_INIT_PRIORITY, &mb85rsxx_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, eeprom_mb85rsxx_init, NULL, &eeprom_mb85rsxx_data_##inst,\ + &eeprom_mb85rsxx_config_##inst, POST_KERNEL, \ + &mb85rsxx_driver_api); DT_INST_FOREACH_STATUS_OKAY(MB85RSXX_INIT) diff --git a/drivers/eeprom/eeprom_mchp_xec.c b/drivers/eeprom/eeprom_mchp_xec.c index 171940a008d4f..ce49cb36cb388 100644 --- a/drivers/eeprom/eeprom_mchp_xec.c +++ b/drivers/eeprom/eeprom_mchp_xec.c @@ -372,6 +372,6 @@ static struct eeprom_xec_data eeprom_data; PM_DEVICE_DT_INST_DEFINE(0, eeprom_xec_pm_action); -DEVICE_DT_INST_DEFINE(0, &eeprom_xec_init, PM_DEVICE_DT_INST_GET(0), &eeprom_data, +DEVICE_INSTANCE_FROM_DT_INST(0, &eeprom_xec_init, PM_DEVICE_DT_INST_GET(0), &eeprom_data, &eeprom_config, POST_KERNEL, - CONFIG_EEPROM_INIT_PRIORITY, &eeprom_xec_api); + &eeprom_xec_api); diff --git a/drivers/eeprom/eeprom_simulator.c b/drivers/eeprom/eeprom_simulator.c index a8daf71038744..d10c13bf67af5 100644 --- a/drivers/eeprom/eeprom_simulator.c +++ b/drivers/eeprom/eeprom_simulator.c @@ -251,8 +251,8 @@ static int eeprom_sim_init(const struct device *dev) return eeprom_mock_init(dev); } -DEVICE_DT_INST_DEFINE(0, &eeprom_sim_init, NULL, NULL, &eeprom_sim_config_0, POST_KERNEL, - CONFIG_EEPROM_INIT_PRIORITY, &eeprom_sim_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &eeprom_sim_init, NULL, NULL, &eeprom_sim_config_0, POST_KERNEL, + &eeprom_sim_api); #ifdef CONFIG_ARCH_POSIX diff --git a/drivers/eeprom/eeprom_stm32.c b/drivers/eeprom/eeprom_stm32.c index 9cab215a3dd28..8cb56a6b40116 100644 --- a/drivers/eeprom/eeprom_stm32.c +++ b/drivers/eeprom/eeprom_stm32.c @@ -118,5 +118,5 @@ static const struct eeprom_stm32_config eeprom_config = { .size = DT_INST_REG_SIZE(0), }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, &eeprom_config, POST_KERNEL, - CONFIG_EEPROM_INIT_PRIORITY, &eeprom_stm32_api); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, &eeprom_config, POST_KERNEL, + &eeprom_stm32_api); diff --git a/drivers/eeprom/eeprom_tmp116.c b/drivers/eeprom/eeprom_tmp116.c index e363c3e8184fa..6a18f1af4ee46 100644 --- a/drivers/eeprom/eeprom_tmp116.c +++ b/drivers/eeprom/eeprom_tmp116.c @@ -63,8 +63,8 @@ static const struct eeprom_driver_api eeprom_tmp116_api = { static const struct eeprom_tmp116_config eeprom_tmp116_config##_num = { \ .parent = DEVICE_DT_GET(DT_INST_BUS(_num)) \ }; \ - DEVICE_DT_INST_DEFINE(_num, eeprom_tmp116_init, NULL, \ - NULL, &eeprom_tmp116_config##_num, POST_KERNEL, \ - CONFIG_EEPROM_INIT_PRIORITY, &eeprom_tmp116_api); + DEVICE_INSTANCE_FROM_DT_INST(_num, eeprom_tmp116_init, NULL, \ + NULL, &eeprom_tmp116_config##_num, POST_KERNEL, \ + &eeprom_tmp116_api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_TMP116); diff --git a/drivers/entropy/entropy_b91_trng.c b/drivers/entropy/entropy_b91_trng.c index 914b70003b3a5..0995dfa4a0bf0 100644 --- a/drivers/entropy/entropy_b91_trng.c +++ b/drivers/entropy/entropy_b91_trng.c @@ -65,7 +65,6 @@ static const struct entropy_driver_api entropy_b91_trng_api = { }; /* Entropy driver registration */ -DEVICE_DT_INST_DEFINE(0, entropy_b91_trng_init, +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_b91_trng_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, - &entropy_b91_trng_api); + PRE_KERNEL_1, &entropy_b91_trng_api); diff --git a/drivers/entropy/entropy_bt_hci.c b/drivers/entropy/entropy_bt_hci.c index 0ae7faa210844..2ccb96d994de5 100644 --- a/drivers/entropy/entropy_bt_hci.c +++ b/drivers/entropy/entropy_bt_hci.c @@ -34,10 +34,9 @@ static const struct entropy_driver_api entropy_bt_api = { }; #define ENTROPY_BT_HCI_INIT(inst) \ - DEVICE_DT_INST_DEFINE(inst, entropy_bt_init, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, entropy_bt_init, \ NULL, NULL, NULL, \ PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &entropy_bt_api); DT_INST_FOREACH_STATUS_OKAY(ENTROPY_BT_HCI_INIT) diff --git a/drivers/entropy/entropy_cc13xx_cc26xx.c b/drivers/entropy/entropy_cc13xx_cc26xx.c index 1c08ee9f8b34c..0df05f6341c3f 100644 --- a/drivers/entropy/entropy_cc13xx_cc26xx.c +++ b/drivers/entropy/entropy_cc13xx_cc26xx.c @@ -346,9 +346,8 @@ static struct entropy_cc13xx_cc26xx_data entropy_cc13xx_cc26xx_data = { PM_DEVICE_DT_INST_DEFINE(0, entropy_cc13xx_cc26xx_pm_action); -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_cc13xx_cc26xx_init, PM_DEVICE_DT_INST_GET(0), &entropy_cc13xx_cc26xx_data, NULL, - PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, - &entropy_cc13xx_cc26xx_driver_api); + PRE_KERNEL_1, &entropy_cc13xx_cc26xx_driver_api); diff --git a/drivers/entropy/entropy_esp32.c b/drivers/entropy/entropy_esp32.c index e80bdd059b74a..fbb6e987e2db5 100644 --- a/drivers/entropy/entropy_esp32.c +++ b/drivers/entropy/entropy_esp32.c @@ -92,7 +92,6 @@ static const struct entropy_driver_api entropy_esp32_api_funcs = { .get_entropy = entropy_esp32_get_entropy }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_esp32_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, - &entropy_esp32_api_funcs); + PRE_KERNEL_1, &entropy_esp32_api_funcs); diff --git a/drivers/entropy/entropy_gecko_se.c b/drivers/entropy/entropy_gecko_se.c index 133df43e0a3a1..7399321596090 100644 --- a/drivers/entropy/entropy_gecko_se.c +++ b/drivers/entropy/entropy_gecko_se.c @@ -54,10 +54,9 @@ static const struct entropy_driver_api entropy_gecko_se_api_funcs = { }; #define GECKO_SE_INIT(n) \ - DEVICE_DT_INST_DEFINE(n, \ - entropy_gecko_se_init, NULL, \ - NULL, NULL, \ - PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, \ - &entropy_gecko_se_api_funcs); \ + DEVICE_INSTANCE_FROM_DT_INST(n,\ + entropy_gecko_se_init, NULL,\ + NULL, NULL,\ + PRE_KERNEL_1, &entropy_gecko_se_api_funcs);\ DT_INST_FOREACH_STATUS_OKAY(GECKO_SE_INIT) diff --git a/drivers/entropy/entropy_gecko_trng.c b/drivers/entropy/entropy_gecko_trng.c index 281229b821221..e2cf3d203bedf 100644 --- a/drivers/entropy/entropy_gecko_trng.c +++ b/drivers/entropy/entropy_gecko_trng.c @@ -153,8 +153,7 @@ static struct entropy_driver_api entropy_gecko_trng_api_funcs = { .get_entropy_isr = entropy_gecko_trng_get_entropy_isr }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_gecko_trng_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, - &entropy_gecko_trng_api_funcs); + PRE_KERNEL_1, &entropy_gecko_trng_api_funcs); diff --git a/drivers/entropy/entropy_litex.c b/drivers/entropy/entropy_litex.c index 83fedbd54250a..e93a86edf8087 100644 --- a/drivers/entropy/entropy_litex.c +++ b/drivers/entropy/entropy_litex.c @@ -38,5 +38,5 @@ static const struct entropy_driver_api entropy_prbs_api = { .get_entropy = entropy_prbs_get_entropy }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_ENTROPY_INIT_PRIORITY, &entropy_prbs_api); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1, + &entropy_prbs_api); diff --git a/drivers/entropy/entropy_max32.c b/drivers/entropy/entropy_max32.c index 0e7f92dda620b..6da656ae01682 100644 --- a/drivers/entropy/entropy_max32.c +++ b/drivers/entropy/entropy_max32.c @@ -85,5 +85,5 @@ static const struct max32_trng_config max32_trng_cfg = { .perclk.bit = DT_INST_CLOCKS_CELL(0, bit), }; -DEVICE_DT_INST_DEFINE(0, entropy_max32_init, NULL, NULL, &max32_trng_cfg, PRE_KERNEL_1, - CONFIG_ENTROPY_INIT_PRIORITY, &entropy_max32_api); +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_max32_init, NULL, NULL, &max32_trng_cfg, PRE_KERNEL_1, + &entropy_max32_api); diff --git a/drivers/entropy/entropy_mcux_caam.c b/drivers/entropy/entropy_mcux_caam.c index 586b2137ff30e..b59b23dc6baaf 100644 --- a/drivers/entropy/entropy_mcux_caam.c +++ b/drivers/entropy/entropy_mcux_caam.c @@ -93,8 +93,7 @@ static int entropy_mcux_caam_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_mcux_caam_init, NULL, NULL, &entropy_mcux_config, - PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, - &entropy_mcux_caam_api_funcs); + PRE_KERNEL_1, &entropy_mcux_caam_api_funcs); diff --git a/drivers/entropy/entropy_mcux_rng.c b/drivers/entropy/entropy_mcux_rng.c index b205c4fa21b29..c85f2ea7c42ed 100644 --- a/drivers/entropy/entropy_mcux_rng.c +++ b/drivers/entropy/entropy_mcux_rng.c @@ -47,8 +47,7 @@ static int entropy_mcux_rng_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_mcux_rng_init, NULL, NULL, &entropy_mcux_config, - PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, - &entropy_mcux_rng_api_funcs); + PRE_KERNEL_1, &entropy_mcux_rng_api_funcs); diff --git a/drivers/entropy/entropy_mcux_rnga.c b/drivers/entropy/entropy_mcux_rnga.c index b82bd22ff0e80..b6155437462b0 100644 --- a/drivers/entropy/entropy_mcux_rnga.c +++ b/drivers/entropy/entropy_mcux_rnga.c @@ -76,7 +76,6 @@ static int entropy_mcux_rnga_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_mcux_rnga_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, - &entropy_mcux_rnga_api_funcs); + PRE_KERNEL_1, &entropy_mcux_rnga_api_funcs); diff --git a/drivers/entropy/entropy_mcux_trng.c b/drivers/entropy/entropy_mcux_trng.c index c48e3aab25de6..7da52ca53d677 100644 --- a/drivers/entropy/entropy_mcux_trng.c +++ b/drivers/entropy/entropy_mcux_trng.c @@ -53,8 +53,7 @@ static int entropy_mcux_trng_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_mcux_trng_init, NULL, NULL, &entropy_mcux_config, - PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, - &entropy_mcux_trng_api_funcs); + PRE_KERNEL_1, &entropy_mcux_trng_api_funcs); diff --git a/drivers/entropy/entropy_neorv32_trng.c b/drivers/entropy/entropy_neorv32_trng.c index 1317f3701979f..e1ed771f893fe 100644 --- a/drivers/entropy/entropy_neorv32_trng.c +++ b/drivers/entropy/entropy_neorv32_trng.c @@ -140,12 +140,11 @@ static const struct entropy_driver_api neorv32_trng_driver_api = { \ PM_DEVICE_DT_INST_DEFINE(n, neorv32_trng_pm_action); \ \ - DEVICE_DT_INST_DEFINE(n, &neorv32_trng_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &neorv32_trng_init, \ PM_DEVICE_DT_INST_GET(n), \ NULL, \ &neorv32_trng_##n##_config, \ PRE_KERNEL_1, \ - CONFIG_ENTROPY_INIT_PRIORITY, \ &neorv32_trng_driver_api); DT_INST_FOREACH_STATUS_OKAY(NEORV32_TRNG_INIT) diff --git a/drivers/entropy/entropy_npcx_drbg.c b/drivers/entropy/entropy_npcx_drbg.c index d00ee532d0041..2c680b6d9eb06 100644 --- a/drivers/entropy/entropy_npcx_drbg.c +++ b/drivers/entropy/entropy_npcx_drbg.c @@ -230,5 +230,5 @@ static struct entropy_npcx_drbg_dev_data entropy_npcx_drbg_data; PM_DEVICE_DT_INST_DEFINE(0, entropy_npcx_drbg_pm_action); -DEVICE_DT_INST_DEFINE(0, entropy_npcx_drbg_init, PM_DEVICE_DT_INST_GET(0), &entropy_npcx_drbg_data, - NULL, PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, &entropy_npcx_drbg_api); +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_npcx_drbg_init, PM_DEVICE_DT_INST_GET(0), &entropy_npcx_drbg_data, + NULL, PRE_KERNEL_1, &entropy_npcx_drbg_api); diff --git a/drivers/entropy/entropy_nrf5.c b/drivers/entropy/entropy_nrf5.c index 9205c2b59c9d4..a22ee2997e0b4 100644 --- a/drivers/entropy/entropy_nrf5.c +++ b/drivers/entropy/entropy_nrf5.c @@ -315,11 +315,10 @@ static const struct entropy_driver_api entropy_nrf5_api_funcs = { .get_entropy_isr = entropy_nrf5_get_entropy_isr }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_nrf5_init, NULL, &entropy_nrf5_data, NULL, - PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, - &entropy_nrf5_api_funcs); + PRE_KERNEL_1, &entropy_nrf5_api_funcs); static int entropy_nrf5_init(const struct device *dev) { diff --git a/drivers/entropy/entropy_psa_crypto.c b/drivers/entropy/entropy_psa_crypto.c index d9f5e8bc3982e..f40b6059e6385 100644 --- a/drivers/entropy/entropy_psa_crypto.c +++ b/drivers/entropy/entropy_psa_crypto.c @@ -46,6 +46,5 @@ static const struct entropy_driver_api entropy_psa_crypto_rng_api = { }; /* Entropy driver registration */ -DEVICE_DT_INST_DEFINE(0, entropy_psa_crypto_rng_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, - &entropy_psa_crypto_rng_api); +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_psa_crypto_rng_init, NULL, NULL, NULL, + PRE_KERNEL_1, &entropy_psa_crypto_rng_api); diff --git a/drivers/entropy/entropy_renesas_ra.c b/drivers/entropy/entropy_renesas_ra.c index 49f9302722c4b..67fd68d657243 100644 --- a/drivers/entropy/entropy_renesas_ra.c +++ b/drivers/entropy/entropy_renesas_ra.c @@ -45,5 +45,5 @@ static int entropy_ra_rsip_trng_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, entropy_ra_rsip_trng_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_ENTROPY_INIT_PRIORITY, &entropy_ra_rsip_trng_api); +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_ra_rsip_trng_init, NULL, NULL, NULL, PRE_KERNEL_1, + &entropy_ra_rsip_trng_api); diff --git a/drivers/entropy/entropy_rv32m1_trng.c b/drivers/entropy/entropy_rv32m1_trng.c index 0e44afb7c18e3..1d3c77e17d567 100644 --- a/drivers/entropy/entropy_rv32m1_trng.c +++ b/drivers/entropy/entropy_rv32m1_trng.c @@ -42,11 +42,10 @@ static struct rv32m1_entropy_config entropy_rv32m1_config = { static int entropy_rv32m1_trng_init(const struct device *); -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_rv32m1_trng_init, NULL, NULL, &entropy_rv32m1_config, - PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, - &entropy_rv32m1_trng_api_funcs); + PRE_KERNEL_1, &entropy_rv32m1_trng_api_funcs); static int entropy_rv32m1_trng_init(const struct device *dev) { diff --git a/drivers/entropy/entropy_sam.c b/drivers/entropy/entropy_sam.c index 57bdb8f841981..491b3322f794c 100644 --- a/drivers/entropy/entropy_sam.c +++ b/drivers/entropy/entropy_sam.c @@ -176,8 +176,7 @@ static const struct trng_sam_dev_cfg trng_sam_cfg = { .regs = (Trng *)DT_INST_REG_ADDR(0), }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_sam_init, NULL, NULL, &trng_sam_cfg, - PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, - &entropy_sam_api); + PRE_KERNEL_1, &entropy_sam_api); diff --git a/drivers/entropy/entropy_smartbond.c b/drivers/entropy/entropy_smartbond.c index 8a376c78c329d..0833fcd1cae3e 100644 --- a/drivers/entropy/entropy_smartbond.c +++ b/drivers/entropy/entropy_smartbond.c @@ -427,6 +427,6 @@ static int entropy_smartbond_init(const struct device *dev) PM_DEVICE_DT_INST_DEFINE(0, entropy_smartbond_pm_action); -DEVICE_DT_INST_DEFINE(0, entropy_smartbond_init, PM_DEVICE_DT_INST_GET(0), +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_smartbond_init, PM_DEVICE_DT_INST_GET(0), &entropy_smartbond_data, NULL, PRE_KERNEL_1, - CONFIG_ENTROPY_INIT_PRIORITY, &entropy_smartbond_api_funcs); + &entropy_smartbond_api_funcs); diff --git a/drivers/entropy/entropy_stm32.c b/drivers/entropy/entropy_stm32.c index f4127b76d8bde..5e84714ca8c07 100644 --- a/drivers/entropy/entropy_stm32.c +++ b/drivers/entropy/entropy_stm32.c @@ -770,9 +770,8 @@ static const struct entropy_driver_api entropy_stm32_rng_api = { PM_DEVICE_DT_INST_DEFINE(0, entropy_stm32_rng_pm_action); -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_stm32_rng_init, PM_DEVICE_DT_INST_GET(0), &entropy_stm32_rng_data, &entropy_stm32_rng_config, - PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, - &entropy_stm32_rng_api); + PRE_KERNEL_1, &entropy_stm32_rng_api); diff --git a/drivers/entropy/fake_entropy_native_posix.c b/drivers/entropy/fake_entropy_native_posix.c index e9ee4ab92844d..c9010082617a8 100644 --- a/drivers/entropy/fake_entropy_native_posix.c +++ b/drivers/entropy/fake_entropy_native_posix.c @@ -84,11 +84,10 @@ static const struct entropy_driver_api entropy_native_posix_api_funcs = { .get_entropy_isr = entropy_native_posix_get_entropy_isr }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, entropy_native_posix_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY, - &entropy_native_posix_api_funcs); + PRE_KERNEL_1, &entropy_native_posix_api_funcs); static void seed_was_set(char *argv, int offset) { diff --git a/drivers/espi/espi_emul.c b/drivers/espi/espi_emul.c index f0ab7c80642b5..9bc1d20b09a92 100644 --- a/drivers/espi/espi_emul.c +++ b/drivers/espi/espi_emul.c @@ -239,7 +239,7 @@ static struct emul_espi_driver_api emul_espi_driver_api = { .num_children = ARRAY_SIZE(emuls_##n), \ }; \ static struct espi_emul_data espi_emul_data_##n; \ - DEVICE_DT_INST_DEFINE(n, &espi_emul_init, NULL, &espi_emul_data_##n, &espi_emul_cfg_##n, \ - POST_KERNEL, CONFIG_ESPI_INIT_PRIORITY, &emul_espi_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &espi_emul_init, NULL, &espi_emul_data_##n, &espi_emul_cfg_##n,\ + POST_KERNEL, &emul_espi_driver_api); DT_INST_FOREACH_STATUS_OKAY(ESPI_EMUL_INIT) diff --git a/drivers/espi/espi_it8xxx2.c b/drivers/espi/espi_it8xxx2.c index 6135086e3bd2e..53da7674aec16 100644 --- a/drivers/espi/espi_it8xxx2.c +++ b/drivers/espi/espi_it8xxx2.c @@ -1888,10 +1888,9 @@ static const struct espi_it8xxx2_config espi_it8xxx2_config_0 = { .wuc = IT8XXX2_DT_WUC_ITEMS_FUNC(0, 0), }; -DEVICE_DT_INST_DEFINE(0, &espi_it8xxx2_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &espi_it8xxx2_init, NULL, &espi_it8xxx2_data_0, &espi_it8xxx2_config_0, - PRE_KERNEL_2, CONFIG_ESPI_INIT_PRIORITY, - &espi_it8xxx2_driver_api); + PRE_KERNEL_2, &espi_it8xxx2_driver_api); static int espi_it8xxx2_init(const struct device *dev) { diff --git a/drivers/espi/espi_mchp_xec.c b/drivers/espi/espi_mchp_xec.c index 88af24554a160..498a2305f365d 100644 --- a/drivers/espi/espi_mchp_xec.c +++ b/drivers/espi/espi_mchp_xec.c @@ -1463,10 +1463,9 @@ static const struct espi_xec_config espi_xec_config = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0), }; -DEVICE_DT_INST_DEFINE(0, &espi_xec_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &espi_xec_init, NULL, &espi_xec_data, &espi_xec_config, - PRE_KERNEL_2, CONFIG_ESPI_INIT_PRIORITY, - &espi_xec_driver_api); + PRE_KERNEL_2, &espi_xec_driver_api); static int espi_xec_init(const struct device *dev) { diff --git a/drivers/espi/espi_mchp_xec_v2.c b/drivers/espi/espi_mchp_xec_v2.c index 46276db97b4d7..416770abc1056 100644 --- a/drivers/espi/espi_mchp_xec_v2.c +++ b/drivers/espi/espi_mchp_xec_v2.c @@ -1297,10 +1297,9 @@ static const struct espi_xec_config espi_xec_config = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0), }; -DEVICE_DT_INST_DEFINE(0, &espi_xec_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &espi_xec_init, NULL, &espi_xec_data_var, &espi_xec_config, - PRE_KERNEL_2, CONFIG_ESPI_INIT_PRIORITY, - &espi_xec_driver_api); + PRE_KERNEL_2, &espi_xec_driver_api); /* * Connect ESPI bus interrupt handlers: ESPI_RESET and channels. diff --git a/drivers/espi/espi_npcx.c b/drivers/espi/espi_npcx.c index a44fec50706a4..ee00f9e7026bb 100644 --- a/drivers/espi/espi_npcx.c +++ b/drivers/espi/espi_npcx.c @@ -1379,10 +1379,9 @@ static const struct espi_npcx_config espi_npcx_config = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0), }; -DEVICE_DT_INST_DEFINE(0, &espi_npcx_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &espi_npcx_init, NULL, &espi_npcx_data, &espi_npcx_config, - PRE_KERNEL_2, CONFIG_ESPI_INIT_PRIORITY, - &espi_npcx_driver_api); + PRE_KERNEL_2, &espi_npcx_driver_api); static int espi_npcx_init(const struct device *dev) { diff --git a/drivers/espi/espi_saf_mchp_xec.c b/drivers/espi/espi_saf_mchp_xec.c index d649deaaa14f0..f34f93e6f71bf 100644 --- a/drivers/espi/espi_saf_mchp_xec.c +++ b/drivers/espi/espi_saf_mchp_xec.c @@ -847,9 +847,9 @@ static const struct espi_saf_xec_config espi_saf_xec_config = { MCHP_SAF_FLASH_POLL_INTERVAL), }; -DEVICE_DT_INST_DEFINE(0, &espi_saf_xec_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &espi_saf_xec_init, NULL, &espi_saf_xec_data, &espi_saf_xec_config, POST_KERNEL, - CONFIG_ESPI_TAF_INIT_PRIORITY, &espi_saf_xec_driver_api); + &espi_saf_xec_driver_api); static int espi_saf_xec_init(const struct device *dev) { diff --git a/drivers/espi/espi_saf_mchp_xec_v2.c b/drivers/espi/espi_saf_mchp_xec_v2.c index 67fb4a5162fe2..e0a480cc9dc63 100644 --- a/drivers/espi/espi_saf_mchp_xec_v2.c +++ b/drivers/espi/espi_saf_mchp_xec_v2.c @@ -1139,10 +1139,9 @@ static int espi_saf_xec_init(const struct device *dev) .irq_info_size = ARRAY_SIZE(espi_saf_xec_irq_info_##n), \ .irq_info_list = espi_saf_xec_irq_info_##n, \ }; \ - DEVICE_DT_INST_DEFINE(0, &espi_saf_xec_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(0, &espi_saf_xec_init, NULL, \ &espisaf_xec_data_##n, \ &espisaf_xec_config_##n, POST_KERNEL, \ - CONFIG_ESPI_TAF_INIT_PRIORITY, \ &espi_saf_xec_driver_api); \ \ static void espi_saf_xec_connect_irqs_##n(void) \ diff --git a/drivers/espi/espi_taf_npcx.c b/drivers/espi/espi_taf_npcx.c index 997c5364fd513..5bbe2284ba592 100644 --- a/drivers/espi/espi_taf_npcx.c +++ b/drivers/espi/espi_taf_npcx.c @@ -657,7 +657,6 @@ static const struct espi_taf_npcx_config espi_taf_npcx_config = { #endif }; -DEVICE_DT_INST_DEFINE(0, &espi_taf_npcx_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &espi_taf_npcx_init, NULL, &npcx_espi_taf_data, &espi_taf_npcx_config, - PRE_KERNEL_2, CONFIG_ESPI_INIT_PRIORITY, - &espi_taf_npcx_driver_api); + PRE_KERNEL_2, &espi_taf_npcx_driver_api); diff --git a/drivers/ethernet/eth_adin2111.c b/drivers/ethernet/eth_adin2111.c index 536209a84efc4..83dbd06e6a1b8 100644 --- a/drivers/ethernet/eth_adin2111.c +++ b/drivers/ethernet/eth_adin2111.c @@ -1536,10 +1536,8 @@ static const struct ethernet_api adin2111_port_api = { .port_idx = port_n, \ .phy_addr = phy_n, \ }; \ - ETH_NET_DEVICE_INIT_INSTANCE(name##_port_##port_n, "port_" ADIN2111_XSTR(port_n), \ - port_n, NULL, NULL, &name##_port_data_##port_n, \ - &name##_port_config_##port_n, CONFIG_ETH_INIT_PRIORITY, \ - &adin2111_port_api, NET_ETH_MTU); + ETH_NET_DEVICE_INSTANCE_MULTI(name##_port_##port_n, port_n, NULL, NULL, &name##_port_data_##port_n,\ + &name##_port_config_##port_n, &adin2111_port_api, NET_ETH_MTU); #define ADIN2111_SPI_OPERATION ((uint16_t)(SPI_OP_MODE_MASTER | SPI_TRANSFER_MSB | SPI_WORD_SET(8))) #define ADIN2111_MAC_INITIALIZE(inst, dev_id, ifaces, name) \ @@ -1570,10 +1568,9 @@ static const struct ethernet_api adin2111_port_api = { (name##_oa_rx_buf_##inst), (NULL)), \ }; \ /* adin */ \ - DEVICE_DT_DEFINE(DT_DRV_INST(inst), adin2111_init, NULL, \ + DEVICE_INSTANCE(DT_DRV_INST(inst), adin2111_init, NULL, \ &name##_data_##inst, &name##_config_##inst, \ - POST_KERNEL, CONFIG_ETH_INIT_PRIORITY, \ - NULL); + POST_KERNEL, NULL); #define ADIN2111_MAC_INIT(inst) ADIN2111_MAC_INITIALIZE(inst, ADIN2111_MAC, 2, adin2111) \ /* ports */ \ diff --git a/drivers/ethernet/eth_cyclonev.c b/drivers/ethernet/eth_cyclonev.c index 483516e684ab5..979d676aff23c 100644 --- a/drivers/ethernet/eth_cyclonev.c +++ b/drivers/ethernet/eth_cyclonev.c @@ -1153,12 +1153,11 @@ const struct ethernet_api eth_cyclonev_api = {.iface_api.init = eth_cyclonev_ifa .emac_index = DT_INST_PROP(inst, emac_index), \ .irq_config = eth_cyclonev_##inst##_irq_config, \ }; \ - ETH_NET_DEVICE_DT_INST_DEFINE(inst, eth_cyclonev_probe, NULL, \ - ð_cyclonev_##inst##_data, \ - ð_cyclonev_##inst##_cfg, \ - CONFIG_ETH_INIT_PRIORITY, \ - ð_cyclonev_api, \ - NET_ETH_MTU); \ + ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(inst, eth_cyclonev_probe, NULL,\ + ð_cyclonev_##inst##_data, \ + ð_cyclonev_##inst##_cfg, \ + ð_cyclonev_api, \ + NET_ETH_MTU), \ \ static void eth_cyclonev_##inst##_irq_config(void) \ { \ diff --git a/drivers/ethernet/eth_dwmac_mmu.c b/drivers/ethernet/eth_dwmac_mmu.c index f7136dfba4c49..6eddc96e90b17 100644 --- a/drivers/ethernet/eth_dwmac_mmu.c +++ b/drivers/ethernet/eth_dwmac_mmu.c @@ -89,11 +89,10 @@ void dwmac_platform_init(struct dwmac_priv *p) /* Our private device instance */ static struct dwmac_priv dwmac_instance; -ETH_NET_DEVICE_DT_INST_DEFINE(0, +ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(0, dwmac_probe, NULL, &dwmac_instance, NULL, - CONFIG_ETH_INIT_PRIORITY, &dwmac_api, NET_ETH_MTU); diff --git a/drivers/ethernet/eth_dwmac_stm32h7x.c b/drivers/ethernet/eth_dwmac_stm32h7x.c index 846008c842de3..a64fa8c1091dd 100644 --- a/drivers/ethernet/eth_dwmac_stm32h7x.c +++ b/drivers/ethernet/eth_dwmac_stm32h7x.c @@ -121,11 +121,10 @@ void dwmac_platform_init(struct dwmac_priv *p) /* Our private device instance */ static struct dwmac_priv dwmac_instance; -ETH_NET_DEVICE_DT_INST_DEFINE(0, +ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(0, dwmac_probe, NULL, &dwmac_instance, NULL, - CONFIG_ETH_INIT_PRIORITY, &dwmac_api, NET_ETH_MTU); diff --git a/drivers/ethernet/eth_e1000.c b/drivers/ethernet/eth_e1000.c index 31dd7e28b24cc..5bfc216c9d410 100644 --- a/drivers/ethernet/eth_e1000.c +++ b/drivers/ethernet/eth_e1000.c @@ -307,12 +307,11 @@ static const struct ethernet_api e1000_api = { .config_func = e1000_config_##inst, \ }; \ \ - ETH_NET_DEVICE_DT_INST_DEFINE(inst, \ + ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(inst, \ e1000_probe, \ NULL, \ &dev_##inst, \ &config_##inst, \ - CONFIG_ETH_INIT_PRIORITY, \ &e1000_api, \ NET_ETH_MTU); @@ -434,10 +433,9 @@ static int ptp_e1000_init(const struct device *port) .eth_context = DEVICE_DT_INST_GET(inst)->data, \ }; \ \ - DEVICE_DEFINE(e1000_ptp_clock, PTP_CLOCK_NAME, \ - ptp_e1000_init, NULL, \ + DEVICE_INSTANCE(e1000_ptp_clock, ptp_e1000_init, NULL, \ &ptp_e1000_context_##inst, NULL, POST_KERNEL, \ - CONFIG_APPLICATION_INIT_PRIORITY, &api); + &api); DT_INST_FOREACH_STATUS_OKAY(E1000_PTP_INIT); diff --git a/drivers/ethernet/eth_enc28j60.c b/drivers/ethernet/eth_enc28j60.c index 260626d0b722e..6671b90b0c5bd 100644 --- a/drivers/ethernet/eth_enc28j60.c +++ b/drivers/ethernet/eth_enc28j60.c @@ -875,8 +875,7 @@ static int eth_enc28j60_init(const struct device *dev) .random_mac = DT_INST_PROP(inst, zephyr_random_mac_address), \ }; \ \ - ETH_NET_DEVICE_DT_INST_DEFINE(inst, eth_enc28j60_init, NULL, ð_enc28j60_runtime_##inst, \ - ð_enc28j60_config_##inst, CONFIG_ETH_INIT_PRIORITY, \ - &api_funcs, NET_ETH_MTU); + ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(inst, eth_enc28j60_init, NULL, ð_enc28j60_runtime_##inst,\ + ð_enc28j60_config_##inst, &api_funcs, NET_ETH_MTU); DT_INST_FOREACH_STATUS_OKAY(ENC28J60_DEFINE); diff --git a/drivers/ethernet/eth_enc424j600.c b/drivers/ethernet/eth_enc424j600.c index 0e317c3d8ba94..4efc457d2602e 100644 --- a/drivers/ethernet/eth_enc424j600.c +++ b/drivers/ethernet/eth_enc424j600.c @@ -832,7 +832,7 @@ static const struct enc424j600_config enc424j600_0_config = { .timeout = CONFIG_ETH_ENC424J600_TIMEOUT, }; -ETH_NET_DEVICE_DT_INST_DEFINE(0, +ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(0, enc424j600_init, NULL, &enc424j600_0_runtime, &enc424j600_0_config, - CONFIG_ETH_INIT_PRIORITY, &api_funcs, NET_ETH_MTU); + &api_funcs, NET_ETH_MTU); diff --git a/drivers/ethernet/eth_esp32.c b/drivers/ethernet/eth_esp32.c index 59977d357e125..996e6dee079a2 100644 --- a/drivers/ethernet/eth_esp32.c +++ b/drivers/ethernet/eth_esp32.c @@ -400,11 +400,10 @@ static struct eth_esp32_dev_data eth_esp32_dev = { .dma = ð_esp32_dma_data, }; -ETH_NET_DEVICE_DT_INST_DEFINE(0, +ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(0, eth_esp32_initialize, NULL, ð_esp32_dev, NULL, - CONFIG_ETH_INIT_PRIORITY, ð_esp32_api, NET_ETH_MTU); diff --git a/drivers/ethernet/eth_gecko.c b/drivers/ethernet/eth_gecko.c index 82c6e07b3f9a9..84b88dbe2de4d 100644 --- a/drivers/ethernet/eth_gecko.c +++ b/drivers/ethernet/eth_gecko.c @@ -672,6 +672,6 @@ static struct eth_gecko_dev_data eth0_data = { #endif }; -ETH_NET_DEVICE_DT_INST_DEFINE(0, eth_init, +ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(0, eth_init, NULL, ð0_data, ð0_config, - CONFIG_ETH_INIT_PRIORITY, ð_api, ETH_GECKO_MTU); + ð_api, ETH_GECKO_MTU); diff --git a/drivers/ethernet/eth_ivshmem.c b/drivers/ethernet/eth_ivshmem.c index ae8135f2e2222..c995ef4c14f71 100644 --- a/drivers/ethernet/eth_ivshmem.c +++ b/drivers/ethernet/eth_ivshmem.c @@ -419,12 +419,11 @@ static const struct ethernet_api eth_ivshmem_api = { .name = "ivshmem_eth" STRINGIFY(inst), \ .generate_mac_addr = generate_mac_addr_##inst, \ }; \ - ETH_NET_DEVICE_DT_INST_DEFINE(inst, \ + ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(inst, \ eth_ivshmem_initialize, \ NULL, \ ð_ivshmem_dev_##inst, \ ð_ivshmem_cfg_##inst, \ - CONFIG_ETH_INIT_PRIORITY, \ ð_ivshmem_api, \ NET_ETH_MTU); diff --git a/drivers/ethernet/eth_lan865x.c b/drivers/ethernet/eth_lan865x.c index 0ced9732928af..c3c8931a053e6 100644 --- a/drivers/ethernet/eth_lan865x.c +++ b/drivers/ethernet/eth_lan865x.c @@ -610,8 +610,7 @@ static const struct ethernet_api lan865x_api_func = { .tc6 = &oa_tc6_##inst \ }; \ \ - ETH_NET_DEVICE_DT_INST_DEFINE(inst, lan865x_init, NULL, &lan865x_data_##inst, \ - &lan865x_config_##inst, CONFIG_ETH_INIT_PRIORITY, \ - &lan865x_api_func, NET_ETH_MTU); + ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(inst, lan865x_init, NULL, &lan865x_data_##inst, \ + &lan865x_config_##inst, &lan865x_api_func, NET_ETH_MTU); DT_INST_FOREACH_STATUS_OKAY(LAN865X_DEFINE); diff --git a/drivers/ethernet/eth_litex_liteeth.c b/drivers/ethernet/eth_litex_liteeth.c index a8b1b38c739be..30fa77b57d1b8 100644 --- a/drivers/ethernet/eth_litex_liteeth.c +++ b/drivers/ethernet/eth_litex_liteeth.c @@ -350,7 +350,7 @@ static const struct ethernet_api eth_api = { \ }; \ \ - ETH_NET_DEVICE_DT_INST_DEFINE(n, eth_initialize, NULL, ð_data##n, ð_config##n, \ - CONFIG_ETH_INIT_PRIORITY, ð_api, NET_ETH_MTU); + ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(n, eth_initialize, NULL, ð_data##n, ð_config##n,\ + ð_api, NET_ETH_MTU); DT_INST_FOREACH_STATUS_OKAY(ETH_LITEX_INIT); diff --git a/drivers/ethernet/eth_native_posix.c b/drivers/ethernet/eth_native_posix.c index fdd63cced5351..7497bdb9de79c 100644 --- a/drivers/ethernet/eth_native_posix.c +++ b/drivers/ethernet/eth_native_posix.c @@ -487,10 +487,8 @@ static const struct ethernet_api eth_if_api = { LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_ETH_DEV_DATA, (;), _); #define DEFINE_ETH_DEVICE(x, _) \ - ETH_NET_DEVICE_INIT(eth_native_posix_##x, \ - CONFIG_ETH_NATIVE_POSIX_DRV_NAME #x, \ + ETH_NET_DEVICE_INSTANCE(eth_native_posix_##x, \ NULL, NULL, ð_context_data_##x, NULL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ ð_if_api, \ NET_ETH_MTU) @@ -583,14 +581,12 @@ static const struct ptp_clock_driver_api api = { LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, PTP_INIT_FUNC, (), _) #define DEFINE_PTP_DEVICE(x, _) \ - DEVICE_DEFINE(eth_native_posix_ptp_clock_##x, \ - PTP_CLOCK_NAME "_" #x, \ + DEVICE_INSTANCE(eth_native_posix_ptp_clock_##x, \ ptp_init_##x, \ NULL, \ &ptp_context_##x, \ NULL, \ POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ &api) LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_PTP_DEVICE, (;), _); diff --git a/drivers/ethernet/eth_numaker.c b/drivers/ethernet/eth_numaker.c index 77577943f23dc..13ee5a734e1f7 100644 --- a/drivers/ethernet/eth_numaker.c +++ b/drivers/ethernet/eth_numaker.c @@ -785,6 +785,5 @@ static struct eth_numaker_config eth_numaker_cfg_inst = { .reset = RESET_DT_SPEC_INST_GET(0), }; -ETH_NET_DEVICE_DT_INST_DEFINE(0, eth_numaker_init, NULL, ð_numaker_data_inst, - ð_numaker_cfg_inst, CONFIG_ETH_INIT_PRIORITY, - ð_numaker_driver_api, NET_ETH_MTU); +ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(0, eth_numaker_init, NULL, ð_numaker_data_inst, + ð_numaker_cfg_inst, ð_numaker_driver_api, NET_ETH_MTU); diff --git a/drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos.c b/drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos.c index aa89232a56001..22e775c73b368 100644 --- a/drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos.c +++ b/drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos.c @@ -38,7 +38,7 @@ int nxp_enet_qos_init(const struct device *dev) }; \ \ /* Init the module before any enet device inits so priority 0 */ \ - DEVICE_DT_INST_DEFINE(n, nxp_enet_qos_init, NULL, NULL, \ - &enet_qos_##n##_config, POST_KERNEL, 0, NULL); + DEVICE_INSTANCE_FROM_DT_INST(n, nxp_enet_qos_init, NULL, NULL, \ + &enet_qos_##n##_config, POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(NXP_ENET_QOS_INIT) diff --git a/drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos_mac.c b/drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos_mac.c index 99acf2b8ebb73..3888126582799 100644 --- a/drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos_mac.c +++ b/drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos_mac.c @@ -625,8 +625,8 @@ static const struct ethernet_api api_funcs = { DT_INST_FOREACH_STATUS_OKAY(NXP_ENET_QOS_DRIVER_INIT) #define NXP_ENET_QOS_MAC_DEVICE_DEFINE(n) \ - ETH_NET_DEVICE_DT_INST_DEFINE(n, eth_nxp_enet_qos_mac_init, NULL, \ + ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(n, eth_nxp_enet_qos_mac_init, NULL, \ &enet_qos_##n##_mac_data, &enet_qos_##n##_mac_config, \ - CONFIG_ETH_INIT_PRIORITY, &api_funcs, NET_ETH_MTU); + &api_funcs, NET_ETH_MTU); DT_INST_FOREACH_STATUS_OKAY(NXP_ENET_QOS_MAC_DEVICE_DEFINE) diff --git a/drivers/ethernet/eth_nxp_imx_netc_psi.c b/drivers/ethernet/eth_nxp_imx_netc_psi.c index d12b34e6308a1..d35ee5acd9b32 100644 --- a/drivers/ethernet/eth_nxp_imx_netc_psi.c +++ b/drivers/ethernet/eth_nxp_imx_netc_psi.c @@ -187,7 +187,6 @@ static const struct ethernet_api netc_eth_api = {.iface_api.init = netc_eth_ifac .tx_intr_msg_data = NETC_TX_INTR_MSG_DATA_START + n, \ .rx_intr_msg_data = NETC_RX_INTR_MSG_DATA_START + n, \ }; \ - ETH_NET_DEVICE_DT_INST_DEFINE(n, netc_eth_init, NULL, &netc_eth##n##_data, \ - &netc_eth##n##_config, CONFIG_ETH_INIT_PRIORITY, \ - &netc_eth_api, NET_ETH_MTU); + ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(n, netc_eth_init, NULL, &netc_eth##n##_data, \ + &netc_eth##n##_config, &netc_eth_api, NET_ETH_MTU); DT_INST_FOREACH_STATUS_OKAY(NETC_PSI_INSTANCE_DEFINE) diff --git a/drivers/ethernet/eth_nxp_s32_gmac.c b/drivers/ethernet/eth_nxp_s32_gmac.c index f6eaa950a98f6..7e56b59346821 100644 --- a/drivers/ethernet/eth_nxp_s32_gmac.c +++ b/drivers/ethernet/eth_nxp_s32_gmac.c @@ -814,12 +814,11 @@ BUILD_ASSERT((CONFIG_ETH_NXP_S32_TX_RING_BUF_SIZE % FEATURE_GMAC_DATA_BUS_WIDTH_ \ static struct eth_nxp_s32_data eth_nxp_s32_data_##n; \ \ - ETH_NET_DEVICE_DT_INST_DEFINE(n, \ + ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(n, \ eth_nxp_s32_init, \ NULL, \ ð_nxp_s32_data_##n, \ ð_nxp_s32_config_##n, \ - CONFIG_ETH_INIT_PRIORITY, \ ð_api, \ NET_ETH_MTU); diff --git a/drivers/ethernet/eth_nxp_s32_netc_psi.c b/drivers/ethernet/eth_nxp_s32_netc_psi.c index 69ff36d0f645a..b4beacad13cde 100644 --- a/drivers/ethernet/eth_nxp_s32_netc_psi.c +++ b/drivers/ethernet/eth_nxp_s32_netc_psi.c @@ -428,12 +428,11 @@ static struct nxp_s32_eth_data nxp_s32_eth##n##_data = { \ .mac_addr = DT_INST_PROP_OR(n, local_mac_address, {0}), \ }; \ \ -ETH_NET_DEVICE_DT_INST_DEFINE(n, \ +ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(n, \ nxp_s32_eth_initialize, \ NULL, \ &nxp_s32_eth##n##_data, \ &nxp_s32_eth##n##_config, \ - CONFIG_ETH_INIT_PRIORITY, \ &nxp_s32_eth_api, \ NET_ETH_MTU); \ diff --git a/drivers/ethernet/eth_nxp_s32_netc_vsi.c b/drivers/ethernet/eth_nxp_s32_netc_vsi.c index bf5046cd8bfea..acbfa91dc9316 100644 --- a/drivers/ethernet/eth_nxp_s32_netc_vsi.c +++ b/drivers/ethernet/eth_nxp_s32_netc_vsi.c @@ -167,12 +167,11 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(nxp_s32_netc_vsi) == 1, "Only one VSI enabl .generate_mac = nxp_s32_eth##n##_generate_mac, \ }; \ \ - ETH_NET_DEVICE_DT_INST_DEFINE(n, \ + ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(n, \ nxp_s32_eth_initialize_common, \ NULL, \ &nxp_s32_eth##n##_data, \ &nxp_s32_eth##n##_cfg, \ - CONFIG_ETH_NXP_S32_VSI_INIT_PRIORITY, \ &nxp_s32_eth_api, \ NET_ETH_MTU); diff --git a/drivers/ethernet/eth_sam_gmac.c b/drivers/ethernet/eth_sam_gmac.c index c7d90bb6e30be..d88fd73b8aa5c 100644 --- a/drivers/ethernet/eth_sam_gmac.c +++ b/drivers/ethernet/eth_sam_gmac.c @@ -2334,9 +2334,9 @@ static struct eth_sam_dev_data eth0_data = { }, }; -ETH_NET_DEVICE_DT_INST_DEFINE(0, +ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(0, eth_initialize, NULL, ð0_data, - ð0_config, CONFIG_ETH_INIT_PRIORITY, ð_api, + ð0_config, ð_api, GMAC_MTU); #if defined(CONFIG_PTP_CLOCK_SAM_GMAC) @@ -2417,8 +2417,8 @@ static int ptp_gmac_init(const struct device *port) return 0; } -DEVICE_DEFINE(gmac_ptp_clock_0, PTP_CLOCK_NAME, ptp_gmac_init, +DEVICE_INSTANCE(gmac_ptp_clock_0, ptp_gmac_init, NULL, &ptp_gmac_0_context, NULL, POST_KERNEL, - CONFIG_PTP_CLOCK_INIT_PRIORITY, &ptp_api); + &ptp_api); #endif /* CONFIG_PTP_CLOCK_SAM_GMAC */ diff --git a/drivers/ethernet/eth_slip_tap.c b/drivers/ethernet/eth_slip_tap.c index 8af5f587d7947..861503e602055 100644 --- a/drivers/ethernet/eth_slip_tap.c +++ b/drivers/ethernet/eth_slip_tap.c @@ -37,8 +37,6 @@ static const struct ethernet_api slip_if_api = { #define _SLIP_L2_LAYER ETHERNET_L2 #define _SLIP_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(ETHERNET_L2) -ETH_NET_DEVICE_INIT(slip, CONFIG_SLIP_DRV_NAME, - slip_init, NULL, +ETH_NET_DEVICE_INSTANCE(slip, slip_init, NULL, &slip_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &slip_if_api, _SLIP_MTU); diff --git a/drivers/ethernet/eth_smsc91x.c b/drivers/ethernet/eth_smsc91x.c index ab19ecd4e404f..f23df0be7adc9 100644 --- a/drivers/ethernet/eth_smsc91x.c +++ b/drivers/ethernet/eth_smsc91x.c @@ -834,10 +834,9 @@ static struct eth_config eth_0_config = { .phy_dev = DEVICE_DT_GET(DT_INST_PHANDLE(0, phy_handle)), }; -ETH_NET_DEVICE_DT_INST_DEFINE(0, +ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(0, eth_init, NULL, ð_0_context, - ð_0_config, CONFIG_ETH_INIT_PRIORITY, - &api_funcs, NET_ETH_MTU); + ð_0_config, &api_funcs, NET_ETH_MTU); #undef DT_DRV_COMPAT #define DT_DRV_COMPAT smsc_lan91c111_mdio @@ -891,5 +890,5 @@ const struct mdio_smsc_config mdio_smsc_config_0 = { .eth_dev = DEVICE_DT_GET(DT_CHILD(DT_INST_PARENT(0), ethernet)), }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, &mdio_smsc_config_0, POST_KERNEL, - CONFIG_MDIO_INIT_PRIORITY, &mdio_smsc_api); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, &mdio_smsc_config_0, POST_KERNEL, + &mdio_smsc_api); diff --git a/drivers/ethernet/eth_stellaris.c b/drivers/ethernet/eth_stellaris.c index dc7503e67af82..f00b4d71889ee 100644 --- a/drivers/ethernet/eth_stellaris.c +++ b/drivers/ethernet/eth_stellaris.c @@ -363,8 +363,7 @@ static const struct ethernet_api eth_stellaris_apis = { #endif }; -NET_DEVICE_DT_INST_DEFINE(0, +NET_DEVICE_INSTANCE_FROM_DT_INST(0, eth_stellaris_dev_init, NULL, - ð_data, ð_cfg, CONFIG_ETH_INIT_PRIORITY, - ð_stellaris_apis, ETHERNET_L2, + ð_data, ð_cfg, ð_stellaris_apis, ETHERNET_L2, NET_L2_GET_CTX_TYPE(ETHERNET_L2), NET_ETH_MTU); diff --git a/drivers/ethernet/eth_stm32_hal.c b/drivers/ethernet/eth_stm32_hal.c index 224ce2f7876d4..852a59ad7b73e 100644 --- a/drivers/ethernet/eth_stm32_hal.c +++ b/drivers/ethernet/eth_stm32_hal.c @@ -1336,9 +1336,9 @@ static struct eth_stm32_hal_dev_data eth0_data = { }, }; -ETH_NET_DEVICE_DT_INST_DEFINE(0, eth_initialize, +ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(0, eth_initialize, NULL, ð0_data, ð0_config, - CONFIG_ETH_INIT_PRIORITY, ð_api, ETH_STM32_HAL_MTU); + ð_api, ETH_STM32_HAL_MTU); #if defined(CONFIG_PTP_CLOCK_STM32_HAL) @@ -1640,8 +1640,8 @@ static int ptp_stm32_init(const struct device *port) return 0; } -DEVICE_DEFINE(stm32_ptp_clock_0, PTP_CLOCK_NAME, ptp_stm32_init, +DEVICE_INSTANCE(stm32_ptp_clock_0, ptp_stm32_init, NULL, &ptp_stm32_0_context, NULL, POST_KERNEL, - CONFIG_ETH_STM32_HAL_PTP_CLOCK_INIT_PRIO, &api); + &api); #endif /* CONFIG_PTP_CLOCK_STM32_HAL */ diff --git a/drivers/ethernet/eth_test.c b/drivers/ethernet/eth_test.c index 56ae2e287f7dc..6cd8547e53f4e 100644 --- a/drivers/ethernet/eth_test.c +++ b/drivers/ethernet/eth_test.c @@ -128,7 +128,6 @@ struct ethernet_api vnd_ethernet_api = { }; #define VND_ETHERNET_INIT(n) \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, POST_KERNEL, CONFIG_ETH_INIT_PRIORITY, \ - &vnd_ethernet_api); + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, NULL, NULL, POST_KERNEL, &vnd_ethernet_api); DT_INST_FOREACH_STATUS_OKAY(VND_ETHERNET_INIT) diff --git a/drivers/ethernet/eth_w5500.c b/drivers/ethernet/eth_w5500.c index d7a06b6ec5c14..d3177f32dca32 100644 --- a/drivers/ethernet/eth_w5500.c +++ b/drivers/ethernet/eth_w5500.c @@ -617,7 +617,7 @@ static const struct w5500_config w5500_0_config = { .timeout = CONFIG_ETH_W5500_TIMEOUT, }; -ETH_NET_DEVICE_DT_INST_DEFINE(0, +ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(0, w5500_init, NULL, &w5500_0_runtime, &w5500_0_config, - CONFIG_ETH_INIT_PRIORITY, &w5500_api_funcs, NET_ETH_MTU); + &w5500_api_funcs, NET_ETH_MTU); diff --git a/drivers/ethernet/eth_xmc4xxx.c b/drivers/ethernet/eth_xmc4xxx.c index f2197099e27c7..e9b9e663e5000 100644 --- a/drivers/ethernet/eth_xmc4xxx.c +++ b/drivers/ethernet/eth_xmc4xxx.c @@ -1005,8 +1005,8 @@ static struct eth_xmc4xxx_data eth_xmc4xxx_data = { .mac_addr = DT_INST_PROP_OR(0, local_mac_address, {0}), }; -ETH_NET_DEVICE_DT_INST_DEFINE(0, eth_xmc4xxx_init, NULL, ð_xmc4xxx_data, ð_xmc4xxx_config, - CONFIG_ETH_INIT_PRIORITY, ð_xmc4xxx_api, NET_ETH_MTU); +ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(0, eth_xmc4xxx_init, NULL, ð_xmc4xxx_data, ð_xmc4xxx_config, + ð_xmc4xxx_api, NET_ETH_MTU); #if defined(CONFIG_PTP_CLOCK_XMC4XXX) @@ -1132,8 +1132,7 @@ static int ptp_clock_xmc4xxx_init(const struct device *port) return 0; } -DEVICE_DEFINE(xmc4xxx_ptp_clock_0, PTP_CLOCK_NAME, ptp_clock_xmc4xxx_init, NULL, - &ptp_xmc4xxx_context_0, NULL, POST_KERNEL, CONFIG_PTP_CLOCK_INIT_PRIORITY, - &ptp_api_xmc4xxx); +DEVICE_INSTANCE(xmc4xxx_ptp_clock_0, ptp_clock_xmc4xxx_init, NULL, + &ptp_xmc4xxx_context_0, NULL, POST_KERNEL, &ptp_api_xmc4xxx); #endif /* CONFIG_PTP_CLOCK_XMC4XXX */ diff --git a/drivers/ethernet/nxp_enet/eth_mcux.c b/drivers/ethernet/nxp_enet/eth_mcux.c index 397fa58bae146..07ae26a4058a0 100644 --- a/drivers/ethernet/nxp_enet/eth_mcux.c +++ b/drivers/ethernet/nxp_enet/eth_mcux.c @@ -1561,14 +1561,13 @@ static void eth_mcux_err_isr(const struct device *dev) \ ETH_MCUX_PM_DEVICE_INIT(n) \ \ - ETH_NET_DEVICE_DT_INST_DEFINE(n, \ + ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(n, \ eth_init, \ ETH_MCUX_PM_DEVICE_GET(n), \ ð##n##_context, \ ð##n##_buffer_config, \ - CONFIG_ETH_INIT_PRIORITY, \ &api_funcs, \ - NET_ETH_MTU); \ + NET_ETH_MTU), \ \ static void eth##n##_config_func(void) \ { \ @@ -1738,8 +1737,8 @@ static int ptp_mcux_init(const struct device *port) return 0; } -DEVICE_DEFINE(mcux_ptp_clock_0, PTP_CLOCK_NAME, ptp_mcux_init, +DEVICE_INSTANCE(mcux_ptp_clock_0, ptp_mcux_init, NULL, &ptp_mcux_0_context, NULL, POST_KERNEL, - CONFIG_ETH_MCUX_PTP_CLOCK_INIT_PRIO, &api); + &api); #endif /* CONFIG_PTP_CLOCK_MCUX */ diff --git a/drivers/ethernet/nxp_enet/eth_nxp_enet.c b/drivers/ethernet/nxp_enet/eth_nxp_enet.c index f575bfa5ffd14..4738014f6481f 100644 --- a/drivers/ethernet/nxp_enet/eth_nxp_enet.c +++ b/drivers/ethernet/nxp_enet/eth_nxp_enet.c @@ -1036,10 +1036,9 @@ BUILD_ASSERT(NXP_ENET_PHY_MODE(DT_DRV_INST(n)) != NXP_ENET_RGMII_MODE || \ \ ETH_NXP_ENET_PM_DEVICE_INIT(n) \ \ - ETH_NET_DEVICE_DT_INST_DEFINE(n, eth_nxp_enet_init, \ + ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(n, eth_nxp_enet_init, \ ETH_NXP_ENET_PM_DEVICE_GET(n), \ &nxp_enet_##n##_data, &nxp_enet_##n##_config, \ - CONFIG_ETH_INIT_PRIORITY, \ &api_funcs, NET_ETH_MTU); DT_INST_FOREACH_STATUS_OKAY(NXP_ENET_MAC_INIT) @@ -1084,9 +1083,9 @@ static const struct nxp_enet_mod_config nxp_enet_mod_cfg_##n = { \ static struct nxp_enet_mod_data nxp_enet_mod_data_##n; \ \ /* Init the module before any of the MAC, MDIO, or PTP clock */ \ -DEVICE_DT_INST_DEFINE(n, nxp_enet_mod_init, NULL, \ +DEVICE_INSTANCE_FROM_DT_INST(n, nxp_enet_mod_init, NULL, \ &nxp_enet_mod_data_##n, &nxp_enet_mod_cfg_##n, \ - POST_KERNEL, 0, NULL); + POST_KERNEL, NULL); #undef DT_DRV_COMPAT #define DT_DRV_COMPAT nxp_enet @@ -1105,9 +1104,9 @@ static const struct nxp_enet_mod_config nxp_enet1g_mod_cfg_##n = { \ static struct nxp_enet_mod_data nxp_enet1g_mod_data_##n; \ \ /* Init the module before any of the MAC, MDIO, or PTP clock */ \ -DEVICE_DT_INST_DEFINE(n, nxp_enet_mod_init, NULL, \ +DEVICE_INSTANCE_FROM_DT_INST(n, nxp_enet_mod_init, NULL, \ &nxp_enet1g_mod_data_##n, &nxp_enet1g_mod_cfg_##n, \ - POST_KERNEL, 0, NULL); + POST_KERNEL, NULL); #undef DT_DRV_COMPAT #define DT_DRV_COMPAT nxp_enet1g diff --git a/drivers/ethernet/phy/phy_adin2111.c b/drivers/ethernet/phy/phy_adin2111.c index 902838bd08d22..799a66e35c81b 100644 --- a/drivers/ethernet/phy/phy_adin2111.c +++ b/drivers/ethernet/phy/phy_adin2111.c @@ -649,9 +649,8 @@ static const struct ethphy_driver_api phy_adin2111_api = { static struct phy_adin2111_data phy_adin2111_data_##n = { \ .sem = Z_SEM_INITIALIZER(phy_adin2111_data_##n.sem, 1, 1), \ }; \ - DEVICE_DT_INST_DEFINE(n, &phy_adin2111_init, NULL, \ - &phy_adin2111_data_##n, &phy_adin2111_config_##n, \ - POST_KERNEL, CONFIG_PHY_INIT_PRIORITY, \ - &phy_adin2111_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &phy_adin2111_init, NULL, \ + &phy_adin2111_data_##n, &phy_adin2111_config_##n, \ + POST_KERNEL, &phy_adin2111_api); DT_INST_FOREACH_STATUS_OKAY(ADIN2111_PHY_INITIALIZE) diff --git a/drivers/ethernet/phy/phy_microchip_ksz8081.c b/drivers/ethernet/phy/phy_microchip_ksz8081.c index 61a97ca03e7cd..03c5842a49d2c 100644 --- a/drivers/ethernet/phy/phy_microchip_ksz8081.c +++ b/drivers/ethernet/phy/phy_microchip_ksz8081.c @@ -538,9 +538,8 @@ static const struct ethphy_driver_api mc_ksz8081_phy_api = { \ static struct mc_ksz8081_data mc_ksz8081_##n##_data; \ \ - DEVICE_DT_INST_DEFINE(n, &phy_mc_ksz8081_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &phy_mc_ksz8081_init, NULL, \ &mc_ksz8081_##n##_data, &mc_ksz8081_##n##_config, \ - POST_KERNEL, CONFIG_PHY_INIT_PRIORITY, \ - &mc_ksz8081_phy_api); + POST_KERNEL, &mc_ksz8081_phy_api); DT_INST_FOREACH_STATUS_OKAY(MICROCHIP_KSZ8081_INIT) diff --git a/drivers/ethernet/phy/phy_mii.c b/drivers/ethernet/phy/phy_mii.c index f71e1d68c2ba8..de61c5dd47dc7 100644 --- a/drivers/ethernet/phy/phy_mii.c +++ b/drivers/ethernet/phy/phy_mii.c @@ -501,12 +501,11 @@ static const struct phy_mii_dev_config phy_mii_dev_config_##n = { \ #define PHY_MII_DEVICE(n) \ PHY_MII_CONFIG(n); \ static struct phy_mii_dev_data phy_mii_dev_data_##n; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &phy_mii_initialize, \ NULL, \ &phy_mii_dev_data_##n, \ &phy_mii_dev_config_##n, POST_KERNEL, \ - CONFIG_PHY_INIT_PRIORITY, \ &phy_mii_driver_api); DT_INST_FOREACH_STATUS_OKAY(PHY_MII_DEVICE) diff --git a/drivers/ethernet/phy/phy_qualcomm_ar8031.c b/drivers/ethernet/phy/phy_qualcomm_ar8031.c index a0376d789a37e..f943ae47b3b9a 100644 --- a/drivers/ethernet/phy/phy_qualcomm_ar8031.c +++ b/drivers/ethernet/phy/phy_qualcomm_ar8031.c @@ -503,8 +503,7 @@ static const struct ethphy_driver_api ar8031_driver_api = { #define AR8031_DEVICE(n) \ AR8031_CONFIG(n); \ static struct qc_ar8031_data qc_ar8031_data_##n; \ - DEVICE_DT_INST_DEFINE(n, &qc_ar8031_init, NULL, &qc_ar8031_data_##n, \ - &qc_ar8031_config_##n, POST_KERNEL, CONFIG_PHY_INIT_PRIORITY, \ - &ar8031_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &qc_ar8031_init, NULL, &qc_ar8031_data_##n, \ + &qc_ar8031_config_##n, POST_KERNEL, &ar8031_driver_api); DT_INST_FOREACH_STATUS_OKAY(AR8031_DEVICE) diff --git a/drivers/ethernet/phy/phy_realtek_rtl8211f.c b/drivers/ethernet/phy/phy_realtek_rtl8211f.c index d0f25750128a9..76b9dfbd4d62f 100644 --- a/drivers/ethernet/phy/phy_realtek_rtl8211f.c +++ b/drivers/ethernet/phy/phy_realtek_rtl8211f.c @@ -674,9 +674,8 @@ static const struct ethphy_driver_api rt_rtl8211f_phy_api = { \ static struct rt_rtl8211f_data rt_rtl8211f_##n##_data; \ \ - DEVICE_DT_INST_DEFINE(n, &phy_rt_rtl8211f_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &phy_rt_rtl8211f_init, NULL, \ &rt_rtl8211f_##n##_data, &rt_rtl8211f_##n##_config, \ - POST_KERNEL, CONFIG_PHY_INIT_PRIORITY, \ - &rt_rtl8211f_phy_api); + POST_KERNEL, &rt_rtl8211f_phy_api); DT_INST_FOREACH_STATUS_OKAY(REALTEK_RTL8211F_INIT) diff --git a/drivers/ethernet/phy/phy_ti_dp83825.c b/drivers/ethernet/phy/phy_ti_dp83825.c index 3f700ac4ec2f4..865f5e7e0674c 100644 --- a/drivers/ethernet/phy/phy_ti_dp83825.c +++ b/drivers/ethernet/phy/phy_ti_dp83825.c @@ -595,8 +595,7 @@ static const struct ethphy_driver_api ti_dp83825_phy_api = { \ static struct ti_dp83825_data ti_dp83825_##n##_data; \ \ - DEVICE_DT_INST_DEFINE(n, &phy_ti_dp83825_init, NULL, &ti_dp83825_##n##_data, \ - &ti_dp83825_##n##_config, POST_KERNEL, CONFIG_PHY_INIT_PRIORITY, \ - &ti_dp83825_phy_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &phy_ti_dp83825_init, NULL, &ti_dp83825_##n##_data, \ + &ti_dp83825_##n##_config, POST_KERNEL, &ti_dp83825_phy_api); DT_INST_FOREACH_STATUS_OKAY(TI_DP83825_INIT) diff --git a/drivers/ethernet/phy/phy_tja1103.c b/drivers/ethernet/phy/phy_tja1103.c index 659fdbf80aa7e..d22b77adcdd57 100644 --- a/drivers/ethernet/phy/phy_tja1103.c +++ b/drivers/ethernet/phy/phy_tja1103.c @@ -454,8 +454,7 @@ static const struct ethphy_driver_api phy_tja1103_api = { .sem = Z_SEM_INITIALIZER(phy_tja1103_data_##n.sem, 1, 1), \ .offload_sem = Z_SEM_INITIALIZER(phy_tja1103_data_##n.offload_sem, 0, 1), \ }; \ - DEVICE_DT_INST_DEFINE(n, &phy_tja1103_init, NULL, &phy_tja1103_data_##n, \ - &phy_tja1103_config_##n, POST_KERNEL, CONFIG_PHY_INIT_PRIORITY, \ - &phy_tja1103_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &phy_tja1103_init, NULL, &phy_tja1103_data_##n, \ + &phy_tja1103_config_##n, POST_KERNEL, &phy_tja1103_api); DT_INST_FOREACH_STATUS_OKAY(TJA1103_INITIALIZE) diff --git a/drivers/firmware/scmi/mailbox.c b/drivers/firmware/scmi/mailbox.c index 2f18ce89cdce7..1cd8b95030df9 100644 --- a/drivers/firmware/scmi/mailbox.c +++ b/drivers/firmware/scmi/mailbox.c @@ -111,6 +111,4 @@ static struct scmi_transport_api scmi_mbox_api = { .channel_is_free = scmi_mbox_channel_is_free, }; -DT_INST_SCMI_MAILBOX_DEFINE(0, PRE_KERNEL_1, - CONFIG_ARM_SCMI_TRANSPORT_INIT_PRIORITY, - &scmi_mbox_api); +SCMI_MAILBOX_INSTANCE_FROM_DT_INST(0, PRE_KERNEL_1, &scmi_mbox_api); diff --git a/drivers/firmware/scmi/mailbox.h b/drivers/firmware/scmi/mailbox.h index 4e758d8e298b9..7e89d950b0be7 100644 --- a/drivers/firmware/scmi/mailbox.h +++ b/drivers/firmware/scmi/mailbox.h @@ -98,12 +98,12 @@ * 2) Creates aforementioned structures for the base protocol * (identified by the `scmi` node) * - * 3) "registers" the driver via `DT_INST_SCMI_TRANSPORT_DEFINE()`. + * 3) "registers" the driver via `SCMI_TRANSPORT_INSTANCE_FROM_DT_INST()`. */ -#define DT_INST_SCMI_MAILBOX_DEFINE(inst, level, prio, api) \ +#define SCMI_MAILBOX_INSTANCE_FROM_DT_INST(inst, level, api) \ DT_INST_FOREACH_CHILD_STATUS_OKAY(inst, SCMI_MBOX_PROTO_CHAN_DEFINE) \ DT_INST_SCMI_MBOX_BASE_CHAN_DEFINE(inst) \ - DT_INST_SCMI_TRANSPORT_DEFINE(inst, NULL, NULL, NULL, level, prio, api) + SCMI_TRANSPORT_INSTANCE_FROM_DT_INST(inst, NULL, NULL, NULL, level, api) struct scmi_mbox_channel { /* SHMEM area bound to the channel */ diff --git a/drivers/firmware/scmi/shmem.c b/drivers/firmware/scmi/shmem.c index 6ec645cbc3096..e06fb6d977b18 100644 --- a/drivers/firmware/scmi/shmem.c +++ b/drivers/firmware/scmi/shmem.c @@ -192,10 +192,9 @@ static const struct scmi_shmem_config config_##inst = { \ \ static struct scmi_shmem_data data_##inst; \ \ -DEVICE_DT_INST_DEFINE(inst, &scmi_shmem_init, NULL, \ +DEVICE_INSTANCE_FROM_DT_INST(inst, &scmi_shmem_init, NULL, \ &data_##inst, &config_##inst, \ PRE_KERNEL_1, \ - CONFIG_ARM_SCMI_SHMEM_INIT_PRIORITY, \ NULL); DT_INST_FOREACH_STATUS_OKAY(SCMI_SHMEM_INIT); diff --git a/drivers/flash/flash_ambiq.c b/drivers/flash/flash_ambiq.c index b496790b95868..01572dec9ff3c 100644 --- a/drivers/flash/flash_ambiq.c +++ b/drivers/flash/flash_ambiq.c @@ -230,5 +230,5 @@ static int flash_ambiq_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, flash_ambiq_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_ambiq_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, flash_ambiq_init, NULL, NULL, NULL, POST_KERNEL, + &flash_ambiq_driver_api); diff --git a/drivers/flash/flash_andes_qspi.c b/drivers/flash/flash_andes_qspi.c index f8c7dfd96dd74..60ece208afd04 100644 --- a/drivers/flash/flash_andes_qspi.c +++ b/drivers/flash/flash_andes_qspi.c @@ -944,13 +944,12 @@ static const struct flash_driver_api flash_andes_qspi_api = { ANDES_QSPI_SFDP_DEVICETREE_PROP(n) \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &flash_andes_qspi_init, \ NULL, \ &flash_andes_qspi_data_##n, \ &flash_andes_qspi_config_##n, \ POST_KERNEL, \ - CONFIG_FLASH_ANDES_QSPI_INIT_PRIORITY, \ &flash_andes_qspi_api); \ \ static void flash_andes_qspi_configure_##n(void) \ diff --git a/drivers/flash/flash_cadence_nand.c b/drivers/flash/flash_cadence_nand.c index b527a5082cef8..e0e69ba77adb2 100644 --- a/drivers/flash/flash_cadence_nand.c +++ b/drivers/flash/flash_cadence_nand.c @@ -256,9 +256,9 @@ static int flash_cdns_nand_init(const struct device *nand_dev) IF_ENABLED(DT_INST_NODE_HAS_PROP(inst, resets), (CDNS_NAND_RESET_SPEC_INIT(inst))) \ IF_ENABLED(CONFIG_CDNS_NAND_INTERRUPT_SUPPORT, \ (.irq_config = cdns_nand_irq_config_##inst,))}; \ - DEVICE_DT_INST_DEFINE(inst, flash_cdns_nand_init, NULL, &flash_cadence_nand_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, flash_cdns_nand_init, NULL, &flash_cadence_nand_data_##inst,\ &flash_cadence_nand_config_##inst, POST_KERNEL, \ - CONFIG_FLASH_INIT_PRIORITY, &flash_cdns_nand_api); \ + &flash_cdns_nand_api); \ IF_ENABLED(CONFIG_CDNS_NAND_INTERRUPT_SUPPORT, \ (static void cdns_nand_irq_config_##inst(void) \ { \ diff --git a/drivers/flash/flash_cadence_qspi_nor.c b/drivers/flash/flash_cadence_qspi_nor.c index c35c50fe6dea2..39ba36bfb0d73 100644 --- a/drivers/flash/flash_cadence_qspi_nor.c +++ b/drivers/flash/flash_cadence_qspi_nor.c @@ -156,13 +156,12 @@ static int flash_cad_init(const struct device *dev) qspi_data, DT_DRV_INST(inst)), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ flash_cad_init, \ NULL, \ &flash_cad_priv_##inst, \ &flash_cad_config_##inst, \ POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &flash_cad_api); DT_INST_FOREACH_STATUS_OKAY(CREATE_FLASH_CADENCE_QSPI_DEVICE) diff --git a/drivers/flash/flash_esp32.c b/drivers/flash/flash_esp32.c index 86ed4a93ac115..18d3d38864627 100644 --- a/drivers/flash/flash_esp32.c +++ b/drivers/flash/flash_esp32.c @@ -177,8 +177,7 @@ static const struct flash_esp32_dev_config flash_esp32_config = { .controller = (spi_dev_t *) DT_INST_REG_ADDR(0), }; -DEVICE_DT_INST_DEFINE(0, flash_esp32_init, +DEVICE_INSTANCE_FROM_DT_INST(0, flash_esp32_init, NULL, &flash_esp32_data, &flash_esp32_config, - POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, - &flash_esp32_driver_api); + POST_KERNEL, &flash_esp32_driver_api); diff --git a/drivers/flash/flash_gd32.c b/drivers/flash/flash_gd32.c index 2bee7a990073e..558a02f680959 100644 --- a/drivers/flash/flash_gd32.c +++ b/drivers/flash/flash_gd32.c @@ -117,6 +117,6 @@ static int flash_gd32_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, flash_gd32_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, flash_gd32_init, NULL, &flash_data, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_gd32_driver_api); + &flash_gd32_driver_api); diff --git a/drivers/flash/flash_gecko.c b/drivers/flash/flash_gecko.c index 114637800862f..90c6663d063e9 100644 --- a/drivers/flash/flash_gecko.c +++ b/drivers/flash/flash_gecko.c @@ -229,6 +229,6 @@ static const struct flash_driver_api flash_gecko_driver_api = { static struct flash_gecko_data flash_gecko_0_data; -DEVICE_DT_INST_DEFINE(0, flash_gecko_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, flash_gecko_init, NULL, &flash_gecko_0_data, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_gecko_driver_api); + &flash_gecko_driver_api); diff --git a/drivers/flash/flash_hp_ra.c b/drivers/flash/flash_hp_ra.c index 2d832a65c930e..125b465c911e2 100644 --- a/drivers/flash/flash_hp_ra.c +++ b/drivers/flash/flash_hp_ra.c @@ -386,12 +386,11 @@ static struct flash_hp_ra_controller_config flash_hp_ra_controller_config = { .erase_value = 0xff, \ }}; \ \ - DEVICE_DT_DEFINE(index, flash_ra_init, NULL, &flash_hp_ra_data_##index, \ - &flash_hp_ra_config_##index, POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, \ - &flash_ra_api); + DEVICE_INSTANCE(index, flash_ra_init, NULL, &flash_hp_ra_data_##index, \ + &flash_hp_ra_config_##index, POST_KERNEL, &flash_ra_api); DT_FOREACH_CHILD_STATUS_OKAY(DT_DRV_INST(0), RA_FLASH_INIT); /* define the flash controller device just to run the init. */ -DEVICE_DT_DEFINE(DT_DRV_INST(0), flash_controller_ra_init, NULL, &flash_hp_ra_controller, - &flash_hp_ra_controller_config, PRE_KERNEL_1, CONFIG_FLASH_INIT_PRIORITY, NULL); +DEVICE_INSTANCE(DT_DRV_INST(0), flash_controller_ra_init, NULL, &flash_hp_ra_controller, + &flash_hp_ra_controller_config, PRE_KERNEL_1, NULL); diff --git a/drivers/flash/flash_ifx_cat1.c b/drivers/flash/flash_ifx_cat1.c index 148c1d337914e..47f5d27c6d8cb 100644 --- a/drivers/flash/flash_ifx_cat1.c +++ b/drivers/flash/flash_ifx_cat1.c @@ -200,5 +200,5 @@ static const struct ifx_cat1_flash_config ifx_cat1_flash_config = { .base_addr = DT_REG_ADDR(SOC_NV_FLASH_NODE), .max_addr = DT_REG_ADDR(SOC_NV_FLASH_NODE) + DT_REG_SIZE(SOC_NV_FLASH_NODE)}; -DEVICE_DT_INST_DEFINE(0, ifx_cat1_flash_init, NULL, &flash_data, &ifx_cat1_flash_config, - POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, &ifx_cat1_flash_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, ifx_cat1_flash_init, NULL, &flash_data, &ifx_cat1_flash_config, + POST_KERNEL, &ifx_cat1_flash_driver_api); diff --git a/drivers/flash/flash_ifx_cat1_qspi.c b/drivers/flash/flash_ifx_cat1_qspi.c index 44e8686a74211..480a97c48b88a 100644 --- a/drivers/flash/flash_ifx_cat1_qspi.c +++ b/drivers/flash/flash_ifx_cat1_qspi.c @@ -342,5 +342,5 @@ static const struct ifx_cat1_flash_config flash_config = { .base_addr = DT_REG_ADDR(SOC_NV_FLASH_NODE), .max_addr = DT_REG_ADDR(SOC_NV_FLASH_NODE) + DT_REG_SIZE(SOC_NV_FLASH_NODE)}; -DEVICE_DT_INST_DEFINE(0, ifx_cat1_flash_init, NULL, &flash_data, &flash_config, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &ifx_cat1_flash_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, ifx_cat1_flash_init, NULL, &flash_data, &flash_config, POST_KERNEL, + &ifx_cat1_flash_driver_api); diff --git a/drivers/flash/flash_ite_it8xxx2.c b/drivers/flash/flash_ite_it8xxx2.c index f54289b864634..2af13c7e204d3 100644 --- a/drivers/flash/flash_ite_it8xxx2.c +++ b/drivers/flash/flash_ite_it8xxx2.c @@ -511,8 +511,7 @@ static const struct flash_driver_api flash_it8xxx2_api = { static struct flash_it8xxx2_dev_data flash_it8xxx2_data; -DEVICE_DT_INST_DEFINE(0, flash_it8xxx2_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, flash_it8xxx2_init, NULL, &flash_it8xxx2_data, NULL, PRE_KERNEL_1, - CONFIG_FLASH_INIT_PRIORITY, &flash_it8xxx2_api); diff --git a/drivers/flash/flash_max32.c b/drivers/flash/flash_max32.c index 9e75f0557a22e..08522335b04b4 100644 --- a/drivers/flash/flash_max32.c +++ b/drivers/flash/flash_max32.c @@ -170,8 +170,8 @@ static const struct flash_driver_api flash_max32_driver_api = { }, \ FLASH_MAX32_CONFIG_PAGE_LAYOUT(_num)}; \ static struct max32_flash_dev_data max32_flash_dev_data_##_num; \ - DEVICE_DT_INST_DEFINE(_num, flash_max32_init, NULL, &max32_flash_dev_data_##_num, \ + DEVICE_INSTANCE_FROM_DT_INST(_num, flash_max32_init, NULL, &max32_flash_dev_data_##_num, \ &max32_flash_dev_cfg_##_num, POST_KERNEL, \ - CONFIG_FLASH_INIT_PRIORITY, &flash_max32_driver_api); + &flash_max32_driver_api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_FLASH_MAX32) diff --git a/drivers/flash/flash_mcux_flexspi_hyperflash.c b/drivers/flash/flash_mcux_flexspi_hyperflash.c index 5c03febc29a7f..d7454d3589029 100644 --- a/drivers/flash/flash_mcux_flexspi_hyperflash.c +++ b/drivers/flash/flash_mcux_flexspi_hyperflash.c @@ -695,13 +695,12 @@ static const struct flash_driver_api flash_flexspi_hyperflash_api = { }, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ flash_flexspi_hyperflash_init, \ NULL, \ &flash_flexspi_hyperflash_data_##n, \ &flash_flexspi_hyperflash_config_##n, \ POST_KERNEL, \ - CONFIG_FLASH_INIT_PRIORITY, \ &flash_flexspi_hyperflash_api); DT_INST_FOREACH_STATUS_OKAY(FLASH_FLEXSPI_HYPERFLASH) diff --git a/drivers/flash/flash_mcux_flexspi_mx25um51345g.c b/drivers/flash/flash_mcux_flexspi_mx25um51345g.c index 9ec05ba2f003f..56dac15de4423 100644 --- a/drivers/flash/flash_mcux_flexspi_mx25um51345g.c +++ b/drivers/flash/flash_mcux_flexspi_mx25um51345g.c @@ -618,13 +618,12 @@ static const struct flash_driver_api flash_flexspi_nor_api = { }, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ flash_flexspi_nor_init, \ NULL, \ &flash_flexspi_nor_data_##n, \ NULL, \ POST_KERNEL, \ - CONFIG_FLASH_INIT_PRIORITY, \ &flash_flexspi_nor_api); DT_INST_FOREACH_STATUS_OKAY(FLASH_FLEXSPI_NOR) diff --git a/drivers/flash/flash_mcux_flexspi_nor.c b/drivers/flash/flash_mcux_flexspi_nor.c index 6231a240023e6..6cc80e5737ec7 100644 --- a/drivers/flash/flash_mcux_flexspi_nor.c +++ b/drivers/flash/flash_mcux_flexspi_nor.c @@ -1332,13 +1332,12 @@ static const struct flash_driver_api flash_flexspi_nor_api = { }, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ flash_flexspi_nor_init, \ NULL, \ &flash_flexspi_nor_data_##n, \ &flash_flexspi_nor_config_##n, \ POST_KERNEL, \ - CONFIG_FLASH_INIT_PRIORITY, \ &flash_flexspi_nor_api); DT_INST_FOREACH_STATUS_OKAY(FLASH_FLEXSPI_NOR) diff --git a/drivers/flash/flash_mspi_atxp032.c b/drivers/flash/flash_mspi_atxp032.c index b69c796e7ab84..ddf75b35b9953 100644 --- a/drivers/flash/flash_mspi_atxp032.c +++ b/drivers/flash/flash_mspi_atxp032.c @@ -854,13 +854,12 @@ static const struct flash_driver_api flash_mspi_atxp032_api = { .lock = Z_SEM_INITIALIZER(flash_mspi_atxp032_data_##n.lock, 0, 1), \ }; \ PM_DEVICE_DT_INST_DEFINE(n, flash_mspi_atxp032_pm_action); \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ flash_mspi_atxp032_init, \ PM_DEVICE_DT_INST_GET(n), \ &flash_mspi_atxp032_data_##n, \ &flash_mspi_atxp032_config_##n, \ POST_KERNEL, \ - CONFIG_FLASH_INIT_PRIORITY, \ &flash_mspi_atxp032_api); DT_INST_FOREACH_STATUS_OKAY(FLASH_MSPI_ATXP032) diff --git a/drivers/flash/flash_mspi_emul_device.c b/drivers/flash/flash_mspi_emul_device.c index 1bfefd33dd2a1..2e077860d1c19 100644 --- a/drivers/flash/flash_mspi_emul_device.c +++ b/drivers/flash/flash_mspi_emul_device.c @@ -437,13 +437,12 @@ static int flash_mspi_emul_device_init_stub(const struct device *dev) .lock = Z_SEM_INITIALIZER(flash_mspi_emul_device_data_##n.lock, 0, 1), \ .mem = (uint8_t *)flash_mspi_emul_device_mem##n, \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ flash_mspi_emul_device_init_stub, \ NULL, \ &flash_mspi_emul_device_data_##n, \ &flash_mspi_emul_device_config_##n, \ POST_KERNEL, \ - CONFIG_FLASH_INIT_PRIORITY, \ &flash_mspi_emul_device_api); #define EMUL_TEST(n) \ diff --git a/drivers/flash/flash_npcx_fiu_nor.c b/drivers/flash/flash_npcx_fiu_nor.c index e42aa82f8966f..da5e58057827a 100644 --- a/drivers/flash/flash_npcx_fiu_nor.c +++ b/drivers/flash/flash_npcx_fiu_nor.c @@ -615,9 +615,8 @@ static const struct flash_npcx_nor_config flash_npcx_nor_config_##n = { \ },)) \ }; \ static struct flash_npcx_nor_data flash_npcx_nor_data_##n; \ -DEVICE_DT_INST_DEFINE(n, flash_npcx_nor_init, NULL, \ +DEVICE_INSTANCE_FROM_DT_INST(n, flash_npcx_nor_init, NULL, \ &flash_npcx_nor_data_##n, &flash_npcx_nor_config_##n, \ - POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, \ - &flash_npcx_nor_driver_api); + POST_KERNEL, &flash_npcx_nor_driver_api); DT_INST_FOREACH_STATUS_OKAY(NPCX_FLASH_NOR_INIT) diff --git a/drivers/flash/flash_npcx_fiu_qspi.c b/drivers/flash/flash_npcx_fiu_qspi.c index 39e699bbef9d3..4373d9cc4ed47 100644 --- a/drivers/flash/flash_npcx_fiu_qspi.c +++ b/drivers/flash/flash_npcx_fiu_qspi.c @@ -286,8 +286,8 @@ static const struct npcx_qspi_fiu_config npcx_qspi_fiu_config_##n = { \ .en_direct_access_2dev = DT_INST_PROP(n, en_direct_access_2dev), \ }; \ static struct npcx_qspi_fiu_data npcx_qspi_fiu_data_##n; \ -DEVICE_DT_INST_DEFINE(n, qspi_npcx_fiu_init, NULL, \ +DEVICE_INSTANCE_FROM_DT_INST(n, qspi_npcx_fiu_init, NULL, \ &npcx_qspi_fiu_data_##n, &npcx_qspi_fiu_config_##n, \ - PRE_KERNEL_1, CONFIG_FLASH_INIT_PRIORITY, NULL); + PRE_KERNEL_1, NULL); DT_INST_FOREACH_STATUS_OKAY(NPCX_SPI_FIU_INIT) diff --git a/drivers/flash/flash_nxp_s32_qspi_nor.c b/drivers/flash/flash_nxp_s32_qspi_nor.c index defd1e110bf64..5f1d3a237baca 100644 --- a/drivers/flash/flash_nxp_s32_qspi_nor.c +++ b/drivers/flash/flash_nxp_s32_qspi_nor.c @@ -1094,13 +1094,12 @@ static const struct flash_driver_api nxp_s32_qspi_api = { )) \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ nxp_s32_qspi_init, \ NULL, \ &nxp_s32_qspi_data_##n, \ &nxp_s32_qspi_config_##n, \ POST_KERNEL, \ - CONFIG_FLASH_INIT_PRIORITY, \ &nxp_s32_qspi_api); DT_INST_FOREACH_STATUS_OKAY(FLASH_NXP_S32_QSPI_INIT_DEVICE) diff --git a/drivers/flash/flash_rpi_pico.c b/drivers/flash/flash_rpi_pico.c index 0940e94327c8f..0dc2ca6731675 100644 --- a/drivers/flash/flash_rpi_pico.c +++ b/drivers/flash/flash_rpi_pico.c @@ -316,5 +316,5 @@ static const struct flash_driver_api flash_rpi_driver_api = { #endif /* CONFIG_FLASH_PAGE_LAYOUT */ }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_rpi_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, NULL, POST_KERNEL, + &flash_rpi_driver_api); diff --git a/drivers/flash/flash_sam.c b/drivers/flash/flash_sam.c index e4a807552fcdc..e7d6552339d69 100644 --- a/drivers/flash/flash_sam.c +++ b/drivers/flash/flash_sam.c @@ -523,8 +523,7 @@ static int sam_flash_init(const struct device *dev) \ static struct sam_flash_data sam_flash_data##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, sam_flash_init, NULL, &sam_flash_data##inst, \ - &sam_flash_config##inst, POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, \ - &sam_flash_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, sam_flash_init, NULL, &sam_flash_data##inst, \ + &sam_flash_config##inst, POST_KERNEL, &sam_flash_api); SAM_FLASH_CONTROLLER(0) diff --git a/drivers/flash/flash_sam0.c b/drivers/flash/flash_sam0.c index 883eeaf170885..08a207079742d 100644 --- a/drivers/flash/flash_sam0.c +++ b/drivers/flash/flash_sam0.c @@ -500,6 +500,6 @@ static const struct flash_driver_api flash_sam0_api = { static struct flash_sam0_data flash_sam0_data_0; -DEVICE_DT_INST_DEFINE(0, flash_sam0_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, flash_sam0_init, NULL, &flash_sam0_data_0, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_sam0_api); + &flash_sam0_api); diff --git a/drivers/flash/flash_si32.c b/drivers/flash/flash_si32.c index 5fccdd06ca950..51c65cc82c227 100644 --- a/drivers/flash/flash_si32.c +++ b/drivers/flash/flash_si32.c @@ -213,5 +213,5 @@ static const struct flash_si32_config flash_si32_config = { .controller = (SI32_FLASHCTRL_A_Type *)DT_INST_REG_ADDR(0), }; -DEVICE_DT_INST_DEFINE(0, flash_si32_init, NULL, &flash_si32_0_data, &flash_si32_config, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_si32_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, flash_si32_init, NULL, &flash_si32_0_data, &flash_si32_config, POST_KERNEL, + &flash_si32_driver_api); diff --git a/drivers/flash/flash_simulator.c b/drivers/flash/flash_simulator.c index d405de0be1997..9a470a8bba9f2 100644 --- a/drivers/flash/flash_simulator.c +++ b/drivers/flash/flash_simulator.c @@ -438,9 +438,8 @@ static int flash_init(const struct device *dev) return flash_mock_init(dev); } -DEVICE_DT_INST_DEFINE(0, flash_init, NULL, - NULL, NULL, POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, - &flash_sim_api); +DEVICE_INSTANCE_FROM_DT_INST(0, flash_init, NULL, + NULL, NULL, POST_KERNEL, &flash_sim_api); #ifdef CONFIG_ARCH_POSIX diff --git a/drivers/flash/flash_smartbond.c b/drivers/flash/flash_smartbond.c index 1283bdd622089..a8ddbbd6237d5 100644 --- a/drivers/flash/flash_smartbond.c +++ b/drivers/flash/flash_smartbond.c @@ -284,5 +284,5 @@ static const struct flash_smartbond_config flash_smartbond_0_config = { .qspif_base_address = DT_REG_ADDR(QSPIF_NODE), }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, &flash_smartbond_0_config, - POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, &flash_smartbond_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, &flash_smartbond_0_config, + POST_KERNEL, &flash_smartbond_driver_api); diff --git a/drivers/flash/flash_stm32.c b/drivers/flash/flash_stm32.c index 15ced27e49565..e9bdeeb1eb030 100644 --- a/drivers/flash/flash_stm32.c +++ b/drivers/flash/flash_stm32.c @@ -586,6 +586,6 @@ static int stm32_flash_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, stm32_flash_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, stm32_flash_init, NULL, &flash_data, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_stm32_api); + &flash_stm32_api); diff --git a/drivers/flash/flash_stm32_ospi.c b/drivers/flash/flash_stm32_ospi.c index 93c31c84d2ee6..f4f4089dcef9d 100644 --- a/drivers/flash/flash_stm32_ospi.c +++ b/drivers/flash/flash_stm32_ospi.c @@ -2627,10 +2627,9 @@ static struct flash_stm32_ospi_data flash_stm32_ospi_dev_data = { OSPI_DMA_CHANNEL(STM32_OSPI_NODE, tx_rx) }; -DEVICE_DT_INST_DEFINE(0, &flash_stm32_ospi_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &flash_stm32_ospi_init, NULL, &flash_stm32_ospi_dev_data, &flash_stm32_ospi_cfg, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &flash_stm32_ospi_driver_api); + POST_KERNEL, &flash_stm32_ospi_driver_api); static void flash_stm32_ospi_irq_config_func(const struct device *dev) { diff --git a/drivers/flash/flash_stm32_qspi.c b/drivers/flash/flash_stm32_qspi.c index 64d53d051f523..c8035a523b6be 100644 --- a/drivers/flash/flash_stm32_qspi.c +++ b/drivers/flash/flash_stm32_qspi.c @@ -1643,10 +1643,9 @@ static struct flash_stm32_qspi_data flash_stm32_qspi_dev_data = { QSPI_DMA_CHANNEL(STM32_QSPI_NODE, tx_rx) }; -DEVICE_DT_INST_DEFINE(0, &flash_stm32_qspi_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &flash_stm32_qspi_init, NULL, &flash_stm32_qspi_dev_data, &flash_stm32_qspi_cfg, - POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, - &flash_stm32_qspi_driver_api); + POST_KERNEL, &flash_stm32_qspi_driver_api); static void flash_stm32_qspi_irq_config_func(const struct device *dev) { diff --git a/drivers/flash/flash_stm32_xspi.c b/drivers/flash/flash_stm32_xspi.c index 79207aacceed1..169ba9b28bbe6 100644 --- a/drivers/flash/flash_stm32_xspi.c +++ b/drivers/flash/flash_stm32_xspi.c @@ -2458,7 +2458,6 @@ static void flash_stm32_xspi_irq_config_func(const struct device *dev) irq_enable(DT_IRQN(STM32_XSPI_NODE)); } -DEVICE_DT_INST_DEFINE(0, &flash_stm32_xspi_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &flash_stm32_xspi_init, NULL, &flash_stm32_xspi_dev_data, &flash_stm32_xspi_cfg, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &flash_stm32_xspi_driver_api); + POST_KERNEL, &flash_stm32_xspi_driver_api); diff --git a/drivers/flash/flash_stm32h7x.c b/drivers/flash/flash_stm32h7x.c index 76970d3b50b5a..62ca613ee2f01 100644 --- a/drivers/flash/flash_stm32h7x.c +++ b/drivers/flash/flash_stm32h7x.c @@ -714,5 +714,5 @@ static int stm32h7_flash_init(const struct device *dev) return flash_stm32h7_write_protection(dev, false); } -DEVICE_DT_INST_DEFINE(0, stm32h7_flash_init, NULL, &flash_data, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_stm32h7_api); +DEVICE_INSTANCE_FROM_DT_INST(0, stm32h7_flash_init, NULL, &flash_data, NULL, POST_KERNEL, + &flash_stm32h7_api); diff --git a/drivers/flash/flash_stm32wb0x.c b/drivers/flash/flash_stm32wb0x.c index 3de8136aa0d81..0b04c293937a5 100644 --- a/drivers/flash/flash_stm32wb0x.c +++ b/drivers/flash/flash_stm32wb0x.c @@ -454,6 +454,6 @@ int stm32wb0x_flash_init(const struct device *dev) */ static struct flash_wb0x_data wb0x_flash_drv_data; -DEVICE_DT_INST_DEFINE(0, stm32wb0x_flash_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, stm32wb0x_flash_init, NULL, &wb0x_flash_drv_data, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_wb0x_api); + &flash_wb0x_api); diff --git a/drivers/flash/flash_stm32wba_fm.c b/drivers/flash/flash_stm32wba_fm.c index ff42c2643c533..4be19c0e32398 100644 --- a/drivers/flash/flash_stm32wba_fm.c +++ b/drivers/flash/flash_stm32wba_fm.c @@ -236,6 +236,6 @@ static int stm32_flash_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, stm32_flash_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, stm32_flash_init, NULL, &flash_data, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_stm32_api); + &flash_stm32_api); diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index d56eff76ea686..6ebca1a7fe205 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -1422,7 +1422,6 @@ static const struct qspi_nor_config qspi_nor_dev_config = { PM_DEVICE_DT_INST_DEFINE(0, qspi_nor_pm_action); -DEVICE_DT_INST_DEFINE(0, qspi_nor_init, PM_DEVICE_DT_INST_GET(0), +DEVICE_INSTANCE_FROM_DT_INST(0, qspi_nor_init, PM_DEVICE_DT_INST_GET(0), &qspi_nor_dev_data, &qspi_nor_dev_config, - POST_KERNEL, CONFIG_NORDIC_QSPI_NOR_INIT_PRIORITY, - &qspi_nor_api); + POST_KERNEL, &qspi_nor_api); diff --git a/drivers/flash/soc_flash_b91.c b/drivers/flash/soc_flash_b91.c index a7ce405748290..8e78d949ae289 100644 --- a/drivers/flash/soc_flash_b91.c +++ b/drivers/flash/soc_flash_b91.c @@ -231,6 +231,6 @@ static const struct flash_driver_api flash_b91_api = { }; /* Driver registration */ -DEVICE_DT_INST_DEFINE(0, flash_b91_init, +DEVICE_INSTANCE_FROM_DT_INST(0, flash_b91_init, NULL, &flash_data, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_b91_api); + &flash_b91_api); diff --git a/drivers/flash/soc_flash_cc13xx_cc26xx.c b/drivers/flash/soc_flash_cc13xx_cc26xx.c index f1cb7c464119f..4c0a9c96f36c4 100644 --- a/drivers/flash/soc_flash_cc13xx_cc26xx.c +++ b/drivers/flash/soc_flash_cc13xx_cc26xx.c @@ -300,6 +300,5 @@ static const struct flash_driver_api flash_cc13xx_cc26xx_api = { static struct flash_priv flash_data; -DEVICE_DT_INST_DEFINE(0, flash_cc13xx_cc26xx_init, NULL, &flash_data, NULL, - POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, - &flash_cc13xx_cc26xx_api); +DEVICE_INSTANCE_FROM_DT_INST(0, flash_cc13xx_cc26xx_init, NULL, &flash_data, NULL, + POST_KERNEL, &flash_cc13xx_cc26xx_api); diff --git a/drivers/flash/soc_flash_lpc.c b/drivers/flash/soc_flash_lpc.c index 5f931a1bf7348..670ac286bd7fd 100644 --- a/drivers/flash/soc_flash_lpc.c +++ b/drivers/flash/soc_flash_lpc.c @@ -172,6 +172,6 @@ static int flash_lpc_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, flash_lpc_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, flash_lpc_init, NULL, &flash_data, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_lpc_api); + &flash_lpc_api); diff --git a/drivers/flash/soc_flash_mcux.c b/drivers/flash/soc_flash_mcux.c index 8351c12162d3a..983292575a74b 100644 --- a/drivers/flash/soc_flash_mcux.c +++ b/drivers/flash/soc_flash_mcux.c @@ -379,6 +379,6 @@ static int flash_mcux_init(const struct device *dev) return (rc == kStatus_Success) ? 0 : -EIO; } -DEVICE_DT_INST_DEFINE(0, flash_mcux_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, flash_mcux_init, NULL, &flash_data, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_mcux_api); + &flash_mcux_api); diff --git a/drivers/flash/soc_flash_nios2_qspi.c b/drivers/flash/soc_flash_nios2_qspi.c index 9b70e285ec3e8..10d6f7e4b39ef 100644 --- a/drivers/flash/soc_flash_nios2_qspi.c +++ b/drivers/flash/soc_flash_nios2_qspi.c @@ -525,7 +525,6 @@ struct flash_nios2_qspi_config flash_cfg = { BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, "only one 'altr,nios2-qspi-nor' compatible node may be present"); -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, flash_nios2_qspi_init, NULL, &flash_cfg, NULL, - POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, - &flash_nios2_qspi_api); + POST_KERNEL, &flash_nios2_qspi_api); diff --git a/drivers/flash/soc_flash_nrf.c b/drivers/flash/soc_flash_nrf.c index e5e8a55ed3747..3291c19c9798a 100644 --- a/drivers/flash/soc_flash_nrf.c +++ b/drivers/flash/soc_flash_nrf.c @@ -317,10 +317,9 @@ static int nrf_flash_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, nrf_flash_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, nrf_flash_init, NULL, NULL, NULL, - POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, - &flash_nrf_api); + POST_KERNEL, &flash_nrf_api); #ifndef CONFIG_SOC_FLASH_NRF_RADIO_SYNC_NONE diff --git a/drivers/flash/soc_flash_nrf_mram.c b/drivers/flash/soc_flash_nrf_mram.c index a57b9c582129d..89075622dc412 100644 --- a/drivers/flash/soc_flash_nrf_mram.c +++ b/drivers/flash/soc_flash_nrf_mram.c @@ -186,5 +186,4 @@ static const struct flash_driver_api nrf_mram_api = { #endif }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, - &nrf_mram_api); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, NULL, POST_KERNEL, &nrf_mram_api); diff --git a/drivers/flash/soc_flash_nrf_rram.c b/drivers/flash/soc_flash_nrf_rram.c index 9bc32255a481d..cd866ca9e30bc 100644 --- a/drivers/flash/soc_flash_nrf_rram.c +++ b/drivers/flash/soc_flash_nrf_rram.c @@ -375,5 +375,4 @@ static int nrf_rram_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, nrf_rram_init, NULL, NULL, NULL, POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, - &nrf_rram_api); +DEVICE_INSTANCE_FROM_DT_INST(0, nrf_rram_init, NULL, NULL, NULL, POST_KERNEL, &nrf_rram_api); diff --git a/drivers/flash/soc_flash_numaker.c b/drivers/flash/soc_flash_numaker.c index 81daec426c831..a85c75759c82e 100644 --- a/drivers/flash/soc_flash_numaker.c +++ b/drivers/flash/soc_flash_numaker.c @@ -280,5 +280,5 @@ static int flash_numaker_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, flash_numaker_init, NULL, &flash_data, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_numaker_api); +DEVICE_INSTANCE_FROM_DT_INST(0, flash_numaker_init, NULL, &flash_data, NULL, POST_KERNEL, + &flash_numaker_api); diff --git a/drivers/flash/soc_flash_numaker_rmc.c b/drivers/flash/soc_flash_numaker_rmc.c index 4a6b4ff6b5f53..a965523898245 100644 --- a/drivers/flash/soc_flash_numaker_rmc.c +++ b/drivers/flash/soc_flash_numaker_rmc.c @@ -274,5 +274,5 @@ static int flash_numaker_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, flash_numaker_init, NULL, &flash_data, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_numaker_api); +DEVICE_INSTANCE_FROM_DT_INST(0, flash_numaker_init, NULL, &flash_data, NULL, POST_KERNEL, + &flash_numaker_api); diff --git a/drivers/flash/soc_flash_rv32m1.c b/drivers/flash/soc_flash_rv32m1.c index 7971bf1503962..3d8b923b50cde 100644 --- a/drivers/flash/soc_flash_rv32m1.c +++ b/drivers/flash/soc_flash_rv32m1.c @@ -161,6 +161,6 @@ static int flash_mcux_init(const struct device *dev) return (rc == kStatus_Success) ? 0 : -EIO; } -DEVICE_DT_INST_DEFINE(0, flash_mcux_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, flash_mcux_init, NULL, &flash_data, NULL, POST_KERNEL, - CONFIG_FLASH_INIT_PRIORITY, &flash_mcux_api); + &flash_mcux_api); diff --git a/drivers/flash/soc_flash_xmc4xxx.c b/drivers/flash/soc_flash_xmc4xxx.c index 9d88886397839..9c0229a58ed4c 100644 --- a/drivers/flash/soc_flash_xmc4xxx.c +++ b/drivers/flash/soc_flash_xmc4xxx.c @@ -195,5 +195,5 @@ static struct flash_xmc4xxx_config flash_xmc4xxx_cfg_0 = { .size = DT_REG_SIZE(DT_INST(0, infineon_xmc4xxx_nv_flash)), .parameters = {.write_block_size = FLASH_WRITE_BLK_SZ, .erase_value = 0}}; -DEVICE_DT_INST_DEFINE(0, flash_xmc4xxx_init, NULL, &flash_xmc4xxx_data_0, &flash_xmc4xxx_cfg_0, - POST_KERNEL, CONFIG_FLASH_INIT_PRIORITY, &flash_xmc4xxx_api); +DEVICE_INSTANCE_FROM_DT_INST(0, flash_xmc4xxx_init, NULL, &flash_xmc4xxx_data_0, &flash_xmc4xxx_cfg_0, + POST_KERNEL, &flash_xmc4xxx_api); diff --git a/drivers/flash/spi_flash_at45.c b/drivers/flash/spi_flash_at45.c index 3e8006a98055a..de386a7de83af 100644 --- a/drivers/flash/spi_flash_at45.c +++ b/drivers/flash/spi_flash_at45.c @@ -733,10 +733,9 @@ static const struct flash_driver_api spi_flash_at45_api = { \ PM_DEVICE_DT_INST_DEFINE(idx, spi_flash_at45_pm_action); \ \ - DEVICE_DT_INST_DEFINE(idx, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, \ spi_flash_at45_init, PM_DEVICE_DT_INST_GET(idx), \ &inst_##idx##_data, &inst_##idx##_config, \ - POST_KERNEL, CONFIG_SPI_FLASH_AT45_INIT_PRIORITY, \ - &spi_flash_at45_api); + POST_KERNEL, &spi_flash_at45_api); DT_INST_FOREACH_STATUS_OKAY(SPI_FLASH_AT45_INST) diff --git a/drivers/flash/spi_nor.c b/drivers/flash/spi_nor.c index 3e1b0c169b19b..1fe68dc3b8a41 100644 --- a/drivers/flash/spi_nor.c +++ b/drivers/flash/spi_nor.c @@ -1822,8 +1822,8 @@ static const struct flash_driver_api spi_nor_api = { LOCK_DEFINE(idx) \ GENERATE_CONFIG_STRUCT(idx) \ static struct spi_nor_data spi_nor_##idx##_data; \ - DEVICE_DT_INST_DEFINE(idx, &spi_nor_init, PM_DEVICE_DT_INST_GET(idx), \ + DEVICE_INSTANCE_FROM_DT_INST(idx, &spi_nor_init, PM_DEVICE_DT_INST_GET(idx),\ &spi_nor_##idx##_data, &spi_nor_##idx##_config, \ - POST_KERNEL, CONFIG_SPI_NOR_INIT_PRIORITY, &spi_nor_api); + POST_KERNEL, &spi_nor_api); DT_INST_FOREACH_STATUS_OKAY(SPI_NOR_INST) diff --git a/drivers/fpga/fpga_altera_agilex_bridge.c b/drivers/fpga/fpga_altera_agilex_bridge.c index 2a1f7d5a3894f..dde9e092e04b9 100644 --- a/drivers/fpga/fpga_altera_agilex_bridge.c +++ b/drivers/fpga/fpga_altera_agilex_bridge.c @@ -472,11 +472,10 @@ static const struct fpga_driver_api altera_fpga_api = { #define CREATE_ALTERA_FPGA_BRIDGE_DEV(inst) \ static struct fpga_bridge_dev_data fpga_bridge_data_##inst; \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ altera_fpga_init, \ NULL, &fpga_bridge_data_##inst, \ - NULL, POST_KERNEL, \ - CONFIG_FPGA_INIT_PRIORITY, \ + NULL, POST_KERNEL, \ &altera_fpga_api); \ DT_INST_FOREACH_STATUS_OKAY(CREATE_ALTERA_FPGA_BRIDGE_DEV); diff --git a/drivers/fpga/fpga_eos_s3.c b/drivers/fpga/fpga_eos_s3.c index 452735a4309ca..b2529a8b1a678 100644 --- a/drivers/fpga/fpga_eos_s3.c +++ b/drivers/fpga/fpga_eos_s3.c @@ -149,5 +149,5 @@ static const struct fpga_driver_api eos_s3_api = { .get_info = eos_s3_fpga_get_info }; -DEVICE_DT_DEFINE(DT_NODELABEL(fpga0), &eos_s3_fpga_init, NULL, &fpga_data, NULL, POST_KERNEL, - CONFIG_FPGA_INIT_PRIORITY, &eos_s3_api); +DEVICE_INSTANCE(DT_NODELABEL(fpga0), &eos_s3_fpga_init, NULL, &fpga_data, NULL, POST_KERNEL, + &eos_s3_api); diff --git a/drivers/fpga/fpga_ice40.c b/drivers/fpga/fpga_ice40.c index bc251e5c3b1df..7684e83bf54e2 100644 --- a/drivers/fpga/fpga_ice40.c +++ b/drivers/fpga/fpga_ice40.c @@ -619,8 +619,7 @@ static int fpga_ice40_init(const struct device *dev) .load = FPGA_ICE40_LOAD_FUNC(inst), \ FPGA_ICE40_PINCTRL_CONFIG(inst)}; \ \ - DEVICE_DT_INST_DEFINE(inst, fpga_ice40_init, NULL, &fpga_ice40_data_##inst, \ - &fpga_ice40_config_##inst, POST_KERNEL, CONFIG_FPGA_INIT_PRIORITY, \ - &fpga_ice40_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, fpga_ice40_init, NULL, &fpga_ice40_data_##inst, \ + &fpga_ice40_config_##inst, POST_KERNEL, &fpga_ice40_api); DT_INST_FOREACH_STATUS_OKAY(FPGA_ICE40_DEFINE) diff --git a/drivers/fpga/fpga_mpfs.c b/drivers/fpga/fpga_mpfs.c index 6be8476a5fb04..11022de5d2ce8 100644 --- a/drivers/fpga/fpga_mpfs.c +++ b/drivers/fpga/fpga_mpfs.c @@ -409,5 +409,5 @@ static const struct fpga_driver_api mpfs_fpga_api = { .get_status = mpfs_fpga_get_status, }; -DEVICE_DT_INST_DEFINE(0, &mpfs_fpga_init, NULL, &fpga_data, &fpga_config, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &mpfs_fpga_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &mpfs_fpga_init, NULL, &fpga_data, &fpga_config, POST_KERNEL, + &mpfs_fpga_api); diff --git a/drivers/fpga/fpga_slg471x5.c b/drivers/fpga/fpga_slg471x5.c index e5c5849cd7783..42f7d1cf82426 100644 --- a/drivers/fpga/fpga_slg471x5.c +++ b/drivers/fpga/fpga_slg471x5.c @@ -175,9 +175,9 @@ static int fpga_slg471x5_init(const struct device *dev) .try_unconfigured = DT_INST_NODE_HAS_PROP(inst, try_unconfigured), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, fpga_slg471x5_init, NULL, &fpga_slg##type##_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, fpga_slg471x5_init, NULL, &fpga_slg##type##_data_##inst,\ &fpga_slg##type##_config_##inst, POST_KERNEL, \ - CONFIG_FPGA_INIT_PRIORITY, &fpga_slg471x5_api) + &fpga_slg471x5_api) #define FPGA_SLG47105_VERIFY_LIST \ { \ diff --git a/drivers/fpga/fpga_zynqmp.c b/drivers/fpga/fpga_zynqmp.c index 7cedba97babf0..7a0a8e1826d05 100644 --- a/drivers/fpga/fpga_zynqmp.c +++ b/drivers/fpga/fpga_zynqmp.c @@ -322,5 +322,5 @@ static const struct fpga_driver_api zynqmp_api = { .get_info = zynqmp_fpga_get_info }; -DEVICE_DT_INST_DEFINE(0, &zynqmp_fpga_init, NULL, &fpga_data, NULL, - POST_KERNEL, CONFIG_FPGA_INIT_PRIORITY, &zynqmp_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &zynqmp_fpga_init, NULL, &fpga_data, NULL, + POST_KERNEL, &zynqmp_api); diff --git a/drivers/fuel_gauge/bq27z746/bq27z746.c b/drivers/fuel_gauge/bq27z746/bq27z746.c index 98918faaa7648..2b0fa953563b1 100644 --- a/drivers/fuel_gauge/bq27z746/bq27z746.c +++ b/drivers/fuel_gauge/bq27z746/bq27z746.c @@ -282,7 +282,7 @@ static const struct fuel_gauge_driver_api bq27z746_driver_api = { .i2c = I2C_DT_SPEC_INST_GET(index), \ }; \ \ - DEVICE_DT_INST_DEFINE(index, &bq27z746_init, NULL, NULL, &bq27z746_config_##index, \ - POST_KERNEL, CONFIG_FUEL_GAUGE_INIT_PRIORITY, &bq27z746_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(index, &bq27z746_init, NULL, NULL, &bq27z746_config_##index, \ + POST_KERNEL, &bq27z746_driver_api); DT_INST_FOREACH_STATUS_OKAY(BQ27Z746_INIT) diff --git a/drivers/fuel_gauge/composite/fuel_gauge_composite.c b/drivers/fuel_gauge/composite/fuel_gauge_composite.c index 5fef8db3a31f4..e67c2de626392 100644 --- a/drivers/fuel_gauge/composite/fuel_gauge_composite.c +++ b/drivers/fuel_gauge/composite/fuel_gauge_composite.c @@ -106,7 +106,7 @@ static const struct fuel_gauge_driver_api composite_api = { DT_INST_PROP_OR(inst, charge_full_design_microamp_hours, 0), \ .chemistry = BATTERY_CHEMISTRY_DT_GET(inst), \ }; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, &composite_##inst##_config, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &composite_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, NULL, &composite_##inst##_config, POST_KERNEL,\ + &composite_api); DT_INST_FOREACH_STATUS_OKAY(COMPOSITE_INIT) diff --git a/drivers/fuel_gauge/max17048/max17048.c b/drivers/fuel_gauge/max17048/max17048.c index 9aa220e5b7b81..47933787ce5e5 100644 --- a/drivers/fuel_gauge/max17048/max17048.c +++ b/drivers/fuel_gauge/max17048/max17048.c @@ -289,8 +289,8 @@ static const struct fuel_gauge_driver_api max17048_driver_api = { static const struct max17048_config max17048_config_##inst = { \ .i2c = I2C_DT_SPEC_INST_GET(inst)}; \ \ - DEVICE_DT_INST_DEFINE(inst, &max17048_init, NULL, &max17048_data_##inst, \ - &max17048_config_##inst, POST_KERNEL, \ - CONFIG_FUEL_GAUGE_INIT_PRIORITY, &max17048_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, &max17048_init, NULL, &max17048_data_##inst, \ + &max17048_config_##inst, POST_KERNEL, \ + &max17048_driver_api); DT_INST_FOREACH_STATUS_OKAY(MAX17048_DEFINE) diff --git a/drivers/fuel_gauge/sbs_gauge/sbs_gauge.c b/drivers/fuel_gauge/sbs_gauge/sbs_gauge.c index 16877030f29e6..07a178f41f14e 100644 --- a/drivers/fuel_gauge/sbs_gauge/sbs_gauge.c +++ b/drivers/fuel_gauge/sbs_gauge/sbs_gauge.c @@ -325,9 +325,8 @@ static const struct fuel_gauge_driver_api sbs_gauge_driver_api = { .i2c = I2C_DT_SPEC_INST_GET(index), \ .cutoff_cfg = SBS_GAUGE_GET_BATTERY_CONFIG_NAME(index)}; \ \ - DEVICE_DT_INST_DEFINE(index, &sbs_gauge_init, NULL, NULL, &sbs_gauge_config_##index, \ - POST_KERNEL, CONFIG_FUEL_GAUGE_INIT_PRIORITY, \ - &sbs_gauge_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(index, &sbs_gauge_init, NULL, NULL, &sbs_gauge_config_##index,\ + POST_KERNEL, &sbs_gauge_driver_api); DT_INST_FOREACH_STATUS_OKAY(SBS_GAUGE_INIT) diff --git a/drivers/gnss/gnss_luatos_air530z.c b/drivers/gnss/gnss_luatos_air530z.c index 4b037d54ea446..f83649c0efbdc 100644 --- a/drivers/gnss/gnss_luatos_air530z.c +++ b/drivers/gnss/gnss_luatos_air530z.c @@ -355,10 +355,10 @@ static const struct gnss_driver_api gnss_api = { \ PM_DEVICE_DT_INST_DEFINE(inst, luatos_air530z_pm_action); \ \ - DEVICE_DT_INST_DEFINE(inst, gnss_luatos_air530z_init, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, gnss_luatos_air530z_init, \ PM_DEVICE_DT_INST_GET(inst), \ &gnss_luatos_air530z_data_##inst, \ &gnss_luatos_air530z_cfg_##inst, \ - POST_KERNEL, CONFIG_GNSS_INIT_PRIORITY, &gnss_api); + POST_KERNEL, &gnss_api); DT_INST_FOREACH_STATUS_OKAY(LUATOS_AIR530Z) diff --git a/drivers/gnss/gnss_nmea_generic.c b/drivers/gnss/gnss_nmea_generic.c index 148382abc93ee..182b709b18e80 100644 --- a/drivers/gnss/gnss_nmea_generic.c +++ b/drivers/gnss/gnss_nmea_generic.c @@ -192,10 +192,10 @@ MODEM_CHAT_SCRIPT_EMPTY_DEFINE(gnss_nmea_generic_init_chat_script); \ PM_DEVICE_DT_INST_DEFINE(inst, gnss_nmea_generic_pm_action); \ \ - DEVICE_DT_INST_DEFINE(inst, gnss_nmea_generic_init, PM_DEVICE_DT_INST_GET(inst),\ + DEVICE_INSTANCE_FROM_DT_INST(inst, gnss_nmea_generic_init, PM_DEVICE_DT_INST_GET(inst),\ &gnss_nmea_generic_data_##inst, \ &gnss_nmea_generic_cfg_##inst, \ - POST_KERNEL, CONFIG_GNSS_INIT_PRIORITY, &gnss_api); + POST_KERNEL, &gnss_api); #define DT_DRV_COMPAT gnss_nmea_generic DT_INST_FOREACH_STATUS_OKAY(GNSS_NMEA_GENERIC) diff --git a/drivers/gnss/gnss_u_blox_m8.c b/drivers/gnss/gnss_u_blox_m8.c index 88f180cbc6236..fe033784fdde7 100644 --- a/drivers/gnss/gnss_u_blox_m8.c +++ b/drivers/gnss/gnss_u_blox_m8.c @@ -1007,13 +1007,12 @@ static int ubx_m8_init(const struct device *dev) .script.timeout = K_MSEC(MODEM_UBX_SCRIPT_TIMEOUT_MS), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ ubx_m8_init, \ NULL, \ &ubx_m8_data_##inst, \ &ubx_m8_cfg_##inst, \ POST_KERNEL, \ - CONFIG_GNSS_INIT_PRIORITY, \ &gnss_api); DT_INST_FOREACH_STATUS_OKAY(UBX_M8) diff --git a/drivers/gpio/gpio_ad559x.c b/drivers/gpio/gpio_ad559x.c index afa3d1be10c7d..62cc6ae7c96d3 100644 --- a/drivers/gpio/gpio_ad559x.c +++ b/drivers/gpio/gpio_ad559x.c @@ -228,9 +228,8 @@ static int gpio_ad559x_init(const struct device *dev) \ static struct gpio_ad559x_data gpio_ad559x_data##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, gpio_ad559x_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, gpio_ad559x_init, NULL, \ &gpio_ad559x_data##inst, &gpio_ad559x_config##inst, \ - POST_KERNEL, CONFIG_MFD_INIT_PRIORITY, \ - &gpio_ad559x_api); + POST_KERNEL, &gpio_ad559x_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_AD559X_DEFINE) diff --git a/drivers/gpio/gpio_adp5585.c b/drivers/gpio/gpio_adp5585.c index 0a1da5e63f4aa..072ab7638d957 100644 --- a/drivers/gpio/gpio_adp5585.c +++ b/drivers/gpio/gpio_adp5585.c @@ -461,9 +461,9 @@ static const struct gpio_driver_api api_table = { .mfd_dev = DEVICE_DT_GET(DT_INST_PARENT(inst)), \ }; \ static struct adp5585_gpio_data adp5585_gpio_drvdata_##inst; \ - DEVICE_DT_INST_DEFINE(inst, gpio_adp5585_init, NULL, \ - &adp5585_gpio_drvdata_##inst, \ - &adp5585_gpio_cfg_##inst, POST_KERNEL, \ - CONFIG_GPIO_ADP5585_INIT_PRIORITY, &api_table); + DEVICE_INSTANCE_FROM_DT_INST(inst, gpio_adp5585_init, NULL, \ + &adp5585_gpio_drvdata_##inst, \ + &adp5585_gpio_cfg_##inst, POST_KERNEL, \ + &api_table); DT_INST_FOREACH_STATUS_OKAY(GPIO_ADP5585_INIT) diff --git a/drivers/gpio/gpio_ads114s0x.c b/drivers/gpio/gpio_ads114s0x.c index 5c0cd261e2689..fd1014ac52403 100644 --- a/drivers/gpio/gpio_ads114s0x.c +++ b/drivers/gpio/gpio_ads114s0x.c @@ -138,8 +138,8 @@ BUILD_ASSERT(CONFIG_GPIO_ADS114S0X_INIT_PRIORITY > CONFIG_ADC_INIT_PRIORITY, \ static struct gpio_ads114s0x_data gpio_ads114s0x_##id##_data; \ \ - DEVICE_DT_INST_DEFINE(id, gpio_ads114s0x_init, NULL, &gpio_ads114s0x_##id##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(id, gpio_ads114s0x_init, NULL, &gpio_ads114s0x_##id##_data, \ &gpio_ads114s0x_##id##_cfg, POST_KERNEL, \ - CONFIG_GPIO_ADS114S0X_INIT_PRIORITY, &gpio_ads114s0x_api); + &gpio_ads114s0x_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_ADS114S0X_DEVICE) diff --git a/drivers/gpio/gpio_altera_pio.c b/drivers/gpio/gpio_altera_pio.c index d85c63d324597..46d176df87e71 100644 --- a/drivers/gpio/gpio_altera_pio.c +++ b/drivers/gpio/gpio_altera_pio.c @@ -311,14 +311,13 @@ static const struct gpio_driver_api gpio_altera_driver_api = { .outclear = DT_INST_PROP(n, outclear), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ gpio_init, \ NULL, \ &gpio_altera_data_##n, \ &gpio_config_##n, \ POST_KERNEL, \ - CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_altera_driver_api); \ + &gpio_altera_driver_api); \ \ static void gpio_altera_cfg_func_##n(void) \ { \ diff --git a/drivers/gpio/gpio_ambiq.c b/drivers/gpio/gpio_ambiq.c index cf4e7899db50c..92758649ad9fa 100644 --- a/drivers/gpio/gpio_ambiq.c +++ b/drivers/gpio/gpio_ambiq.c @@ -597,8 +597,7 @@ static const struct gpio_driver_api ambiq_gpio_drv_api = { .irq_num = DT_INST_IRQN(n), \ .cfg_func = ambiq_gpio_cfg_func_##n}; \ AMBIQ_GPIO_CONFIG_FUNC(n) \ - DEVICE_DT_INST_DEFINE(n, ambiq_gpio_init, NULL, &ambiq_gpio_data_##n, \ - &ambiq_gpio_config_##n, PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, \ - &ambiq_gpio_drv_api); + DEVICE_INSTANCE_FROM_DT_INST(n, ambiq_gpio_init, NULL, &ambiq_gpio_data_##n, \ + &ambiq_gpio_config_##n, PRE_KERNEL_1, &ambiq_gpio_drv_api); DT_INST_FOREACH_STATUS_OKAY(AMBIQ_GPIO_DEFINE) diff --git a/drivers/gpio/gpio_andes_atcgpio100.c b/drivers/gpio/gpio_andes_atcgpio100.c index f7c8bdfc4da90..a325bd2da28a4 100644 --- a/drivers/gpio/gpio_andes_atcgpio100.c +++ b/drivers/gpio/gpio_andes_atcgpio100.c @@ -367,14 +367,13 @@ static int gpio_atcgpio100_init(const struct device *port) .cfg_func = gpio_atcgpio100_cfg_func_##n \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ - gpio_atcgpio100_init, \ - NULL, \ - &gpio_atcgpio100_data_##n, \ - &gpio_atcgpio100_config_##n, \ - PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_atcgpio100_api); \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ + gpio_atcgpio100_init, \ + NULL, \ + &gpio_atcgpio100_data_##n, \ + &gpio_atcgpio100_config_##n, \ + PRE_KERNEL_1, \ + &gpio_atcgpio100_api); \ \ static void gpio_atcgpio100_cfg_func_##n(void) \ { \ diff --git a/drivers/gpio/gpio_axp192.c b/drivers/gpio/gpio_axp192.c index 661348bc1be3f..f4a07856ff6c4 100644 --- a/drivers/gpio/gpio_axp192.c +++ b/drivers/gpio/gpio_axp192.c @@ -313,8 +313,8 @@ static int gpio_axp192_init(const struct device *dev) \ static struct gpio_axp192_data gpio_axp192_data##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, gpio_axp192_init, NULL, &gpio_axp192_data##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, gpio_axp192_init, NULL, &gpio_axp192_data##inst, \ &gpio_axp192_config##inst, POST_KERNEL, \ - CONFIG_GPIO_AXP192_INIT_PRIORITY, &gpio_axp192_api); + &gpio_axp192_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_AXP192_DEFINE) diff --git a/drivers/gpio/gpio_b91.c b/drivers/gpio/gpio_b91.c index 4c4c14dc9098c..b2be9646047f8 100644 --- a/drivers/gpio/gpio_b91.c +++ b/drivers/gpio/gpio_b91.c @@ -551,12 +551,11 @@ static void gpio_b91_irq_connect_4(void) }; \ static struct gpio_b91_data gpio_b91_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_b91_init, \ - NULL, \ - &gpio_b91_data_##n, \ - &gpio_b91_config_##n, \ - PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_b91_init, \ + NULL, \ + &gpio_b91_data_##n, \ + &gpio_b91_config_##n, \ + PRE_KERNEL_1, \ &gpio_b91_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_B91_INIT) diff --git a/drivers/gpio/gpio_bcm2711.c b/drivers/gpio/gpio_bcm2711.c index a4e4a31e7c9af..26d50f8c275f0 100644 --- a/drivers/gpio/gpio_bcm2711.c +++ b/drivers/gpio/gpio_bcm2711.c @@ -348,8 +348,7 @@ static const struct gpio_driver_api gpio_bcm2711_api = { .ngpios = DT_INST_PROP(n, ngpios), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_bcm2711_init, NULL, &gpio_bcm2711_data_##n, \ - &gpio_bcm2711_cfg_##n, PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_bcm2711_api); + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_bcm2711_init, NULL, &gpio_bcm2711_data_##n, \ + &gpio_bcm2711_cfg_##n, PRE_KERNEL_1, &gpio_bcm2711_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_BCM2711_INST) diff --git a/drivers/gpio/gpio_bd8lb600fs.c b/drivers/gpio/gpio_bd8lb600fs.c index 4a2e5f7229f2d..5a64e060901c3 100644 --- a/drivers/gpio/gpio_bd8lb600fs.c +++ b/drivers/gpio/gpio_bd8lb600fs.c @@ -198,8 +198,8 @@ static int bd8lb600fs_gpio_init(const struct device *dev) .configured = 0x00, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, bd8lb600fs_gpio_init, NULL, &bd8lb600fs_##inst##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, bd8lb600fs_gpio_init, NULL, &bd8lb600fs_##inst##_data, \ &bd8lb600fs_##inst##_config, POST_KERNEL, \ - CONFIG_GPIO_BD8LB600FS_INIT_PRIORITY, &api_table); + &api_table); DT_INST_FOREACH_STATUS_OKAY(BD8LB600FS_GPIO_INIT) diff --git a/drivers/gpio/gpio_brcmstb.c b/drivers/gpio/gpio_brcmstb.c index cfec6868f290f..e554da4d2b7a8 100644 --- a/drivers/gpio/gpio_brcmstb.c +++ b/drivers/gpio/gpio_brcmstb.c @@ -134,8 +134,7 @@ int gpio_brcmstb_init(const struct device *port) .offset = DT_INST_REG_ADDR(n), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_brcmstb_init, NULL, &gpio_brcmstb_data_##n, \ - &gpio_brcmstb_cfg_##n, PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_brcmstb_api); + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_brcmstb_init, NULL, &gpio_brcmstb_data_##n, \ + &gpio_brcmstb_cfg_##n, PRE_KERNEL_1, &gpio_brcmstb_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_BRCMSTB_INIT) diff --git a/drivers/gpio/gpio_cc13xx_cc26xx.c b/drivers/gpio/gpio_cc13xx_cc26xx.c index 9804fe57d5bb4..041f94cba59fb 100644 --- a/drivers/gpio/gpio_cc13xx_cc26xx.c +++ b/drivers/gpio/gpio_cc13xx_cc26xx.c @@ -312,8 +312,7 @@ static const struct gpio_driver_api gpio_cc13xx_cc26xx_driver_api = { #endif /* CONFIG_GPIO_GET_DIRECTION */ }; -DEVICE_DT_INST_DEFINE(0, gpio_cc13xx_cc26xx_init, +DEVICE_INSTANCE_FROM_DT_INST(0, gpio_cc13xx_cc26xx_init, NULL, &gpio_cc13xx_cc26xx_data_0, &gpio_cc13xx_cc26xx_cfg_0, - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, - &gpio_cc13xx_cc26xx_driver_api); + PRE_KERNEL_1, &gpio_cc13xx_cc26xx_driver_api); diff --git a/drivers/gpio/gpio_cc32xx.c b/drivers/gpio/gpio_cc32xx.c index 88d2f7eee27fb..6f96c4409ee2a 100644 --- a/drivers/gpio/gpio_cc32xx.c +++ b/drivers/gpio/gpio_cc32xx.c @@ -256,11 +256,10 @@ static const struct gpio_driver_api api_funcs = { } #define GPIO_CC32XX_DEVICE_INIT(n) \ - DEVICE_DT_INST_DEFINE(n, gpio_cc32xx_a##n##_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_cc32xx_a##n##_init, \ NULL, &gpio_cc32xx_a##n##_data, \ &gpio_cc32xx_a##n##_config, \ - POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY, \ - &api_funcs) + POST_KERNEL, &api_funcs) #define GPIO_CC32XX_INIT(n) \ static const struct gpio_cc32xx_config gpio_cc32xx_a##n##_config = { \ diff --git a/drivers/gpio/gpio_cmsdk_ahb.c b/drivers/gpio/gpio_cmsdk_ahb.c index ce2b370b3eee7..cf267bffc0b8e 100644 --- a/drivers/gpio/gpio_cmsdk_ahb.c +++ b/drivers/gpio/gpio_cmsdk_ahb.c @@ -276,13 +276,12 @@ static int gpio_cmsdk_ahb_init(const struct device *dev) \ static struct gpio_cmsdk_ahb_dev_data gpio_cmsdk_port_##n##_data; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ gpio_cmsdk_ahb_init, \ NULL, \ &gpio_cmsdk_port_##n##_data, \ &gpio_cmsdk_port_## n ##_config, \ - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_cmsdk_ahb_drv_api_funcs); \ + PRE_KERNEL_1, &gpio_cmsdk_ahb_drv_api_funcs); \ \ static void gpio_cmsdk_port_##n##_config_func(const struct device *dev) \ { \ diff --git a/drivers/gpio/gpio_creg_gpio.c b/drivers/gpio/gpio_creg_gpio.c index 1b9f4d63a50aa..04c4d6a11e60f 100644 --- a/drivers/gpio/gpio_creg_gpio.c +++ b/drivers/gpio/gpio_creg_gpio.c @@ -171,6 +171,5 @@ static struct creg_gpio_drv_data creg_gpio_drvdata = { .base_addr = DT_INST_REG_ADDR(0), }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, &creg_gpio_drvdata, &creg_gpio_cfg, - POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY, - &api_table); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, &creg_gpio_drvdata, &creg_gpio_cfg, + POST_KERNEL, &api_table); diff --git a/drivers/gpio/gpio_cy8c95xx.c b/drivers/gpio/gpio_cy8c95xx.c index 155bfb4988a7c..ae2136ad53d2b 100644 --- a/drivers/gpio/gpio_cy8c95xx.c +++ b/drivers/gpio/gpio_cy8c95xx.c @@ -284,9 +284,8 @@ static const struct cy8c95xx_config cy8c95xx_##idx##_cfg = { \ static struct cy8c95xx_drv_data cy8c95xx_##idx##_drvdata = { \ .lock = &cy8c95xx_lock, \ }; \ -DEVICE_DT_INST_DEFINE(idx, cy8c95xx_init, NULL, \ - &cy8c95xx_##idx##_drvdata, &cy8c95xx_##idx##_cfg, \ - POST_KERNEL, CONFIG_GPIO_CY8C95XX_INIT_PRIORITY, \ - &api_table); +DEVICE_INSTANCE_FROM_DT_INST(idx, cy8c95xx_init, NULL,\ + &cy8c95xx_##idx##_drvdata, &cy8c95xx_##idx##_cfg,\ + POST_KERNEL, &api_table); DT_INST_FOREACH_STATUS_OKAY(GPIO_PORT_INIT) diff --git a/drivers/gpio/gpio_davinci.c b/drivers/gpio/gpio_davinci.c index b3ff9d4b22984..54c0a242ab8b1 100644 --- a/drivers/gpio/gpio_davinci.c +++ b/drivers/gpio/gpio_davinci.c @@ -190,13 +190,12 @@ static int gpio_davinci_init(const struct device *dev) \ static struct gpio_davinci_data gpio_davinci_##n##_data; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ gpio_davinci_init, \ NULL, \ &gpio_davinci_##n##_data, \ &gpio_davinci_##n##_config, \ PRE_KERNEL_2, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_davinci_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_DAVINCI_INIT) diff --git a/drivers/gpio/gpio_dw.c b/drivers/gpio/gpio_dw.c index 1aaaaee6117ce..0d307366e47e4 100644 --- a/drivers/gpio/gpio_dw.c +++ b/drivers/gpio/gpio_dw.c @@ -464,8 +464,8 @@ static int gpio_dw_initialize(const struct device *port) .base_addr = DT_INST_REG_ADDR(n), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_dw_initialize, NULL, &gpio_##n##_runtime, \ + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_dw_initialize, NULL, &gpio_##n##_runtime, \ &gpio_dw_config_##n, PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, &api_funcs); \ + &api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(GPIO_DW_INIT) diff --git a/drivers/gpio/gpio_efinix_sapphire.c b/drivers/gpio/gpio_efinix_sapphire.c index 50123731a5f25..233d458672a9b 100644 --- a/drivers/gpio/gpio_efinix_sapphire.c +++ b/drivers/gpio/gpio_efinix_sapphire.c @@ -221,14 +221,12 @@ static const struct gpio_driver_api gpio_efinix_sapphire_api = { .n_gpios = DT_INST_PROP(n, ngpios), \ }; \ static struct gpio_efinix_sapphire_data gpio_efinix_sapphire_data_##n; \ - DEVICE_DT_INST_DEFINE(n, \ - gpio_efinix_sapphire_init, \ - NULL, \ - &gpio_efinix_sapphire_data_##n, \ - &gpio_efinix_sapphire_cfg_##n, \ - POST_KERNEL, \ - CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_efinix_sapphire_api \ - ); \ + DEVICE_INSTANCE_FROM_DT_INST(n,\ + gpio_efinix_sapphire_init,\ + NULL,\ + &gpio_efinix_sapphire_data_##n,\ + &gpio_efinix_sapphire_cfg_##n,\ + POST_KERNEL,\ + &gpio_efinix_sapphire_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_EFINIX_SAPPHIRE_INIT) diff --git a/drivers/gpio/gpio_emul.c b/drivers/gpio/gpio_emul.c index e9c5ff0307db2..986316ed3d278 100644 --- a/drivers/gpio/gpio_emul.c +++ b/drivers/gpio/gpio_emul.c @@ -880,11 +880,10 @@ static int gpio_emul_pm_device_pm_action(const struct device *dev, \ PM_DEVICE_DT_INST_DEFINE(_num, gpio_emul_pm_device_pm_action); \ \ - DEVICE_DT_INST_DEFINE(_num, gpio_emul_init, \ + DEVICE_INSTANCE_FROM_DT_INST(_num, gpio_emul_init, \ PM_DEVICE_DT_INST_GET(_num), \ &gpio_emul_data_##_num, \ &gpio_emul_config_##_num, POST_KERNEL, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_emul_driver); DT_INST_FOREACH_STATUS_OKAY(DEFINE_GPIO_EMUL) diff --git a/drivers/gpio/gpio_emul_sdl.c b/drivers/gpio/gpio_emul_sdl.c index 98d36b85779aa..cf460ab02d032 100644 --- a/drivers/gpio/gpio_emul_sdl.c +++ b/drivers/gpio/gpio_emul_sdl.c @@ -93,8 +93,8 @@ static int gpio_sdl_init(const struct device *dev) .data = &data_##inst, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, gpio_sdl_init, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, gpio_sdl_init, NULL, NULL, \ &gpio_sdl_##inst##_config, POST_KERNEL, \ - CONFIG_GPIO_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(GPIO_SDL_DEFINE) diff --git a/drivers/gpio/gpio_ene_kb1200.c b/drivers/gpio/gpio_ene_kb1200.c index aedeae7b1772e..de25f45926e5b 100644 --- a/drivers/gpio/gpio_ene_kb1200.c +++ b/drivers/gpio/gpio_ene_kb1200.c @@ -203,8 +203,8 @@ static const struct gpio_driver_api kb1200_gpio_api = { .gptd_regs = (struct gptd_regs *)DT_INST_REG_ADDR_BY_IDX(n, 1), \ }; \ static struct gpio_kb1200_data gpio_kb1200_##n##_data; \ - DEVICE_DT_INST_DEFINE(n, &kb1200_gpio_##n##_init, NULL, &gpio_kb1200_##n##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &kb1200_gpio_##n##_init, NULL, &gpio_kb1200_##n##_data, \ &port_##n##_kb1200_config, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &kb1200_gpio_api); + &kb1200_gpio_api); DT_INST_FOREACH_STATUS_OKAY(KB1200_GPIO_INIT) diff --git a/drivers/gpio/gpio_eos_s3.c b/drivers/gpio/gpio_eos_s3.c index 525b5e52c7ab0..0b441e76090f1 100644 --- a/drivers/gpio/gpio_eos_s3.c +++ b/drivers/gpio/gpio_eos_s3.c @@ -442,11 +442,10 @@ static struct gpio_eos_s3_data gpio_eos_s3_data = { }, }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, gpio_eos_s3_init, NULL, &gpio_eos_s3_data, &gpio_eos_s3_config, PRE_KERNEL_1, - CONFIG_GPIO_INIT_PRIORITY, &gpio_eos_s3_driver_api); diff --git a/drivers/gpio/gpio_esp32.c b/drivers/gpio/gpio_esp32.c index e7e243e75cd07..604e9fc434f60 100644 --- a/drivers/gpio/gpio_esp32.c +++ b/drivers/gpio/gpio_esp32.c @@ -520,13 +520,12 @@ static const struct gpio_driver_api gpio_esp32_driver_api = { .gpio_dev = (gpio_dev_t *)DT_REG_ADDR(DT_NODELABEL(gpio##_id)), \ .gpio_port = _id \ }; \ - DEVICE_DT_DEFINE(DT_NODELABEL(gpio##_id), \ + DEVICE_INSTANCE(DT_NODELABEL(gpio##_id), \ &gpio_esp32_init, \ NULL, \ &gpio_data_##_id, \ &gpio_config_##_id, \ PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_esp32_driver_api); DT_INST_FOREACH_STATUS_OKAY(ESP_SOC_GPIO_INIT); diff --git a/drivers/gpio/gpio_fxl6408.c b/drivers/gpio/gpio_fxl6408.c index 7352390e371a9..6c9d0163330bd 100644 --- a/drivers/gpio/gpio_fxl6408.c +++ b/drivers/gpio/gpio_fxl6408.c @@ -421,10 +421,9 @@ static const struct gpio_driver_api gpio_fxl_driver = { } \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, gpio_fxl6408_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, gpio_fxl6408_init, NULL, \ &gpio_fxl6408_##inst##_drvdata, \ &gpio_fxl6408_##inst##_cfg, POST_KERNEL, \ - CONFIG_GPIO_FXL6408_INIT_PRIORITY, \ &gpio_fxl_driver); DT_INST_FOREACH_STATUS_OKAY(GPIO_FXL6408_DEVICE_INSTANCE) diff --git a/drivers/gpio/gpio_gd32.c b/drivers/gpio/gpio_gd32.c index 1c40be4de4c5a..75c751e34ef63 100644 --- a/drivers/gpio/gpio_gd32.c +++ b/drivers/gpio/gpio_gd32.c @@ -373,8 +373,8 @@ static int gpio_gd32_init(const struct device *port) \ static struct gpio_gd32_data gpio_gd32_data##n; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_gd32_init, NULL, &gpio_gd32_data##n, \ - &gpio_gd32_config##n, PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, &gpio_gd32_api); + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_gd32_init, NULL, &gpio_gd32_data##n,\ + &gpio_gd32_config##n, PRE_KERNEL_1, \ + &gpio_gd32_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_GD32_DEFINE) diff --git a/drivers/gpio/gpio_gecko.c b/drivers/gpio/gpio_gecko.c index 1025f1eaa7ab0..448b9f7d2d878 100644 --- a/drivers/gpio/gpio_gecko.c +++ b/drivers/gpio/gpio_gecko.c @@ -383,11 +383,11 @@ static const struct gpio_gecko_common_config gpio_gecko_common_config = { static struct gpio_gecko_common_data gpio_gecko_common_data; -DEVICE_DT_DEFINE(DT_INST(0, silabs_gecko_gpio), +DEVICE_INSTANCE(DT_INST(0, silabs_gecko_gpio), gpio_gecko_common_init, NULL, &gpio_gecko_common_data, &gpio_gecko_common_config, - PRE_KERNEL_1, CONFIG_GPIO_GECKO_COMMON_INIT_PRIORITY, + PRE_KERNEL_1, &gpio_gecko_common_driver_api); static int gpio_gecko_common_init(const struct device *dev) @@ -424,13 +424,12 @@ static const struct gpio_gecko_config gpio_gecko_port##idx##_config = { \ \ static struct gpio_gecko_data gpio_gecko_port##idx##_data; \ \ -DEVICE_DT_INST_DEFINE(idx, \ - gpio_gecko_port##idx##_init, \ - NULL, \ - &gpio_gecko_port##idx##_data, \ - &gpio_gecko_port##idx##_config, \ - POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_gecko_driver_api); \ +DEVICE_INSTANCE_FROM_DT_INST(idx,\ + gpio_gecko_port##idx##_init,\ + NULL, \ + &gpio_gecko_port##idx##_data,\ + &gpio_gecko_port##idx##_config,\ + POST_KERNEL, &gpio_gecko_driver_api);\ \ static int gpio_gecko_port##idx##_init(const struct device *dev) \ { \ diff --git a/drivers/gpio/gpio_grgpio2.c b/drivers/gpio/gpio_grgpio2.c index fbe57f0ce674e..489869309aff6 100644 --- a/drivers/gpio/gpio_grgpio2.c +++ b/drivers/gpio/gpio_grgpio2.c @@ -291,14 +291,13 @@ static const struct gpio_driver_api driver_api = { }; \ static struct data data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ grgpio_init, \ NULL, \ &data_##n, \ &cfg_##n, \ POST_KERNEL, \ - CONFIG_GPIO_INIT_PRIORITY, \ - &driver_api \ + &driver_api, \ ); DT_INST_FOREACH_STATUS_OKAY(GRGPIO_INIT) diff --git a/drivers/gpio/gpio_ifx_cat1.c b/drivers/gpio/gpio_ifx_cat1.c index e9529cd04badc..1f4af084b692c 100644 --- a/drivers/gpio/gpio_ifx_cat1.c +++ b/drivers/gpio/gpio_ifx_cat1.c @@ -259,8 +259,8 @@ static const struct gpio_driver_api gpio_cat1_api = { \ GPIO_CAT1_INIT_FUNC(n) \ \ - DEVICE_DT_INST_DEFINE(n, gpio_cat1##n##_init, NULL, &_cat1_gpio##n##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_cat1##n##_init, NULL, &_cat1_gpio##n##_data, \ &_cat1_gpio##n##_config, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &gpio_cat1_api); + &gpio_cat1_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_CAT1_INIT) diff --git a/drivers/gpio/gpio_imx.c b/drivers/gpio/gpio_imx.c index 91159c918c7d1..1d9f2f6a547b4 100644 --- a/drivers/gpio/gpio_imx.c +++ b/drivers/gpio/gpio_imx.c @@ -289,13 +289,12 @@ static const struct gpio_driver_api imx_gpio_driver_api = { \ static struct imx_gpio_data imx_gpio_##n##_data; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ imx_gpio_##n##_init, \ NULL, \ &imx_gpio_##n##_data, \ &imx_gpio_##n##_config, \ PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ &imx_gpio_driver_api); \ \ static int imx_gpio_##n##_init(const struct device *port) \ diff --git a/drivers/gpio/gpio_intel.c b/drivers/gpio/gpio_intel.c index cd62d9ce0e4c8..5b605eb843892 100644 --- a/drivers/gpio/gpio_intel.c +++ b/drivers/gpio/gpio_intel.c @@ -697,9 +697,8 @@ static int gpio_intel_dts_init(const struct device *dev) GPIO_INIT_CONFIG(n); \ static struct gpio_intel_data gpio_intel_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_intel_init##n, NULL, &gpio_intel_data_##n, \ - &gpio_intel_cfg_##n, POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_intel_api); + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_intel_init##n, NULL, &gpio_intel_data_##n, \ + &gpio_intel_cfg_##n, POST_KERNEL, &gpio_intel_api); /* "sub" devices. no more than GPIO_INTEL_NR_SUBDEVS of these! */ DT_INST_FOREACH_STATUS_OKAY(GPIO_INTEL_DEV_CFG_DATA) diff --git a/drivers/gpio/gpio_iproc.c b/drivers/gpio/gpio_iproc.c index 70f765b5ac7f4..59cd25b6b59ef 100644 --- a/drivers/gpio/gpio_iproc.c +++ b/drivers/gpio/gpio_iproc.c @@ -218,8 +218,7 @@ int gpio_iproc_init(const struct device *dev) \ static struct gpio_iproc_data gpio_port_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_iproc_init, NULL, &gpio_port_data_##n, \ - &gpio_port_config_##n, POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_iproc_api); + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_iproc_init, NULL, &gpio_port_data_##n, \ + &gpio_port_config_##n, POST_KERNEL, &gpio_iproc_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_IPROC_INIT) diff --git a/drivers/gpio/gpio_ite_it8xxx2.c b/drivers/gpio/gpio_ite_it8xxx2.c index 7e441eb9c8855..a72d978940d80 100644 --- a/drivers/gpio/gpio_ite_it8xxx2.c +++ b/drivers/gpio/gpio_ite_it8xxx2.c @@ -709,13 +709,12 @@ static const struct gpio_ite_cfg gpio_ite_cfg_##inst = { \ .gpio_irq[6] = DT_INST_IRQ_BY_IDX(inst, 6, irq), \ .gpio_irq[7] = DT_INST_IRQ_BY_IDX(inst, 7, irq), \ }; \ -DEVICE_DT_INST_DEFINE(inst, \ +DEVICE_INSTANCE_FROM_DT_INST(inst, \ NULL, \ NULL, \ &gpio_ite_data_##inst, \ &gpio_ite_cfg_##inst, \ - PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ + PRE_KERNEL_1, \ &gpio_ite_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_ITE_DEV_CFG_DATA) diff --git a/drivers/gpio/gpio_ite_it8xxx2_v2.c b/drivers/gpio/gpio_ite_it8xxx2_v2.c index de969ba267620..ef73e90f2ae9a 100644 --- a/drivers/gpio/gpio_ite_it8xxx2_v2.c +++ b/drivers/gpio/gpio_ite_it8xxx2_v2.c @@ -548,13 +548,12 @@ static const struct gpio_ite_cfg gpio_ite_cfg_##inst = { \ .num_pins = DT_INST_PROP(inst, ngpios), \ .kbs_ctrl = DT_INST_PROP_OR(inst, keyboard_controller, 0), \ }; \ -DEVICE_DT_INST_DEFINE(inst, \ +DEVICE_INSTANCE_FROM_DT_INST(inst, \ gpio_ite_init, \ NULL, \ &gpio_ite_data_##inst, \ &gpio_ite_cfg_##inst, \ PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_ite_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_ITE_DEV_CFG_DATA) diff --git a/drivers/gpio/gpio_kscan_ite_it8xxx2.c b/drivers/gpio/gpio_kscan_ite_it8xxx2.c index 07501aa26efdf..42e1e65585897 100644 --- a/drivers/gpio/gpio_kscan_ite_it8xxx2.c +++ b/drivers/gpio/gpio_kscan_ite_it8xxx2.c @@ -244,13 +244,12 @@ static const struct gpio_kscan_cfg gpio_kscan_it8xxx2_cfg_##inst = { \ \ static struct gpio_kscan_data gpio_kscan_it8xxx2_data_##inst; \ \ -DEVICE_DT_INST_DEFINE(inst, \ +DEVICE_INSTANCE_FROM_DT_INST(inst, \ NULL, \ NULL, \ &gpio_kscan_it8xxx2_data_##inst, \ &gpio_kscan_it8xxx2_cfg_##inst, \ PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_kscan_it8xxx2_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_KSCAN_IT8XXX2_INIT) diff --git a/drivers/gpio/gpio_litex.c b/drivers/gpio/gpio_litex.c index d317803609993..eb72a6d9ebc5b 100644 --- a/drivers/gpio/gpio_litex.c +++ b/drivers/gpio/gpio_litex.c @@ -329,13 +329,12 @@ static const struct gpio_driver_api gpio_litex_driver_api = { }; \ static struct gpio_litex_data gpio_litex_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, \ - gpio_litex_port_init_##n, \ - NULL, \ - &gpio_litex_data_##n, \ - &gpio_litex_cfg_##n, \ - POST_KERNEL, \ - CONFIG_GPIO_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(n,\ + gpio_litex_port_init_##n,\ + NULL,\ + &gpio_litex_data_##n,\ + &gpio_litex_cfg_##n,\ + POST_KERNEL,\ &gpio_litex_driver_api \ ); \ \ diff --git a/drivers/gpio/gpio_lmp90xxx.c b/drivers/gpio/gpio_lmp90xxx.c index 55dd01de978f7..e22b6198e5279 100644 --- a/drivers/gpio/gpio_lmp90xxx.c +++ b/drivers/gpio/gpio_lmp90xxx.c @@ -160,12 +160,11 @@ BUILD_ASSERT(CONFIG_GPIO_LMP90XXX_INIT_PRIORITY > \ static struct gpio_lmp90xxx_data gpio_lmp90xxx_##id##_data; \ \ - DEVICE_DT_INST_DEFINE(id, \ + DEVICE_INSTANCE_FROM_DT_INST(id, \ gpio_lmp90xxx_init, \ NULL, \ &gpio_lmp90xxx_##id##_data, \ &gpio_lmp90xxx_##id##_cfg, POST_KERNEL, \ - CONFIG_GPIO_LMP90XXX_INIT_PRIORITY, \ &gpio_lmp90xxx_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_LMP90XXX_DEVICE) diff --git a/drivers/gpio/gpio_lpc11u6x.c b/drivers/gpio/gpio_lpc11u6x.c index 102d8c3e8b619..e2556c1c3b38a 100644 --- a/drivers/gpio/gpio_lpc11u6x.c +++ b/drivers/gpio/gpio_lpc11u6x.c @@ -581,13 +581,12 @@ static const struct gpio_lpc11u6x_config \ \ static struct gpio_lpc11u6x_data gpio_lpc11u6x_data_##id; \ \ -DEVICE_DT_DEFINE(DT_NODELABEL(gpio##id), \ +DEVICE_INSTANCE(DT_NODELABEL(gpio##id), \ &gpio_lpc11u6x_init, \ NULL, \ &gpio_lpc11u6x_data_##id, \ &gpio_lpc11u6x_config_##id, \ - PRE_KERNEL_2, CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_lpc11u6x_driver_api) + PRE_KERNEL_2, &gpio_lpc11u6x_driver_api) #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio0)) GPIO_LPC11U6X_INIT(0); diff --git a/drivers/gpio/gpio_max14906.c b/drivers/gpio/gpio_max14906.c index d1458802f4f55..8bdbaf90dbd8f 100644 --- a/drivers/gpio/gpio_max14906.c +++ b/drivers/gpio/gpio_max14906.c @@ -488,8 +488,8 @@ static const struct gpio_driver_api gpio_max14906_api = { }, \ }; \ \ - DEVICE_DT_INST_DEFINE(id, &gpio_max14906_init, NULL, &max14906_##id##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(id, &gpio_max14906_init, NULL, &max14906_##id##_data, \ &max14906_##id##_cfg, POST_KERNEL, \ - CONFIG_GPIO_MAX14906_INIT_PRIORITY, &gpio_max14906_api); + &gpio_max14906_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_MAX14906_DEVICE) diff --git a/drivers/gpio/gpio_max14916.c b/drivers/gpio/gpio_max14916.c index f9deec90338d8..3cc3331cf6410 100644 --- a/drivers/gpio/gpio_max14916.c +++ b/drivers/gpio/gpio_max14916.c @@ -393,8 +393,8 @@ static const struct gpio_driver_api gpio_max14916_api = { \ static struct max14916_data max14916_##id##_data; \ \ - DEVICE_DT_INST_DEFINE(id, &gpio_max14916_init, NULL, &max14916_##id##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(id, &gpio_max14916_init, NULL, &max14916_##id##_data, \ &max14916_##id##_cfg, POST_KERNEL, \ - CONFIG_GPIO_MAX14916_INIT_PRIORITY, &gpio_max14916_api); + &gpio_max14916_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_MAX14906_DEVICE) diff --git a/drivers/gpio/gpio_max32.c b/drivers/gpio/gpio_max32.c index 939a2a656cd18..ddd80b66e0986 100644 --- a/drivers/gpio/gpio_max32.c +++ b/drivers/gpio/gpio_max32.c @@ -261,8 +261,7 @@ static int gpio_max32_init(const struct device *dev) .perclk.bus = DT_INST_PHA_BY_IDX_OR(_num, clocks, 0, offset, 0), \ .perclk.bit = DT_INST_PHA_BY_IDX_OR(_num, clocks, 1, bit, 0), \ }; \ - DEVICE_DT_INST_DEFINE(_num, gpio_max32_init, NULL, &max32_gpio_data_##_num, \ - &max32_gpio_config_##_num, PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, \ - (void *)&gpio_max32_driver); + DEVICE_INSTANCE_FROM_DT_INST(_num, gpio_max32_init, NULL, &max32_gpio_data_##_num, \ + &max32_gpio_config_##_num, PRE_KERNEL_1, (void *)&gpio_max32_driver); DT_INST_FOREACH_STATUS_OKAY(MAX32_GPIO_INIT) diff --git a/drivers/gpio/gpio_mchp_mss.c b/drivers/gpio/gpio_mchp_mss.c index 7db42b7791385..a01414ab1c21c 100644 --- a/drivers/gpio/gpio_mchp_mss.c +++ b/drivers/gpio/gpio_mchp_mss.c @@ -242,12 +242,11 @@ static void mss_gpio_irq_handler(const struct device *dev) .gpio_cfg_func = gpio_mss_gpio_cfg_func_##n \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ - mss_gpio_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ + mss_gpio_init,\ NULL, \ - &mss_gpio_data_##n, &mss_gpio_config_##n, \ - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, \ - &mss_gpio_driver); \ + &mss_gpio_data_##n, &mss_gpio_config_##n,\ + PRE_KERNEL_1, &mss_gpio_driver);\ \ static void gpio_mss_gpio_cfg_func_##n(void) \ { \ diff --git a/drivers/gpio/gpio_mchp_xec.c b/drivers/gpio/gpio_mchp_xec.c index e96130a094160..231aa1cad193f 100644 --- a/drivers/gpio/gpio_mchp_xec.c +++ b/drivers/gpio/gpio_mchp_xec.c @@ -361,12 +361,11 @@ static const struct gpio_xec_config gpio_xec_port000_036_config = { static struct gpio_xec_data gpio_xec_port000_036_data; -DEVICE_DT_DEFINE(DT_NODELABEL(gpio_000_036), +DEVICE_INSTANCE(DT_NODELABEL(gpio_000_036), gpio_xec_port000_036_init, NULL, &gpio_xec_port000_036_data, &gpio_xec_port000_036_config, - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, - &gpio_xec_driver_api); + PRE_KERNEL_1, &gpio_xec_driver_api); static int gpio_xec_port000_036_init(const struct device *dev) { @@ -407,12 +406,11 @@ static const struct gpio_xec_config gpio_xec_port040_076_config = { static struct gpio_xec_data gpio_xec_port040_076_data; -DEVICE_DT_DEFINE(DT_NODELABEL(gpio_040_076), +DEVICE_INSTANCE(DT_NODELABEL(gpio_040_076), gpio_xec_port040_076_init, NULL, &gpio_xec_port040_076_data, &gpio_xec_port040_076_config, - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, - &gpio_xec_driver_api); + PRE_KERNEL_1, &gpio_xec_driver_api); static int gpio_xec_port040_076_init(const struct device *dev) { @@ -453,12 +451,11 @@ static const struct gpio_xec_config gpio_xec_port100_136_config = { static struct gpio_xec_data gpio_xec_port100_136_data; -DEVICE_DT_DEFINE(DT_NODELABEL(gpio_100_136), +DEVICE_INSTANCE(DT_NODELABEL(gpio_100_136), gpio_xec_port100_136_init, NULL, &gpio_xec_port100_136_data, &gpio_xec_port100_136_config, - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, - &gpio_xec_driver_api); + PRE_KERNEL_1, &gpio_xec_driver_api); static int gpio_xec_port100_136_init(const struct device *dev) { @@ -499,12 +496,11 @@ static const struct gpio_xec_config gpio_xec_port140_176_config = { static struct gpio_xec_data gpio_xec_port140_176_data; -DEVICE_DT_DEFINE(DT_NODELABEL(gpio_140_176), +DEVICE_INSTANCE(DT_NODELABEL(gpio_140_176), gpio_xec_port140_176_init, NULL, &gpio_xec_port140_176_data, &gpio_xec_port140_176_config, - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, - &gpio_xec_driver_api); + PRE_KERNEL_1, &gpio_xec_driver_api); static int gpio_xec_port140_176_init(const struct device *dev) { @@ -545,12 +541,11 @@ static const struct gpio_xec_config gpio_xec_port200_236_config = { static struct gpio_xec_data gpio_xec_port200_236_data; -DEVICE_DT_DEFINE(DT_NODELABEL(gpio_200_236), +DEVICE_INSTANCE(DT_NODELABEL(gpio_200_236), gpio_xec_port200_236_init, NULL, &gpio_xec_port200_236_data, &gpio_xec_port200_236_config, - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, - &gpio_xec_driver_api); + PRE_KERNEL_1, &gpio_xec_driver_api); static int gpio_xec_port200_236_init(const struct device *dev) { @@ -591,12 +586,11 @@ static const struct gpio_xec_config gpio_xec_port240_276_config = { static struct gpio_xec_data gpio_xec_port240_276_data; -DEVICE_DT_DEFINE(DT_NODELABEL(gpio_240_276), +DEVICE_INSTANCE(DT_NODELABEL(gpio_240_276), gpio_xec_port240_276_init, NULL, &gpio_xec_port240_276_data, &gpio_xec_port240_276_config, - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, - &gpio_xec_driver_api); + PRE_KERNEL_1, &gpio_xec_driver_api); static int gpio_xec_port240_276_init(const struct device *dev) { diff --git a/drivers/gpio/gpio_mchp_xec_v2.c b/drivers/gpio/gpio_mchp_xec_v2.c index 67697b1e31859..b1a3e14f6a5c9 100644 --- a/drivers/gpio/gpio_mchp_xec_v2.c +++ b/drivers/gpio/gpio_mchp_xec_v2.c @@ -544,9 +544,8 @@ static const struct gpio_driver_api gpio_xec_driver_api = { .flags = XEC_GPIO_PORT_FLAGS(n), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_xec_port_init_##n, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_xec_port_init_##n, NULL, \ &gpio_xec_port_data_##n, &xec_gpio_config_##n, \ - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_xec_driver_api); + PRE_KERNEL_1, &gpio_xec_driver_api); DT_INST_FOREACH_STATUS_OKAY(XEC_GPIO_PORT) diff --git a/drivers/gpio/gpio_mcp230xx.c b/drivers/gpio/gpio_mcp230xx.c index d44431ed96c59..9b3d13e5ce7bd 100644 --- a/drivers/gpio/gpio_mcp230xx.c +++ b/drivers/gpio/gpio_mcp230xx.c @@ -98,9 +98,9 @@ static int mcp230xx_bus_is_ready(const struct device *dev) .write_fn = mcp230xx_write_port_regs, \ .bus_fn = mcp230xx_bus_is_ready, \ }; \ - DEVICE_DT_INST_DEFINE(inst, gpio_mcp23xxx_init, NULL, &mcp230xx_##inst##_drvdata, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, gpio_mcp23xxx_init, NULL, &mcp230xx_##inst##_drvdata, \ &mcp230xx_##inst##_config, POST_KERNEL, \ - CONFIG_GPIO_MCP230XX_INIT_PRIORITY, &gpio_mcp23xxx_api_table); + &gpio_mcp23xxx_api_table); #define DT_DRV_COMPAT microchip_mcp23008 DT_INST_FOREACH_STATUS_OKAY_VARGS(GPIO_MCP230XX_DEVICE, 8, false) diff --git a/drivers/gpio/gpio_mcp23sxx.c b/drivers/gpio/gpio_mcp23sxx.c index c0ec7061df933..21b737fe44caf 100644 --- a/drivers/gpio/gpio_mcp23sxx.c +++ b/drivers/gpio/gpio_mcp23sxx.c @@ -138,9 +138,9 @@ static int mcp23sxx_bus_is_ready(const struct device *dev) .write_fn = mcp23sxx_write_port_regs, \ .bus_fn = mcp23sxx_bus_is_ready \ }; \ - DEVICE_DT_INST_DEFINE(inst, gpio_mcp23xxx_init, NULL, &mcp23sxx_##inst##_drvdata, \ - &mcp23sxx_##inst##_config, POST_KERNEL, \ - CONFIG_GPIO_MCP23SXX_INIT_PRIORITY, &gpio_mcp23xxx_api_table); + DEVICE_INSTANCE_FROM_DT_INST(inst, gpio_mcp23xxx_init, NULL, &mcp23sxx_##inst##_drvdata, \ + &mcp23sxx_##inst##_config, POST_KERNEL, \ + &gpio_mcp23xxx_api_table); #define DT_DRV_COMPAT microchip_mcp23s08 diff --git a/drivers/gpio/gpio_mcux.c b/drivers/gpio/gpio_mcux.c index 34ef0bab910b6..ed1377379c5c3 100644 --- a/drivers/gpio/gpio_mcux.c +++ b/drivers/gpio/gpio_mcux.c @@ -431,13 +431,12 @@ static const struct gpio_driver_api gpio_mcux_driver_api = { \ static struct gpio_mcux_data gpio_mcux_port## n ##_data; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ gpio_mcux_port## n ##_init, \ NULL, \ &gpio_mcux_port## n ##_data, \ &gpio_mcux_port## n##_config, \ POST_KERNEL, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_mcux_driver_api); \ \ static int gpio_mcux_port## n ##_init(const struct device *dev) \ diff --git a/drivers/gpio/gpio_mcux_igpio.c b/drivers/gpio/gpio_mcux_igpio.c index 9a04172a49f88..fceafacaac26a 100644 --- a/drivers/gpio/gpio_mcux_igpio.c +++ b/drivers/gpio/gpio_mcux_igpio.c @@ -385,13 +385,12 @@ static const struct gpio_driver_api mcux_igpio_driver_api = { \ static struct mcux_igpio_data mcux_igpio_##n##_data; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ mcux_igpio_##n##_init, \ NULL, \ &mcux_igpio_##n##_data, \ &mcux_igpio_##n##_config, \ POST_KERNEL, \ - CONFIG_GPIO_INIT_PRIORITY, \ &mcux_igpio_driver_api); \ \ static int mcux_igpio_##n##_init(const struct device *dev) \ diff --git a/drivers/gpio/gpio_mcux_lpc.c b/drivers/gpio/gpio_mcux_lpc.c index 7c6550e761723..1370704b9155b 100644 --- a/drivers/gpio/gpio_mcux_lpc.c +++ b/drivers/gpio/gpio_mcux_lpc.c @@ -465,10 +465,9 @@ static const struct gpio_driver_api gpio_mcux_lpc_driver_api = { \ static struct gpio_mcux_lpc_data gpio_mcux_lpc_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, lpc_gpio_init_##n, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, lpc_gpio_init_##n, NULL, \ &gpio_mcux_lpc_data_##n, \ &gpio_mcux_lpc_config_##n, PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_mcux_lpc_driver_api); \ \ static int lpc_gpio_init_##n(const struct device *dev) \ diff --git a/drivers/gpio/gpio_mcux_rgpio.c b/drivers/gpio/gpio_mcux_rgpio.c index 4ad998545e59e..84a4354de58ca 100644 --- a/drivers/gpio/gpio_mcux_rgpio.c +++ b/drivers/gpio/gpio_mcux_rgpio.c @@ -313,14 +313,13 @@ static const struct gpio_driver_api mcux_rgpio_driver_api = { \ static struct mcux_rgpio_data mcux_rgpio_##n##_data; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ mcux_rgpio_##n##_init, \ NULL, \ &mcux_rgpio_##n##_data, \ - &mcux_rgpio_##n##_config, \ + &mcux_rgpio_##n##_config, \ POST_KERNEL, \ - CONFIG_GPIO_INIT_PRIORITY, \ - &mcux_rgpio_driver_api); \ + &mcux_rgpio_driver_api); \ \ static int mcux_rgpio_##n##_init(const struct device *dev) \ { \ diff --git a/drivers/gpio/gpio_nct38xx.c b/drivers/gpio/gpio_nct38xx.c index a4949f1f9bb31..6f2763daa6b0c 100644 --- a/drivers/gpio/gpio_nct38xx.c +++ b/drivers/gpio/gpio_nct38xx.c @@ -124,9 +124,9 @@ static int nct38xx_gpio_init(const struct device *dev) static struct gpio_nct38xx_data gpio_nct38xx_data_##inst = { \ .dev = DEVICE_DT_INST_GET(inst), \ }; \ - DEVICE_DT_INST_DEFINE(inst, nct38xx_gpio_init, NULL, &gpio_nct38xx_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, nct38xx_gpio_init, NULL, &gpio_nct38xx_data_##inst, \ &gpio_nct38xx_cfg_##inst, POST_KERNEL, \ - CONFIG_GPIO_NCT38XX_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(GPIO_NCT38XX_DEVICE_INSTANCE) diff --git a/drivers/gpio/gpio_nct38xx_alert.c b/drivers/gpio/gpio_nct38xx_alert.c index eb52339364a29..182ae3d40b113 100644 --- a/drivers/gpio/gpio_nct38xx_alert.c +++ b/drivers/gpio/gpio_nct38xx_alert.c @@ -173,8 +173,8 @@ BUILD_ASSERT(CONFIG_GPIO_NCT38XX_ALERT_INIT_PRIORITY > CONFIG_GPIO_NCT38XX_INIT_ .alert_dev = DEVICE_DT_INST_GET(inst), \ .mfd = nct38xx_mfd_##inst, \ }; \ - DEVICE_DT_INST_DEFINE(inst, nct38xx_alert_init, NULL, &nct38xx_alert_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, nct38xx_alert_init, NULL, &nct38xx_alert_data_##inst, \ &nct38xx_alert_cfg_##inst, POST_KERNEL, \ - CONFIG_GPIO_NCT38XX_ALERT_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(NCT38XX_ALERT_DEVICE_INSTANCE) diff --git a/drivers/gpio/gpio_nct38xx_port.c b/drivers/gpio/gpio_nct38xx_port.c index 32d70808fcde9..1fd9151241335 100644 --- a/drivers/gpio/gpio_nct38xx_port.c +++ b/drivers/gpio/gpio_nct38xx_port.c @@ -525,8 +525,8 @@ BUILD_ASSERT(CONFIG_GPIO_NCT38XX_PORT_INIT_PRIORITY > CONFIG_GPIO_NCT38XX_INIT_P !(DT_INST_REG_ADDR(inst) == 0 && !(DT_INST_NODE_HAS_PROP(inst, pinmux_mask))), \ "Port 0 should assign pinmux_mask property."); \ static struct gpio_nct38xx_port_data gpio_nct38xx_port_data_##inst; \ - DEVICE_DT_INST_DEFINE(inst, gpio_nct38xx_port_init, NULL, &gpio_nct38xx_port_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, gpio_nct38xx_port_init, NULL, &gpio_nct38xx_port_data_##inst,\ &gpio_nct38xx_port_cfg_##inst, POST_KERNEL, \ - CONFIG_GPIO_NCT38XX_PORT_INIT_PRIORITY, &gpio_nct38xx_driver); + &gpio_nct38xx_driver); DT_INST_FOREACH_STATUS_OKAY(GPIO_NCT38XX_PORT_DEVICE_INSTANCE) diff --git a/drivers/gpio/gpio_neorv32.c b/drivers/gpio/gpio_neorv32.c index 21bd6fe85ef63..cc0184bf22a37 100644 --- a/drivers/gpio/gpio_neorv32.c +++ b/drivers/gpio/gpio_neorv32.c @@ -220,13 +220,12 @@ static const struct gpio_driver_api neorv32_gpio_driver_api = { .output = DT_INST_REG_ADDR_BY_NAME(n, output), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ neorv32_gpio_init, \ NULL, \ &neorv32_gpio_##n##_data, \ &neorv32_gpio_##n##_config, \ PRE_KERNEL_2, \ - CONFIG_GPIO_INIT_PRIORITY, \ &neorv32_gpio_driver_api); DT_INST_FOREACH_STATUS_OKAY(NEORV32_GPIO_INIT) diff --git a/drivers/gpio/gpio_npcx.c b/drivers/gpio/gpio_npcx.c index 08287dd9076d8..12785d66f5354 100644 --- a/drivers/gpio/gpio_npcx.c +++ b/drivers/gpio/gpio_npcx.c @@ -419,13 +419,12 @@ int gpio_npcx_init(const struct device *dev) \ static struct gpio_npcx_data gpio_npcx_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, \ - gpio_npcx_init, \ - NULL, \ - &gpio_npcx_data_##inst, \ - &gpio_npcx_cfg_##inst, \ - PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ + gpio_npcx_init, \ + NULL, \ + &gpio_npcx_data_##inst, \ + &gpio_npcx_cfg_##inst, \ + PRE_KERNEL_1, \ &gpio_npcx_driver); DT_INST_FOREACH_STATUS_OKAY(NPCX_GPIO_DEVICE_INIT) diff --git a/drivers/gpio/gpio_npm1300.c b/drivers/gpio/gpio_npm1300.c index 96725b61ddf3f..b6a9694af459d 100644 --- a/drivers/gpio/gpio_npm1300.c +++ b/drivers/gpio/gpio_npm1300.c @@ -222,8 +222,8 @@ static int gpio_npm1300_init(const struct device *dev) \ static struct gpio_npm1300_data gpio_npm1300_data##n; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_npm1300_init, NULL, &gpio_npm1300_data##n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_npm1300_init, NULL, &gpio_npm1300_data##n, \ &gpio_npm1300_config##n, POST_KERNEL, \ - CONFIG_GPIO_NPM1300_INIT_PRIORITY, &gpio_npm1300_api); + &gpio_npm1300_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_NPM1300_DEFINE) diff --git a/drivers/gpio/gpio_npm6001.c b/drivers/gpio/gpio_npm6001.c index b69df1f369ae2..6931d40d612b3 100644 --- a/drivers/gpio/gpio_npm6001.c +++ b/drivers/gpio/gpio_npm6001.c @@ -223,9 +223,8 @@ static int gpio_npm6001_init(const struct device *dev) \ static struct gpio_npm6001_data gpio_npm6001_data##n; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_npm6001_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_npm6001_init, NULL, \ &gpio_npm6001_data##n, &gpio_npm6001_config##n, \ - POST_KERNEL, CONFIG_GPIO_NPM6001_INIT_PRIORITY, \ - &gpio_npm6001_api); + POST_KERNEL, &gpio_npm6001_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_NPM6001_DEFINE) diff --git a/drivers/gpio/gpio_nrfx.c b/drivers/gpio/gpio_nrfx.c index ebf776450c317..951f8a60ae17f 100644 --- a/drivers/gpio/gpio_nrfx.c +++ b/drivers/gpio/gpio_nrfx.c @@ -565,12 +565,11 @@ static const struct gpio_driver_api gpio_nrfx_drv_api_funcs = { \ static struct gpio_nrfx_data gpio_nrfx_p##id##_data; \ \ - DEVICE_DT_INST_DEFINE(id, gpio_nrfx_init, \ + DEVICE_INSTANCE_FROM_DT_INST(id, gpio_nrfx_init, \ NULL, \ &gpio_nrfx_p##id##_data, \ &gpio_nrfx_p##id##_cfg, \ PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_nrfx_drv_api_funcs); DT_INST_FOREACH_STATUS_OKAY(GPIO_NRF_DEVICE) diff --git a/drivers/gpio/gpio_numaker.c b/drivers/gpio/gpio_numaker.c index a4fe054221782..d728c9fed8b2e 100644 --- a/drivers/gpio/gpio_numaker.c +++ b/drivers/gpio/gpio_numaker.c @@ -265,8 +265,7 @@ static void gpio_numaker_isr(const struct device *dev) SYS_LockReg(); \ return err; \ } \ - DEVICE_DT_INST_DEFINE(n, gpio_numaker_init##n, NULL, &gpio_numaker_data##n, \ - &gpio_numaker_config##n, PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_numaker_api); + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_numaker_init##n, NULL, &gpio_numaker_data##n, \ + &gpio_numaker_config##n, PRE_KERNEL_1, &gpio_numaker_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_NUMAKER_DEFINE) diff --git a/drivers/gpio/gpio_numicro.c b/drivers/gpio/gpio_numicro.c index e97eefd6b8ddb..3bb89ac8284ae 100644 --- a/drivers/gpio/gpio_numicro.c +++ b/drivers/gpio/gpio_numicro.c @@ -268,13 +268,12 @@ static const struct gpio_driver_api gpio_numicro_driver_api = { .regs = (GPIO_T *)DT_INST_REG_ADDR(n), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ gpio_numicro_port##n##_init, \ NULL, \ &gpio_numicro_port##n##_data, \ &gpio_numicro_port##n##_config, \ PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_numicro_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_NUMICRO_INIT) diff --git a/drivers/gpio/gpio_nxp_s32.c b/drivers/gpio/gpio_nxp_s32.c index 5e9e7a5547121..04d262a01802c 100644 --- a/drivers/gpio/gpio_nxp_s32.c +++ b/drivers/gpio/gpio_nxp_s32.c @@ -584,13 +584,12 @@ static const struct gpio_driver_api gpio_nxp_s32_driver_api = { { \ return 0; \ } \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ gpio_nxp_s32_init_##n, \ NULL, \ &gpio_nxp_s32_data_##n, \ &gpio_nxp_s32_config_##n, \ POST_KERNEL, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_nxp_s32_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_NXP_S32_DEVICE_INIT) diff --git a/drivers/gpio/gpio_pca953x.c b/drivers/gpio/gpio_pca953x.c index 81898e83382b4..9263221860358 100644 --- a/drivers/gpio/gpio_pca953x.c +++ b/drivers/gpio/gpio_pca953x.c @@ -495,13 +495,12 @@ static const struct gpio_driver_api api_table = { .pin_state.dir = ALL_PINS, \ .pin_state.output = ALL_PINS, \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ gpio_pca953x_init, \ NULL, \ &pca953x_drvdata_##n, \ &pca953x_cfg_##n, \ POST_KERNEL, \ - CONFIG_GPIO_PCA953X_INIT_PRIORITY, \ &api_table); #define DT_DRV_COMPAT ti_tca9538 diff --git a/drivers/gpio/gpio_pca95xx.c b/drivers/gpio/gpio_pca95xx.c index 2cfffe7e198f2..db737ff5bde75 100644 --- a/drivers/gpio/gpio_pca95xx.c +++ b/drivers/gpio/gpio_pca95xx.c @@ -866,12 +866,11 @@ static struct gpio_pca95xx_drv_data gpio_pca95xx_##inst##_drvdata = { \ )) \ }; \ \ -DEVICE_DT_INST_DEFINE(inst, \ +DEVICE_INSTANCE_FROM_DT_INST(inst, \ gpio_pca95xx_init, \ NULL, \ &gpio_pca95xx_##inst##_drvdata, \ &gpio_pca95xx_##inst##_cfg, \ - POST_KERNEL, CONFIG_GPIO_PCA95XX_INIT_PRIORITY, \ - &gpio_pca95xx_drv_api_funcs); + POST_KERNEL, &gpio_pca95xx_drv_api_funcs); DT_INST_FOREACH_STATUS_OKAY(GPIO_PCA95XX_DEVICE_INSTANCE) diff --git a/drivers/gpio/gpio_pca_series.c b/drivers/gpio/gpio_pca_series.c index 6d7744e4eb2a7..e2e71adea8737 100644 --- a/drivers/gpio/gpio_pca_series.c +++ b/drivers/gpio/gpio_pca_series.c @@ -2205,10 +2205,9 @@ const struct gpio_pca_series_part_config gpio_pca_series_part_cfg_pcal6534 = { .lock = Z_SEM_INITIALIZER(gpio_##part_no##_##inst##_data.lock, 1, 1), \ .cache = (void *)gpio_##part_no##_##inst##_reg_cache, \ }; \ - DEVICE_DT_INST_DEFINE(inst, gpio_pca_series_init, NULL, \ - &gpio_##part_no##_##inst##_data, \ - &gpio_##part_no##_##inst##_cfg, POST_KERNEL, \ - CONFIG_GPIO_PCA_SERIES_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, gpio_pca_series_init, NULL,\ + &gpio_##part_no##_##inst##_data, \ + &gpio_##part_no##_##inst##_cfg, POST_KERNEL, \ GPIO_PCA_GET_API_BY_PART_NO(part_no)); diff --git a/drivers/gpio/gpio_pcal64xxa.c b/drivers/gpio/gpio_pcal64xxa.c index b9b5a8383e359..3f50a880a3103 100644 --- a/drivers/gpio/gpio_pcal64xxa.c +++ b/drivers/gpio/gpio_pcal64xxa.c @@ -1125,9 +1125,9 @@ int pcal64xxa_init(const struct device *dev) .work = Z_WORK_INITIALIZER(pcal64xxa_work_handler), \ .dev = DEVICE_DT_INST_GET(idx), \ }; \ - DEVICE_DT_INST_DEFINE(idx, pcal64xxa_init, NULL, &pcal6408a_data##idx, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, pcal64xxa_init, NULL, &pcal6408a_data##idx, \ &pcal6408a_cfg##idx, POST_KERNEL, \ - CONFIG_GPIO_PCAL64XXA_INIT_PRIORITY, &pcal6408a_drv_api##idx); + &pcal6408a_drv_api##idx); #define DT_DRV_COMPAT nxp_pcal6408a DT_INST_FOREACH_STATUS_OKAY(GPIO_PCAL6408A_INST) @@ -1159,9 +1159,9 @@ DT_INST_FOREACH_STATUS_OKAY(GPIO_PCAL6408A_INST) .work = Z_WORK_INITIALIZER(pcal64xxa_work_handler), \ .dev = DEVICE_DT_INST_GET(idx), \ }; \ - DEVICE_DT_INST_DEFINE(idx, pcal64xxa_init, NULL, &pcal6416a_data##idx, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, pcal64xxa_init, NULL, &pcal6416a_data##idx, \ &pcal6416a_cfg##idx, POST_KERNEL, \ - CONFIG_GPIO_PCAL64XXA_INIT_PRIORITY, &pcal6416a_drv_api##idx); + &pcal6416a_drv_api##idx); #undef DT_DRV_COMPAT #define DT_DRV_COMPAT nxp_pcal6416a diff --git a/drivers/gpio/gpio_pcf857x.c b/drivers/gpio/gpio_pcf857x.c index c30e1a5d36d02..bfc4cba1ad31d 100644 --- a/drivers/gpio/gpio_pcf857x.c +++ b/drivers/gpio/gpio_pcf857x.c @@ -402,7 +402,7 @@ static const struct gpio_driver_api pcf857x_drv_api = { .dev = DEVICE_DT_INST_GET(idx), \ .num_bytes = DT_INST_ENUM_IDX(idx, ngpios) + 1, \ }; \ - DEVICE_DT_INST_DEFINE(idx, pcf857x_init, NULL, &pcf857x_data##idx, &pcf857x_cfg##idx, \ - POST_KERNEL, CONFIG_GPIO_PCF857X_INIT_PRIORITY, &pcf857x_drv_api); + DEVICE_INSTANCE_FROM_DT_INST(idx, pcf857x_init, NULL, &pcf857x_data##idx, &pcf857x_cfg##idx,\ + POST_KERNEL, &pcf857x_drv_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_PCF857X_INST); diff --git a/drivers/gpio/gpio_psoc6.c b/drivers/gpio/gpio_psoc6.c index 0e56bf7641d38..283f5ab7c8425 100644 --- a/drivers/gpio/gpio_psoc6.c +++ b/drivers/gpio/gpio_psoc6.c @@ -263,10 +263,9 @@ int gpio_psoc6_init(const struct device *dev) \ static struct gpio_psoc6_runtime port_##n##_psoc6_runtime = { 0 }; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_psoc6_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_psoc6_init, NULL, \ &port_##n##_psoc6_runtime, \ &port_##n##_psoc6_config, PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_psoc6_api); \ \ static void port_##n##_psoc6_config_func(const struct device *dev) \ diff --git a/drivers/gpio/gpio_rcar.c b/drivers/gpio/gpio_rcar.c index f60112427bc80..e0ce22cbb7323 100644 --- a/drivers/gpio/gpio_rcar.c +++ b/drivers/gpio/gpio_rcar.c @@ -305,15 +305,13 @@ static const struct gpio_driver_api gpio_rcar_driver_api = { }; \ static struct gpio_rcar_data gpio_rcar_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ gpio_rcar_init, \ NULL, \ &gpio_rcar_data_##n, \ &gpio_rcar_cfg_##n, \ PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_rcar_driver_api \ - ); \ + &gpio_rcar_driver_api); \ static void gpio_rcar_##n##_init(const struct device *dev) \ { \ IRQ_CONNECT(DT_INST_IRQN(n), \ diff --git a/drivers/gpio/gpio_renesas_ra.c b/drivers/gpio/gpio_renesas_ra.c index 8da6f593e667c..f9b49f2d6db6c 100644 --- a/drivers/gpio/gpio_renesas_ra.c +++ b/drivers/gpio/gpio_renesas_ra.c @@ -429,7 +429,7 @@ static const struct gpio_driver_api gpio_ra_driver_api = { .irq_info_size = ARRAY_SIZE(gpio_ra_irq_info_##idx), \ }; \ \ - DEVICE_DT_INST_DEFINE(idx, NULL, NULL, &gpio_ra_data_##idx, &gpio_ra_config_##idx, \ - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, &gpio_ra_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(idx, NULL, NULL, &gpio_ra_data_##idx, &gpio_ra_config_##idx, \ + PRE_KERNEL_1, &gpio_ra_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_RA_INIT) diff --git a/drivers/gpio/gpio_renesas_ra_ioport.c b/drivers/gpio/gpio_renesas_ra_ioport.c index 65fc946438a22..6888984c10d9c 100644 --- a/drivers/gpio/gpio_renesas_ra_ioport.c +++ b/drivers/gpio/gpio_renesas_ra_ioport.c @@ -167,8 +167,8 @@ static const struct gpio_driver_api gpio_ra_drv_api_funcs = { .vbatt_pins = DT_PROP_OR(DT_NODELABEL(ioport##suffix), vbatts_pins, {0xFF}), \ }; \ static struct gpio_ra_data gpio_ra_data_##suffix; \ - DEVICE_DT_DEFINE(node, NULL, NULL, &gpio_ra_data_##suffix, &gpio_ra_config_##suffix, \ - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, &gpio_ra_drv_api_funcs) + DEVICE_INSTANCE(node, NULL, NULL, &gpio_ra_data_##suffix, &gpio_ra_config_##suffix, \ + PRE_KERNEL_1, &gpio_ra_drv_api_funcs) #define GPIO_DEVICE_INIT_RA(suffix) \ GPIO_DEVICE_INIT(DT_NODELABEL(ioport##suffix), \ diff --git a/drivers/gpio/gpio_rpi_pico.c b/drivers/gpio/gpio_rpi_pico.c index 4c5ce08a8fa7c..f43168c00ecd9 100644 --- a/drivers/gpio/gpio_rpi_pico.c +++ b/drivers/gpio/gpio_rpi_pico.c @@ -233,10 +233,9 @@ static int gpio_rpi_bank_init(const struct device *dev) \ static struct gpio_rpi_data gpio_rpi_##idx##_data; \ \ - DEVICE_DT_INST_DEFINE(idx, gpio_rpi_bank_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, gpio_rpi_bank_init, NULL, \ &gpio_rpi_##idx##_data, \ &gpio_rpi_##idx##_config, \ - POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_rpi_driver_api); + POST_KERNEL, &gpio_rpi_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_RPI_INIT) diff --git a/drivers/gpio/gpio_rt1718s.c b/drivers/gpio/gpio_rt1718s.c index a448daddbde1d..af20cabbf6291 100644 --- a/drivers/gpio/gpio_rt1718s.c +++ b/drivers/gpio/gpio_rt1718s.c @@ -138,7 +138,7 @@ static int rt1718s_init(const struct device *dev) static struct rt1718s_data rt1718s_data_##inst = { \ .dev = DEVICE_DT_INST_GET(inst), \ }; \ - DEVICE_DT_INST_DEFINE(inst, rt1718s_init, NULL, &rt1718s_data_##inst, &rt1718s_cfg_##inst, \ - POST_KERNEL, CONFIG_RT1718S_INIT_PRIORITY, NULL); + DEVICE_INSTANCE_FROM_DT_INST(inst, rt1718s_init, NULL, &rt1718s_data_##inst, &rt1718s_cfg_##inst,\ + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(GPIO_RT1718S_DEVICE_INSTANCE) diff --git a/drivers/gpio/gpio_rt1718s_port.c b/drivers/gpio/gpio_rt1718s_port.c index 24b9e0bf742fc..85a259c8a76f9 100644 --- a/drivers/gpio/gpio_rt1718s_port.c +++ b/drivers/gpio/gpio_rt1718s_port.c @@ -373,8 +373,8 @@ BUILD_ASSERT(CONFIG_GPIO_RT1718S_PORT_INIT_PRIORITY > CONFIG_RT1718S_INIT_PRIORI .rt1718s_dev = DEVICE_DT_GET(DT_INST_PARENT(inst)), \ }; \ static struct gpio_rt1718s_port_data gpio_rt1718s_port_data_##inst; \ - DEVICE_DT_INST_DEFINE(inst, gpio_rt1718s_port_init, NULL, &gpio_rt1718s_port_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, gpio_rt1718s_port_init, NULL, &gpio_rt1718s_port_data_##inst,\ &gpio_rt1718s_port_cfg_##inst, POST_KERNEL, \ - CONFIG_GPIO_RT1718S_PORT_INIT_PRIORITY, &gpio_rt1718s_driver); + &gpio_rt1718s_driver); DT_INST_FOREACH_STATUS_OKAY(GPIO_RT1718S_PORT_DEVICE_INSTANCE) diff --git a/drivers/gpio/gpio_rv32m1.c b/drivers/gpio/gpio_rv32m1.c index 5a27f278a5ca4..d21bf802a96d3 100644 --- a/drivers/gpio/gpio_rv32m1.c +++ b/drivers/gpio/gpio_rv32m1.c @@ -322,13 +322,12 @@ static const struct gpio_driver_api gpio_rv32m1_driver_api = { \ static struct gpio_rv32m1_data gpio_rv32m1_##n##_data; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ gpio_rv32m1_init, \ NULL, \ &gpio_rv32m1_##n##_data, \ &gpio_rv32m1_##n##_config, \ PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_rv32m1_driver_api); \ \ static int gpio_rv32m1_##n##_init(const struct device *dev) \ diff --git a/drivers/gpio/gpio_rzt2m.c b/drivers/gpio/gpio_rzt2m.c index 74da6abab0765..9fe065338cdc2 100644 --- a/drivers/gpio/gpio_rzt2m.c +++ b/drivers/gpio/gpio_rzt2m.c @@ -426,11 +426,11 @@ static int rzt2m_gpio_common_init(const struct device *dev) return 0; } -DEVICE_DT_DEFINE(DT_INST(0, renesas_rzt2m_gpio_common), +DEVICE_INSTANCE(DT_INST(0, renesas_rzt2m_gpio_common), rzt2m_gpio_common_init, NULL, &rzt2m_gpio_common_data_inst, NULL, - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, + PRE_KERNEL_1, NULL); #define VALUE_2X(i, _) UTIL_X2(i) @@ -453,8 +453,7 @@ DEVICE_DT_DEFINE(DT_INST(0, renesas_rzt2m_gpio_common), .port = DT_INST_REG_ADDR(inst), \ .pin_irqs = {PORT_IRQS_INITIALIZER(inst)}, \ .common = {.port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(inst)}}; \ - DEVICE_DT_INST_DEFINE(inst, rzt2m_gpio_init, NULL, &rzt2m_gpio_data##inst, \ - &rzt2m_gpio_config##inst, PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, \ - &rzt2m_gpio_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, rzt2m_gpio_init, NULL, &rzt2m_gpio_data##inst, \ + &rzt2m_gpio_config##inst, PRE_KERNEL_1, &rzt2m_gpio_driver_api); DT_INST_FOREACH_STATUS_OKAY(RZT2M_GPIO_DEFINE) diff --git a/drivers/gpio/gpio_sam.c b/drivers/gpio/gpio_sam.c index b01c6cc5e584d..6f723c69bd4c8 100644 --- a/drivers/gpio/gpio_sam.c +++ b/drivers/gpio/gpio_sam.c @@ -331,10 +331,9 @@ int gpio_sam_init(const struct device *dev) \ static struct gpio_sam_runtime port_##n##_sam_runtime; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_sam_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_sam_init, NULL, \ &port_##n##_sam_runtime, \ &port_##n##_sam_config, PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_sam_api); \ \ static void port_##n##_sam_config_func(const struct device *dev) \ diff --git a/drivers/gpio/gpio_sam0.c b/drivers/gpio/gpio_sam0.c index 98234d3319d82..cb28b301506f1 100644 --- a/drivers/gpio/gpio_sam0.c +++ b/drivers/gpio/gpio_sam0.c @@ -300,11 +300,10 @@ static const struct gpio_sam0_config gpio_sam0_config_0 = { static struct gpio_sam0_data gpio_sam0_data_0; -DEVICE_DT_DEFINE(DT_NODELABEL(porta), +DEVICE_INSTANCE(DT_NODELABEL(porta), gpio_sam0_init, NULL, &gpio_sam0_data_0, &gpio_sam0_config_0, - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, - &gpio_sam0_api); + PRE_KERNEL_1, &gpio_sam0_api); #endif /* Port B */ @@ -322,11 +321,10 @@ static const struct gpio_sam0_config gpio_sam0_config_1 = { static struct gpio_sam0_data gpio_sam0_data_1; -DEVICE_DT_DEFINE(DT_NODELABEL(portb), +DEVICE_INSTANCE(DT_NODELABEL(portb), gpio_sam0_init, NULL, &gpio_sam0_data_1, &gpio_sam0_config_1, - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, - &gpio_sam0_api); + PRE_KERNEL_1, &gpio_sam0_api); #endif /* Port C */ @@ -344,11 +342,10 @@ static const struct gpio_sam0_config gpio_sam0_config_2 = { static struct gpio_sam0_data gpio_sam0_data_2; -DEVICE_DT_DEFINE(DT_NODELABEL(portc), +DEVICE_INSTANCE(DT_NODELABEL(portc), gpio_sam0_init, NULL, &gpio_sam0_data_2, &gpio_sam0_config_2, - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, - &gpio_sam0_api); + PRE_KERNEL_1, &gpio_sam0_api); #endif /* Port D */ @@ -366,9 +363,8 @@ static const struct gpio_sam0_config gpio_sam0_config_3 = { static struct gpio_sam0_data gpio_sam0_data_3; -DEVICE_DT_DEFINE(DT_NODELABEL(portd), +DEVICE_INSTANCE(DT_NODELABEL(portd), gpio_sam0_init, NULL, &gpio_sam0_data_3, &gpio_sam0_config_3, - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, - &gpio_sam0_api); + PRE_KERNEL_1, &gpio_sam0_api); #endif diff --git a/drivers/gpio/gpio_sam4l.c b/drivers/gpio/gpio_sam4l.c index 637e6aa82fb62..cabba6b0124a0 100644 --- a/drivers/gpio/gpio_sam4l.c +++ b/drivers/gpio/gpio_sam4l.c @@ -264,10 +264,9 @@ int gpio_sam_init(const struct device *dev) \ static struct gpio_sam_runtime port_##n##_sam_runtime; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_sam_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_sam_init, NULL, \ &port_##n##_sam_runtime, \ &port_##n##_sam_config, PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_sam_api); \ \ static void port_##n##_sam_config_func(const struct device *dev)\ diff --git a/drivers/gpio/gpio_sc18im704.c b/drivers/gpio/gpio_sc18im704.c index c45e9d51a6007..b918d55006abb 100644 --- a/drivers/gpio/gpio_sc18im704.c +++ b/drivers/gpio/gpio_sc18im704.c @@ -281,9 +281,8 @@ static const struct gpio_driver_api gpio_sc18im_driver_api = { .conf2 = GPIO_SC18IM_DEFAULT_CONF, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, gpio_sc18im_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_sc18im_init, NULL, \ &gpio_sc18im_data_##n, &gpio_sc18im_config_##n, \ - POST_KERNEL, CONFIG_GPIO_SC18IM704_INIT_PRIORITY, \ - &gpio_sc18im_driver_api); + POST_KERNEL, &gpio_sc18im_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_SC18IM704_DEFINE); diff --git a/drivers/gpio/gpio_sedi.c b/drivers/gpio/gpio_sedi.c index d4d273d6d6d8a..05511a02b67e0 100644 --- a/drivers/gpio/gpio_sedi.c +++ b/drivers/gpio/gpio_sedi.c @@ -330,13 +330,12 @@ static int gpio_sedi_init(const struct device *dev) .irq_config = gpio_sedi_irq_config_##n, \ }; \ PM_DEVICE_DEFINE(gpio_##n, gpio_sedi_pm_action); \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ gpio_sedi_init, \ - PM_DEVICE_GET(gpio_##n), \ - &gpio##n##_data, \ + PM_DEVICE_GET(gpio_##n), \ + &gpio##n##_data, \ &gpio##n##_config, \ POST_KERNEL, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_sedi_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_DEVICE_INIT_SEDI) diff --git a/drivers/gpio/gpio_si32.c b/drivers/gpio/gpio_si32.c index 4f11fd1c0caa9..a90e45c6893cc 100644 --- a/drivers/gpio/gpio_si32.c +++ b/drivers/gpio/gpio_si32.c @@ -191,9 +191,8 @@ static int gpio_si32_init(const struct device *dev) .disable_pullups = DT_INST_PROP(inst, disable_pullups), \ }; \ static struct gpio_si32_data gpio_si32_data_##inst; \ - DEVICE_DT_INST_DEFINE(inst, gpio_si32_init, NULL, &gpio_si32_data_##inst, \ - &gpio_si32_cfg_##inst, PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_si32_driver); + DEVICE_INSTANCE_FROM_DT_INST(inst, gpio_si32_init, NULL, &gpio_si32_data_##inst, \ + &gpio_si32_cfg_##inst, PRE_KERNEL_1, &gpio_si32_driver); DT_INST_FOREACH_STATUS_OKAY(GPIO_DEVICE_INIT) diff --git a/drivers/gpio/gpio_sifive.c b/drivers/gpio/gpio_sifive.c index 7e56b9dba3e47..157b7027ddb1a 100644 --- a/drivers/gpio/gpio_sifive.c +++ b/drivers/gpio/gpio_sifive.c @@ -365,12 +365,11 @@ static const struct gpio_sifive_config gpio_sifive_config0 = { static struct gpio_sifive_data gpio_sifive_data0; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, gpio_sifive_init, NULL, &gpio_sifive_data0, &gpio_sifive_config0, - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, - &gpio_sifive_driver); + PRE_KERNEL_1, &gpio_sifive_driver); #define IRQ_INIT(n) \ IRQ_CONNECT(DT_INST_IRQN_BY_IDX(0, n), \ diff --git a/drivers/gpio/gpio_smartbond.c b/drivers/gpio/gpio_smartbond.c index 0081989a0499e..e22beda568996 100644 --- a/drivers/gpio/gpio_smartbond.c +++ b/drivers/gpio/gpio_smartbond.c @@ -431,12 +431,11 @@ static const struct gpio_driver_api gpio_smartbond_drv_api_funcs = { } \ \ PM_DEVICE_DEFINE(id, gpio_smartbond_pm_action); \ - DEVICE_DT_INST_DEFINE(id, gpio_smartbond_init_##id, \ + DEVICE_INSTANCE_FROM_DT_INST(id, gpio_smartbond_init_##id, \ PM_DEVICE_GET(id), \ &gpio_smartbond_data_##id, \ &gpio_smartbond_config_##id, \ PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_smartbond_drv_api_funcs); DT_INST_FOREACH_STATUS_OKAY(GPIO_SMARTBOND_DEVICE) diff --git a/drivers/gpio/gpio_sn74hc595.c b/drivers/gpio/gpio_sn74hc595.c index 16eb35bb690c0..7d02e365cd1aa 100644 --- a/drivers/gpio/gpio_sn74hc595.c +++ b/drivers/gpio/gpio_sn74hc595.c @@ -193,8 +193,8 @@ static int gpio_sn74hc595_init(const struct device *dev) .reset_gpio = GPIO_DT_SPEC_INST_GET(n, reset_gpios), \ }; \ \ - DEVICE_DT_DEFINE(DT_DRV_INST(n), &gpio_sn74hc595_init, NULL, \ + DEVICE_INSTANCE(DT_DRV_INST(n), &gpio_sn74hc595_init, NULL, \ &sn74hc595_data_##n, &sn74hc595_config_##n, POST_KERNEL, \ - CONFIG_GPIO_SN74HC595_INIT_PRIORITY, &gpio_sn74hc595_drv_api_funcs); + &gpio_sn74hc595_drv_api_funcs); DT_INST_FOREACH_STATUS_OKAY(SN74HC595_INIT) diff --git a/drivers/gpio/gpio_stellaris.c b/drivers/gpio/gpio_stellaris.c index e7114fa0e7f1d..c7c05d9be697d 100644 --- a/drivers/gpio/gpio_stellaris.c +++ b/drivers/gpio/gpio_stellaris.c @@ -275,13 +275,12 @@ static const struct gpio_driver_api gpio_stellaris_driver_api = { .config_func = port_## n ##_stellaris_config_func, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ gpio_stellaris_init, \ NULL, \ &port_## n ##_stellaris_runtime, \ &gpio_stellaris_port_## n ##_config, \ - POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_stellaris_driver_api); \ + POST_KERNEL, &gpio_stellaris_driver_api); \ \ static void port_## n ##_stellaris_config_func(const struct device *dev) \ { \ diff --git a/drivers/gpio/gpio_stm32.c b/drivers/gpio/gpio_stm32.c index d341612aaac66..5a66f4aa1816a 100644 --- a/drivers/gpio/gpio_stm32.c +++ b/drivers/gpio/gpio_stm32.c @@ -734,13 +734,12 @@ static int gpio_stm32_init(const struct device *dev) }; \ static struct gpio_stm32_data gpio_stm32_data_## __suffix; \ PM_DEVICE_DT_DEFINE(__node, gpio_stm32_pm_action); \ - DEVICE_DT_DEFINE(__node, \ + DEVICE_INSTANCE(__node, \ gpio_stm32_init, \ PM_DEVICE_DT_GET(__node), \ &gpio_stm32_data_## __suffix, \ &gpio_stm32_cfg_## __suffix, \ PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, \ &gpio_stm32_driver) #define GPIO_DEVICE_INIT_STM32(__suffix, __SUFFIX) \ diff --git a/drivers/gpio/gpio_stmpe1600.c b/drivers/gpio/gpio_stmpe1600.c index 2331fdf9fed4d..0412d98a1daa0 100644 --- a/drivers/gpio/gpio_stmpe1600.c +++ b/drivers/gpio/gpio_stmpe1600.c @@ -302,11 +302,10 @@ static const struct gpio_driver_api stmpe1600_drv_api = { \ static struct stmpe1600_drvdata stmpe1600_##inst##_drvdata; \ \ - DEVICE_DT_INST_DEFINE(inst, stmpe1600_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, stmpe1600_init, NULL, \ &stmpe1600_##inst##_drvdata, \ &stmpe1600_##inst##_config, \ POST_KERNEL, \ - CONFIG_GPIO_STMPE1600_INIT_PRIORITY, \ &stmpe1600_drv_api); DT_INST_FOREACH_STATUS_OKAY(STMPE1600_INIT) diff --git a/drivers/gpio/gpio_sx1509b.c b/drivers/gpio/gpio_sx1509b.c index b8ecdf4d772be..4ee4335176a30 100644 --- a/drivers/gpio/gpio_sx1509b.c +++ b/drivers/gpio/gpio_sx1509b.c @@ -733,8 +733,8 @@ int sx1509b_led_intensity_pin_set(const struct device *dev, gpio_pin_t pin, .lock = Z_SEM_INITIALIZER(sx1509b_drvdata##inst.lock, 1, 1), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, sx1509b_init, NULL, &sx1509b_drvdata##inst,\ + DEVICE_INSTANCE_FROM_DT_INST(inst, sx1509b_init, NULL, &sx1509b_drvdata##inst,\ &sx1509b_cfg##inst, POST_KERNEL, \ - CONFIG_GPIO_SX1509B_INIT_PRIORITY, &api_table); + &api_table); DT_INST_FOREACH_STATUS_OKAY(GPIO_SX1509B_DEFINE) diff --git a/drivers/gpio/gpio_tca6424a.c b/drivers/gpio/gpio_tca6424a.c index 0ce59bd38f0e2..e1c35fda60f80 100644 --- a/drivers/gpio/gpio_tca6424a.c +++ b/drivers/gpio/gpio_tca6424a.c @@ -570,7 +570,7 @@ static int tca6424a_init(const struct device *dev) .work = Z_WORK_INITIALIZER(tca6424a_work_handler), \ .dev = DEVICE_DT_INST_GET(idx), \ }; \ - DEVICE_DT_INST_DEFINE(idx, tca6424a_init, NULL, &tca6424a_data##idx, &tca6424a_cfg##idx, \ - POST_KERNEL, CONFIG_GPIO_TCA6424A_INIT_PRIORITY, &tca6424a_drv_api); + DEVICE_INSTANCE_FROM_DT_INST(idx, tca6424a_init, NULL, &tca6424a_data##idx, &tca6424a_cfg##idx,\ + POST_KERNEL, &tca6424a_drv_api); DT_INST_FOREACH_STATUS_OKAY(TCA6424A_INST) diff --git a/drivers/gpio/gpio_test.c b/drivers/gpio/gpio_test.c index 3befab37fc233..cc00f2f55d510 100644 --- a/drivers/gpio/gpio_test.c +++ b/drivers/gpio/gpio_test.c @@ -81,9 +81,8 @@ static const struct gpio_driver_api vnd_gpio_api = { \ static struct vnd_gpio_data vnd_gpio_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, &vnd_gpio_data_##n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, &vnd_gpio_data_##n, \ &vnd_gpio_config_##n, POST_KERNEL, \ - CONFIG_GPIO_INIT_PRIORITY, \ &vnd_gpio_api); DT_INST_FOREACH_STATUS_OKAY(VND_GPIO_INIT) diff --git a/drivers/gpio/gpio_tle9104.c b/drivers/gpio/gpio_tle9104.c index 1bbead5281b08..2387b6d6e144b 100644 --- a/drivers/gpio/gpio_tle9104.c +++ b/drivers/gpio/gpio_tle9104.c @@ -239,8 +239,8 @@ static int tle9104_gpio_init(const struct device *dev) static struct tle9104_gpio_data tle9104_gpio_##inst##_drvdata; \ \ /* This has to be initialized after the SPI peripheral. */ \ - DEVICE_DT_INST_DEFINE(inst, tle9104_gpio_init, NULL, &tle9104_gpio_##inst##_drvdata, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, tle9104_gpio_init, NULL, &tle9104_gpio_##inst##_drvdata,\ &tle9104_gpio_##inst##_config, POST_KERNEL, \ - CONFIG_GPIO_TLE9104_INIT_PRIORITY, &api_table); + &api_table); DT_INST_FOREACH_STATUS_OKAY(TLE9104_GPIO_INIT) diff --git a/drivers/gpio/gpio_xlnx_axi.c b/drivers/gpio/gpio_xlnx_axi.c index 3b1238310f998..229bbe5debe0f 100644 --- a/drivers/gpio/gpio_xlnx_axi.c +++ b/drivers/gpio/gpio_xlnx_axi.c @@ -407,9 +407,9 @@ static const struct gpio_driver_api gpio_xlnx_axi_driver_api = { .all_outputs = DT_INST_PROP_OR(n, xlnx_all_outputs_2, 0), \ .interrupts_available = DT_INST_NODE_HAS_PROP(n, interrupts)}; \ \ - DEVICE_DT_DEFINE(DT_INST_CHILD(n, gpio2), &gpio_xlnx_axi_init, NULL, \ + DEVICE_INSTANCE(DT_INST_CHILD(n, gpio2), &gpio_xlnx_axi_init, NULL, \ &gpio_xlnx_axi_##n##_2_data, &gpio_xlnx_axi_##n##_2_config, PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, &gpio_xlnx_axi_driver_api); + &gpio_xlnx_axi_driver_api); #define GPIO_XLNX_AXI_INIT(n) \ IF_ENABLED(DT_INST_NODE_HAS_PROP(n, interrupts), \ @@ -450,8 +450,8 @@ static const struct gpio_driver_api gpio_xlnx_axi_driver_api = { irq_enable(DT_INST_IRQN(n)); \ })) \ \ - DEVICE_DT_INST_DEFINE(n, gpio_xlnx_axi_init, NULL, &gpio_xlnx_axi_##n##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_xlnx_axi_init, NULL, &gpio_xlnx_axi_##n##_data, \ &gpio_xlnx_axi_##n##_config, PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, &gpio_xlnx_axi_driver_api); + &gpio_xlnx_axi_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_XLNX_AXI_INIT) diff --git a/drivers/gpio/gpio_xlnx_ps.c b/drivers/gpio/gpio_xlnx_ps.c index 4f7d77aecc76f..e2bb6a7448d7f 100644 --- a/drivers/gpio/gpio_xlnx_ps.c +++ b/drivers/gpio/gpio_xlnx_ps.c @@ -127,9 +127,9 @@ static void gpio_xlnx_ps##idx##_irq_config(const struct device *dev)\ /* Device definition macro */ #define GPIO_XLNX_PS_DEV_DEFINE(idx)\ -DEVICE_DT_INST_DEFINE(idx, gpio_xlnx_ps_init, NULL,\ +DEVICE_INSTANCE_FROM_DT_INST(idx, gpio_xlnx_ps_init, NULL,\ &gpio_xlnx_ps##idx##_data, &gpio_xlnx_ps##idx##_cfg,\ - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, &gpio_xlnx_ps_default_apis); + PRE_KERNEL_1, &gpio_xlnx_ps_default_apis); /* * Top-level device initialization macro, executed for each PS GPIO diff --git a/drivers/gpio/gpio_xlnx_ps_bank.c b/drivers/gpio/gpio_xlnx_ps_bank.c index a20fc0923b7cc..ea813fc59a6a5 100644 --- a/drivers/gpio/gpio_xlnx_ps_bank.c +++ b/drivers/gpio/gpio_xlnx_ps_bank.c @@ -440,9 +440,9 @@ static const struct gpio_xlnx_ps_bank_dev_cfg gpio_xlnx_ps_bank##idx##_cfg = {\ .bank_index = idx,\ };\ static struct gpio_xlnx_ps_bank_dev_data gpio_xlnx_ps_bank##idx##_data;\ -DEVICE_DT_INST_DEFINE(idx, gpio_xlnx_ps_bank_init, NULL,\ +DEVICE_INSTANCE_FROM_DT_INST(idx, gpio_xlnx_ps_bank_init, NULL,\ &gpio_xlnx_ps_bank##idx##_data, &gpio_xlnx_ps_bank##idx##_cfg,\ - PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, &gpio_xlnx_ps_bank_apis); + PRE_KERNEL_1, &gpio_xlnx_ps_bank_apis); /* Register & initialize all MIO / EMIO GPIO banks specified in the device tree. */ DT_INST_FOREACH_STATUS_OKAY(GPIO_XLNX_PS_BANK_INIT); diff --git a/drivers/gpio/gpio_xmc4xxx.c b/drivers/gpio/gpio_xmc4xxx.c index d90f68d3b32f1..de817ad94c6b6 100644 --- a/drivers/gpio/gpio_xmc4xxx.c +++ b/drivers/gpio/gpio_xmc4xxx.c @@ -221,8 +221,7 @@ static const struct gpio_driver_api gpio_xmc4xxx_driver_api = { .port = (XMC_GPIO_PORT_t *)DT_INST_REG_ADDR(index), \ .common = {.port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(index)}}; \ \ - DEVICE_DT_INST_DEFINE(index, gpio_xmc4xxx_init, NULL, &xmc4xxx_data_##index, \ - &xmc4xxx_config_##index, POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY, \ - &gpio_xmc4xxx_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(index, gpio_xmc4xxx_init, NULL, &xmc4xxx_data_##index, \ + &xmc4xxx_config_##index, POST_KERNEL, &gpio_xmc4xxx_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_XMC4XXX_INIT) diff --git a/drivers/gpio/wch_gpio_ch32v00x.c b/drivers/gpio/wch_gpio_ch32v00x.c index 61e4178a49ee0..92c56b328ee9e 100644 --- a/drivers/gpio/wch_gpio_ch32v00x.c +++ b/drivers/gpio/wch_gpio_ch32v00x.c @@ -137,8 +137,8 @@ static int gpio_ch32v00x_init(const struct device *dev) \ static struct gpio_ch32v00x_data gpio_ch32v00x_##idx##_data; \ \ - DEVICE_DT_INST_DEFINE(idx, gpio_ch32v00x_init, NULL, &gpio_ch32v00x_##idx##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, gpio_ch32v00x_init, NULL, &gpio_ch32v00x_##idx##_data, \ &gpio_ch32v00x_##idx##_config, PRE_KERNEL_1, \ - CONFIG_GPIO_INIT_PRIORITY, &gpio_ch32v00x_driver_api); + &gpio_ch32v00x_driver_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_CH32V00X_INIT) diff --git a/drivers/haptics/drv2605.c b/drivers/haptics/drv2605.c index a1de61512f2b3..3ebf90cb83711 100644 --- a/drivers/haptics/drv2605.c +++ b/drivers/haptics/drv2605.c @@ -637,8 +637,8 @@ static const struct haptics_driver_api drv2605_driver_api = { \ PM_DEVICE_DT_INST_DEFINE(inst, drv2605_pm_action); \ \ - DEVICE_DT_INST_DEFINE(inst, drv2605_init, PM_DEVICE_DT_INST_GET(inst), \ + DEVICE_INSTANCE_FROM_DT_INST(inst, drv2605_init, PM_DEVICE_DT_INST_GET(inst), \ &drv2605_data_##inst, &drv2605_config_##inst, POST_KERNEL, \ - CONFIG_HAPTICS_INIT_PRIORITY, &drv2605_driver_api); + &drv2605_driver_api); DT_INST_FOREACH_STATUS_OKAY(HAPTICS_DRV2605_DEFINE) diff --git a/drivers/hwspinlock/sqn_hwspinlock.c b/drivers/hwspinlock/sqn_hwspinlock.c index ecda78d876ad9..12c9eb33b3659 100644 --- a/drivers/hwspinlock/sqn_hwspinlock.c +++ b/drivers/hwspinlock/sqn_hwspinlock.c @@ -143,12 +143,11 @@ static int sqn_hwspinlock_init(const struct device *dev) DEVICE_MMIO_ROM_INIT(DT_DRV_INST(idx)), \ .num_locks = DT_INST_PROP(idx, num_locks), \ }; \ - DEVICE_DT_INST_DEFINE(idx, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, \ sqn_hwspinlock_init, \ NULL, \ &sqn_hwspinlock##idx##_data, \ &sqn_hwspinlock##idx##_config, \ - PRE_KERNEL_1, CONFIG_HWSPINLOCK_INIT_PRIORITY, \ - &hwspinlock_api) + PRE_KERNEL_1, &hwspinlock_api) DT_INST_FOREACH_STATUS_OKAY(SQN_HWSPINLOCK_INIT); diff --git a/drivers/i2c/gpio_i2c_switch.c b/drivers/i2c/gpio_i2c_switch.c index 1564f37006679..25cc78300457d 100644 --- a/drivers/i2c/gpio_i2c_switch.c +++ b/drivers/i2c/gpio_i2c_switch.c @@ -91,8 +91,8 @@ static int gpio_i2c_switch_init(const struct device *dev) .gpio = GPIO_DT_SPEC_GET(DT_DRV_INST(inst), gpios), \ }; \ \ - I2C_DEVICE_DT_INST_DEFINE(inst, gpio_i2c_switch_init, device_pm_control_nop, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(inst, gpio_i2c_switch_init, device_pm_control_nop, \ &gpio_i2c_switch_dev_data_##inst, &gpio_i2c_switch_dev_cfg_##inst, \ - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, &gpio_i2c_switch_api_funcs); + POST_KERNEL, &gpio_i2c_switch_api_funcs); DT_INST_FOREACH_STATUS_OKAY(DEFINE_GPIO_I2C_SWITCH) diff --git a/drivers/i2c/i2c_ambiq.c b/drivers/i2c/i2c_ambiq.c index 69492b5a60861..46df73a468ab5 100644 --- a/drivers/i2c/i2c_ambiq.c +++ b/drivers/i2c/i2c_ambiq.c @@ -452,8 +452,7 @@ static int i2c_ambiq_pm_action(const struct device *dev, enum pm_device_action a (.scl = GPIO_DT_SPEC_INST_GET_OR(n, scl_gpios, {0}),\ .sda = GPIO_DT_SPEC_INST_GET_OR(n, sda_gpios, {0}),)) }; \ PM_DEVICE_DT_INST_DEFINE(n, i2c_ambiq_pm_action); \ - I2C_DEVICE_DT_INST_DEFINE(n, i2c_ambiq_init, PM_DEVICE_DT_INST_GET(n), &i2c_ambiq_data##n, \ - &i2c_ambiq_config##n, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &i2c_ambiq_driver_api); + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, i2c_ambiq_init, PM_DEVICE_DT_INST_GET(n), &i2c_ambiq_data##n,\ + &i2c_ambiq_config##n, POST_KERNEL, &i2c_ambiq_driver_api); DT_INST_FOREACH_STATUS_OKAY(AMBIQ_I2C_DEFINE) diff --git a/drivers/i2c/i2c_andes_atciic100.c b/drivers/i2c/i2c_andes_atciic100.c index 3f1b4b9c3d289..10047e5b4e904 100644 --- a/drivers/i2c/i2c_andes_atciic100.c +++ b/drivers/i2c/i2c_andes_atciic100.c @@ -778,13 +778,12 @@ static int i2c_atciic100_init(const struct device *dev) .irq_num = DT_INST_IRQN(n), \ .dt_init_fn = i2c_dt_init_##n \ }; \ - I2C_DEVICE_DT_INST_DEFINE(n, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, \ i2c_atciic100_init, \ NULL, \ &i2c_atciic100_dev_data_##n, \ &i2c_atciic100_config_##n, \ POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ &i2c_atciic100_driver); \ \ static void i2c_dt_init_##n(void) \ diff --git a/drivers/i2c/i2c_b91.c b/drivers/i2c/i2c_b91.c index f7b25f54fd1e2..36b330a3b2cb5 100644 --- a/drivers/i2c/i2c_b91.c +++ b/drivers/i2c/i2c_b91.c @@ -170,12 +170,11 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) <= 1, .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ }; \ \ - I2C_DEVICE_DT_INST_DEFINE(inst, i2c_b91_init, \ - NULL, \ - &i2c_b91_data_##inst, \ - &i2c_b91_cfg_##inst, \ - POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(inst, i2c_b91_init, \ + NULL, \ + &i2c_b91_data_##inst, \ + &i2c_b91_cfg_##inst, \ + POST_KERNEL, \ &i2c_b91_api); DT_INST_FOREACH_STATUS_OKAY(I2C_B91_INIT) diff --git a/drivers/i2c/i2c_bcm_iproc.c b/drivers/i2c/i2c_bcm_iproc.c index 18f6afb0ae68d..6280886956b9a 100644 --- a/drivers/i2c/i2c_bcm_iproc.c +++ b/drivers/i2c/i2c_bcm_iproc.c @@ -946,8 +946,7 @@ static const struct i2c_driver_api iproc_i2c_driver_api = { \ static struct iproc_i2c_data iproc_i2c_data_##n; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, &iproc_i2c_init, NULL, &iproc_i2c_data_##n, \ - &iproc_i2c_config_##n, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &iproc_i2c_driver_api); + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, &iproc_i2c_init, NULL, &iproc_i2c_data_##n, \ + &iproc_i2c_config_##n, POST_KERNEL, &iproc_i2c_driver_api); DT_INST_FOREACH_STATUS_OKAY(IPROC_I2C_DEVICE_INIT) diff --git a/drivers/i2c/i2c_cc13xx_cc26xx.c b/drivers/i2c/i2c_cc13xx_cc26xx.c index d06ffe3c5cb6c..64733fea033ac 100644 --- a/drivers/i2c/i2c_cc13xx_cc26xx.c +++ b/drivers/i2c/i2c_cc13xx_cc26xx.c @@ -442,9 +442,8 @@ static struct i2c_cc13xx_cc26xx_data i2c_cc13xx_cc26xx_data = { PM_DEVICE_DT_INST_DEFINE(0, i2c_cc13xx_cc26xx_pm_action); -I2C_DEVICE_DT_INST_DEFINE(0, +I2C_DEVICE_INSTANCE_FROM_DT_INST(0, i2c_cc13xx_cc26xx_init, PM_DEVICE_DT_INST_GET(0), &i2c_cc13xx_cc26xx_data, &i2c_cc13xx_cc26xx_config, - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, - &i2c_cc13xx_cc26xx_driver_api); + POST_KERNEL, &i2c_cc13xx_cc26xx_driver_api); diff --git a/drivers/i2c/i2c_cc32xx.c b/drivers/i2c/i2c_cc32xx.c index 57fee76179905..a02ad9473c1b5 100644 --- a/drivers/i2c/i2c_cc32xx.c +++ b/drivers/i2c/i2c_cc32xx.c @@ -398,10 +398,9 @@ static const struct i2c_cc32xx_config i2c_cc32xx_config = { static struct i2c_cc32xx_data i2c_cc32xx_data; -I2C_DEVICE_DT_INST_DEFINE(0, i2c_cc32xx_init, NULL, +I2C_DEVICE_INSTANCE_FROM_DT_INST(0, i2c_cc32xx_init, NULL, &i2c_cc32xx_data, &i2c_cc32xx_config, - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, - &i2c_cc32xx_driver_api); + POST_KERNEL, &i2c_cc32xx_driver_api); static void configure_i2c_irq(const struct i2c_cc32xx_config *config) { diff --git a/drivers/i2c/i2c_dw.c b/drivers/i2c/i2c_dw.c index 5d274dcf0adcd..3ee857204d458 100644 --- a/drivers/i2c/i2c_dw.c +++ b/drivers/i2c/i2c_dw.c @@ -1218,9 +1218,8 @@ static int i2c_dw_initialize(const struct device *dev) RESET_DW_CONFIG(n) PINCTRL_DW_CONFIG(n) I2C_DW_INIT_PCIE(n) \ I2C_CONFIG_DMA_INIT(n)}; \ static struct i2c_dw_dev_config i2c_##n##_runtime; \ - I2C_DEVICE_DT_INST_DEFINE(n, i2c_dw_initialize, NULL, &i2c_##n##_runtime, \ - &i2c_config_dw_##n, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &funcs); \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, i2c_dw_initialize, NULL, &i2c_##n##_runtime, \ + &i2c_config_dw_##n, POST_KERNEL, &funcs); \ I2C_DW_IRQ_CONFIG(n) DT_INST_FOREACH_STATUS_OKAY(I2C_DEVICE_INIT_DW) diff --git a/drivers/i2c/i2c_emul.c b/drivers/i2c/i2c_emul.c index 5554ce81b5c65..ea957eb0d2e25 100644 --- a/drivers/i2c/i2c_emul.c +++ b/drivers/i2c/i2c_emul.c @@ -335,7 +335,7 @@ static const struct i2c_driver_api i2c_emul_api = { static struct i2c_emul_data i2c_emul_data_##n = { \ .bitrate = DT_INST_PROP(n, clock_frequency), \ }; \ - I2C_DEVICE_DT_INST_DEFINE(n, i2c_emul_init, NULL, &i2c_emul_data_##n, &i2c_emul_cfg_##n, \ - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, &i2c_emul_api); + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, i2c_emul_init, NULL, &i2c_emul_data_##n, &i2c_emul_cfg_##n,\ + POST_KERNEL, &i2c_emul_api); DT_INST_FOREACH_STATUS_OKAY(I2C_EMUL_INIT) diff --git a/drivers/i2c/i2c_ene_kb1200.c b/drivers/i2c/i2c_ene_kb1200.c index 322efd2e30c51..b5f970927eb63 100644 --- a/drivers/i2c/i2c_ene_kb1200.c +++ b/drivers/i2c/i2c_ene_kb1200.c @@ -352,8 +352,8 @@ static int i2c_kb1200_init(const struct device *dev) .fsmbm = (struct fsmbm_regs *)DT_INST_REG_ADDR(inst), \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ }; \ - I2C_DEVICE_DT_INST_DEFINE(inst, &i2c_kb1200_init, NULL, &i2c_kb1200_data_##inst, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(inst, &i2c_kb1200_init, NULL, &i2c_kb1200_data_##inst, \ &i2c_kb1200_config_##inst, PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &i2c_kb1200_api); + &i2c_kb1200_api); DT_INST_FOREACH_STATUS_OKAY(I2C_KB1200_DEVICE) diff --git a/drivers/i2c/i2c_esp32.c b/drivers/i2c/i2c_esp32.c index 07c8ea536caf6..3b6ca7a2000e0 100644 --- a/drivers/i2c/i2c_esp32.c +++ b/drivers/i2c/i2c_esp32.c @@ -839,9 +839,8 @@ static int IRAM_ATTR i2c_esp32_init(const struct device *dev) .bitrate = I2C_FREQUENCY(idx), \ .scl_timeout = I2C_ESP32_TIMEOUT(idx), \ }; \ - I2C_DEVICE_DT_DEFINE(I2C(idx), i2c_esp32_init, NULL, &i2c_esp32_data_##idx, \ - &i2c_esp32_config_##idx, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &i2c_esp32_driver_api); + I2C_DEVICE_INSTANCE(I2C(idx), i2c_esp32_init, NULL, &i2c_esp32_data_##idx, \ + &i2c_esp32_config_##idx, POST_KERNEL, &i2c_esp32_driver_api); #if DT_NODE_HAS_STATUS_OKAY(I2C(0)) #ifndef SOC_I2C_SUPPORT_HW_CLR_BUS diff --git a/drivers/i2c/i2c_gd32.c b/drivers/i2c/i2c_gd32.c index 9b6d6f5e4e616..1ec6244df3179 100644 --- a/drivers/i2c/i2c_gd32.c +++ b/drivers/i2c/i2c_gd32.c @@ -708,10 +708,9 @@ static int i2c_gd32_init(const struct device *dev) .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ .irq_cfg_func = i2c_gd32_irq_cfg_func_##inst, \ }; \ - I2C_DEVICE_DT_INST_DEFINE(inst, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(inst, \ i2c_gd32_init, NULL, \ &i2c_gd32_data_##inst, &i2c_gd32_cfg_##inst, \ - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &i2c_gd32_driver_api); \ + POST_KERNEL, &i2c_gd32_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(I2C_GD32_INIT) diff --git a/drivers/i2c/i2c_gecko.c b/drivers/i2c/i2c_gecko.c index e2d44f3989c40..e93cb8a235287 100644 --- a/drivers/i2c/i2c_gecko.c +++ b/drivers/i2c/i2c_gecko.c @@ -316,9 +316,9 @@ void i2c_gecko_isr(const struct device *dev) \ static struct i2c_gecko_data i2c_gecko_data_##idx; \ \ - I2C_DEVICE_DT_INST_DEFINE(idx, i2c_gecko_init, NULL, &i2c_gecko_data_##idx, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(idx, i2c_gecko_init, NULL, &i2c_gecko_data_##idx, \ &i2c_gecko_config_##idx, POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, &i2c_gecko_driver_api); \ + &i2c_gecko_driver_api); \ \ GECKO_I2C_IRQ_HANDLER(idx) diff --git a/drivers/i2c/i2c_gpio.c b/drivers/i2c/i2c_gpio.c index 80a1a221490f3..330986e30b599 100644 --- a/drivers/i2c/i2c_gpio.c +++ b/drivers/i2c/i2c_gpio.c @@ -213,11 +213,11 @@ static const struct i2c_gpio_config i2c_gpio_dev_cfg_##_num = { \ .bitrate = DT_INST_PROP(_num, clock_frequency), \ }; \ \ -I2C_DEVICE_DT_INST_DEFINE(_num, \ +I2C_DEVICE_INSTANCE_FROM_DT_INST(_num, \ i2c_gpio_init, \ NULL, \ &i2c_gpio_dev_data_##_num, \ &i2c_gpio_dev_cfg_##_num, \ - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, &api); + POST_KERNEL, &api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_I2C_GPIO) diff --git a/drivers/i2c/i2c_ifx_cat1.c b/drivers/i2c/i2c_ifx_cat1.c index 90bf9c1e68b45..015dbec9796c5 100644 --- a/drivers/i2c/i2c_ifx_cat1.c +++ b/drivers/i2c/i2c_ifx_cat1.c @@ -516,8 +516,8 @@ static const struct i2c_driver_api i2c_cat1_driver_api = { .irq_priority = DT_INST_IRQ(n, priority), \ }; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, ifx_cat1_i2c_init, NULL, &ifx_cat1_i2c_data##n, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, ifx_cat1_i2c_init, NULL, &ifx_cat1_i2c_data##n, \ &i2c_cat1_cfg_##n, POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, &i2c_cat1_driver_api); + &i2c_cat1_driver_api); DT_INST_FOREACH_STATUS_OKAY(INFINEON_CAT1_I2C_INIT) diff --git a/drivers/i2c/i2c_ifx_xmc4.c b/drivers/i2c/i2c_ifx_xmc4.c index 253445809c383..366944b8bc851 100644 --- a/drivers/i2c/i2c_ifx_xmc4.c +++ b/drivers/i2c/i2c_ifx_xmc4.c @@ -474,8 +474,8 @@ static const struct i2c_driver_api i2c_xmc4_driver_api = { XMC4_IRQ_HANDLER_STRUCT_INIT(n) \ }; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, ifx_xmc4_i2c_init, NULL, &ifx_xmc4_i2c_data##n, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, ifx_xmc4_i2c_init, NULL, &ifx_xmc4_i2c_data##n, \ &i2c_xmc4_cfg_##n, POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, &i2c_xmc4_driver_api); + &i2c_xmc4_driver_api); DT_INST_FOREACH_STATUS_OKAY(INFINEON_XMC4_I2C_INIT) diff --git a/drivers/i2c/i2c_imx.c b/drivers/i2c/i2c_imx.c index eba04101693f8..c36ffbfc7bbb9 100644 --- a/drivers/i2c/i2c_imx.c +++ b/drivers/i2c/i2c_imx.c @@ -381,12 +381,11 @@ static const struct i2c_driver_api i2c_imx_driver_api = { \ static struct i2c_imx_data i2c_imx_data_##n; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, \ i2c_imx_init, \ NULL, \ &i2c_imx_data_##n, &i2c_imx_config_##n, \ POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ &i2c_imx_driver_api); \ \ static void i2c_imx_config_func_##n(const struct device *dev) \ diff --git a/drivers/i2c/i2c_ite_enhance.c b/drivers/i2c/i2c_ite_enhance.c index 1264bcec84491..4990786ffa19b 100644 --- a/drivers/i2c/i2c_ite_enhance.c +++ b/drivers/i2c/i2c_ite_enhance.c @@ -1504,12 +1504,11 @@ BUILD_ASSERT(IS_ENABLED(CONFIG_I2C_TARGET_BUFFER_MODE), \ static struct i2c_enhance_data i2c_enhance_data_##inst; \ \ - I2C_DEVICE_DT_INST_DEFINE(inst, i2c_enhance_init, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(inst, i2c_enhance_init, \ NULL, \ &i2c_enhance_data_##inst, \ &i2c_enhance_cfg_##inst, \ POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ &i2c_enhance_driver_api); \ \ static void i2c_enhance_config_func_##inst(void) \ diff --git a/drivers/i2c/i2c_ite_it8xxx2.c b/drivers/i2c/i2c_ite_it8xxx2.c index a9247734be3fc..3142d4c8b0bd0 100644 --- a/drivers/i2c/i2c_ite_it8xxx2.c +++ b/drivers/i2c/i2c_ite_it8xxx2.c @@ -1314,12 +1314,11 @@ DT_INST_FOREACH_STATUS_OKAY(I2C_IT8XXX2_CHECK_SUPPORTED_CLOCK) \ static struct i2c_it8xxx2_data i2c_it8xxx2_data_##inst; \ \ - I2C_DEVICE_DT_INST_DEFINE(inst, i2c_it8xxx2_init, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(inst, i2c_it8xxx2_init, \ NULL, \ &i2c_it8xxx2_data_##inst, \ &i2c_it8xxx2_cfg_##inst, \ POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ &i2c_it8xxx2_driver_api); \ \ static void i2c_it8xxx2_config_func_##inst(void) \ diff --git a/drivers/i2c/i2c_litex.c b/drivers/i2c/i2c_litex.c index 38e0cfa8cfd7f..60caf54882ae3 100644 --- a/drivers/i2c/i2c_litex.c +++ b/drivers/i2c/i2c_litex.c @@ -157,14 +157,13 @@ static const struct i2c_driver_api i2c_litex_driver_api = { \ static struct i2c_bitbang i2c_bitbang_##n; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, \ - i2c_litex_init, \ - NULL, \ - &i2c_bitbang_##n, \ - &i2c_litex_cfg_##n, \ - POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ - &i2c_litex_driver_api \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, \ + i2c_litex_init, \ + NULL, \ + &i2c_bitbang_##n, \ + &i2c_litex_cfg_##n, \ + POST_KERNEL, \ + &i2c_litex_driver_api \ ); DT_INST_FOREACH_STATUS_OKAY(I2C_LITEX_INIT) diff --git a/drivers/i2c/i2c_ll_stm32.c b/drivers/i2c/i2c_ll_stm32.c index 677d1f688e5a2..e934e6cf29b54 100644 --- a/drivers/i2c/i2c_ll_stm32.c +++ b/drivers/i2c/i2c_ll_stm32.c @@ -613,12 +613,11 @@ static struct i2c_stm32_data i2c_stm32_dev_data_##index; \ \ PM_DEVICE_DT_INST_DEFINE(index, i2c_stm32_pm_action); \ \ -I2C_DEVICE_DT_INST_DEFINE(index, i2c_stm32_init, \ +I2C_DEVICE_INSTANCE_FROM_DT_INST(index, i2c_stm32_init, \ PM_DEVICE_DT_INST_GET(index), \ &i2c_stm32_dev_data_##index, \ &i2c_stm32_cfg_##index, \ - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &api_funcs); \ + POST_KERNEL, &api_funcs); \ \ STM32_I2C_IRQ_HANDLER(index) diff --git a/drivers/i2c/i2c_lpc11u6x.c b/drivers/i2c/i2c_lpc11u6x.c index 2a32822be5c3c..775554f924467 100644 --- a/drivers/i2c/i2c_lpc11u6x.c +++ b/drivers/i2c/i2c_lpc11u6x.c @@ -367,12 +367,11 @@ static const struct lpc11u6x_i2c_config i2c_cfg_##idx = { \ \ static struct lpc11u6x_i2c_data i2c_data_##idx; \ \ -I2C_DEVICE_DT_INST_DEFINE(idx, \ - lpc11u6x_i2c_init, \ - NULL, \ - &i2c_data_##idx, &i2c_cfg_##idx, \ - PRE_KERNEL_1, CONFIG_I2C_INIT_PRIORITY, \ - &i2c_api); \ +I2C_DEVICE_INSTANCE_FROM_DT_INST(idx, \ + lpc11u6x_i2c_init, \ + NULL, \ + &i2c_data_##idx, &i2c_cfg_##idx, \ + PRE_KERNEL_1, &i2c_api); \ \ static void lpc11u6x_i2c_isr_config_##idx(const struct device *dev) \ { \ diff --git a/drivers/i2c/i2c_max32.c b/drivers/i2c/i2c_max32.c index e08612114323b..62b9b1d8f9f2a 100644 --- a/drivers/i2c/i2c_max32.c +++ b/drivers/i2c/i2c_max32.c @@ -946,8 +946,8 @@ static int i2c_max32_init(const struct device *dev) I2C_MAX32_CONFIG_IRQ_FUNC(_num) MAX32_I2C_TX_DMA_INIT(_num) \ MAX32_I2C_RX_DMA_INIT(_num)}; \ static struct max32_i2c_data max32_i2c_data_##_num; \ - I2C_DEVICE_DT_INST_DEFINE(_num, i2c_max32_init, NULL, &max32_i2c_data_##_num, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(_num, i2c_max32_init, NULL, &max32_i2c_data_##_num, \ &max32_i2c_dev_cfg_##_num, PRE_KERNEL_2, \ - CONFIG_I2C_INIT_PRIORITY, &api); + &api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_I2C_MAX32) diff --git a/drivers/i2c/i2c_mchp_mss.c b/drivers/i2c/i2c_mchp_mss.c index ef132c6182cbf..bd78e138a5a67 100644 --- a/drivers/i2c/i2c_mchp_mss.c +++ b/drivers/i2c/i2c_mchp_mss.c @@ -382,8 +382,7 @@ static void mss_i2c_irq_handler(const struct device *dev) .clock_freq = DT_INST_PROP(n, clock_frequency), \ }; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, mss_i2c_init_##n, NULL, &mss_i2c_data_##n, \ - &mss_i2c_config_##n, PRE_KERNEL_1, CONFIG_I2C_INIT_PRIORITY, \ - &mss_i2c_driver_api); + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, mss_i2c_init_##n, NULL, &mss_i2c_data_##n, \ + &mss_i2c_config_##n, PRE_KERNEL_1, &mss_i2c_driver_api); DT_INST_FOREACH_STATUS_OKAY(MSS_I2C_INIT) diff --git a/drivers/i2c/i2c_mchp_xec.c b/drivers/i2c/i2c_mchp_xec.c index 6f48e9404b15c..65cff989782cd 100644 --- a/drivers/i2c/i2c_mchp_xec.c +++ b/drivers/i2c/i2c_mchp_xec.c @@ -905,10 +905,9 @@ static int i2c_xec_init(const struct device *dev) .irq_config_func = i2c_xec_irq_config_func_##n, \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ }; \ - I2C_DEVICE_DT_INST_DEFINE(n, i2c_xec_init, NULL, \ - &i2c_xec_data_##n, &i2c_xec_config_##n, \ - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &i2c_xec_driver_api); \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, i2c_xec_init, NULL, \ + &i2c_xec_data_##n, &i2c_xec_config_##n, \ + POST_KERNEL, &i2c_xec_driver_api); \ \ static void i2c_xec_irq_config_func_##n(void) \ { \ diff --git a/drivers/i2c/i2c_mchp_xec_v2.c b/drivers/i2c/i2c_mchp_xec_v2.c index c0ab170ba03ef..cee104ad9376d 100644 --- a/drivers/i2c/i2c_mchp_xec_v2.c +++ b/drivers/i2c/i2c_mchp_xec_v2.c @@ -1102,10 +1102,9 @@ static int i2c_xec_init(const struct device *dev) .irq_config_func = i2c_xec_irq_config_func_##n, \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ }; \ - I2C_DEVICE_DT_INST_DEFINE(n, i2c_xec_init, NULL, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, i2c_xec_init, NULL, \ &i2c_xec_data_##n, &i2c_xec_config_##n, \ - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &i2c_xec_driver_api); \ + POST_KERNEL, &i2c_xec_driver_api); \ \ static void i2c_xec_irq_config_func_##n(void) \ { \ diff --git a/drivers/i2c/i2c_mcux.c b/drivers/i2c/i2c_mcux.c index aaf6b0116a6de..b2c0a437683d5 100644 --- a/drivers/i2c/i2c_mcux.c +++ b/drivers/i2c/i2c_mcux.c @@ -368,11 +368,10 @@ static const struct i2c_driver_api i2c_mcux_driver_api = { \ static struct i2c_mcux_data i2c_mcux_data_ ## n; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, \ i2c_mcux_init, NULL, \ &i2c_mcux_data_ ## n, \ &i2c_mcux_config_ ## n, POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ &i2c_mcux_driver_api); \ \ static void i2c_mcux_config_func_ ## n(const struct device *dev) \ diff --git a/drivers/i2c/i2c_mcux_flexcomm.c b/drivers/i2c/i2c_mcux_flexcomm.c index 158deacc6dedd..0f7f21c12a0e0 100644 --- a/drivers/i2c/i2c_mcux_flexcomm.c +++ b/drivers/i2c/i2c_mcux_flexcomm.c @@ -545,13 +545,12 @@ static const struct i2c_driver_api mcux_flexcomm_driver_api = { .reset = RESET_DT_SPEC_INST_GET(id), \ }; \ static struct mcux_flexcomm_data mcux_flexcomm_data_##id; \ - I2C_DEVICE_DT_INST_DEFINE(id, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(id, \ mcux_flexcomm_init, \ NULL, \ &mcux_flexcomm_data_##id, \ &mcux_flexcomm_config_##id, \ POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ &mcux_flexcomm_driver_api); \ static void mcux_flexcomm_config_func_##id(const struct device *dev) \ { \ diff --git a/drivers/i2c/i2c_mcux_lpi2c.c b/drivers/i2c/i2c_mcux_lpi2c.c index 0bb7e2d402f96..de39a4a530207 100644 --- a/drivers/i2c/i2c_mcux_lpi2c.c +++ b/drivers/i2c/i2c_mcux_lpi2c.c @@ -613,11 +613,10 @@ static const struct i2c_driver_api mcux_lpi2c_driver_api = { \ static struct mcux_lpi2c_data mcux_lpi2c_data_##n; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, mcux_lpi2c_init, NULL, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, mcux_lpi2c_init, NULL, \ &mcux_lpi2c_data_##n, \ &mcux_lpi2c_config_##n, POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ - &mcux_lpi2c_driver_api); \ + &mcux_lpi2c_driver_api); \ \ static void mcux_lpi2c_config_func_##n(const struct device *dev) \ { \ diff --git a/drivers/i2c/i2c_mcux_lpi2c_rtio.c b/drivers/i2c/i2c_mcux_lpi2c_rtio.c index 6b10994585deb..057ee140fd729 100644 --- a/drivers/i2c/i2c_mcux_lpi2c_rtio.c +++ b/drivers/i2c/i2c_mcux_lpi2c_rtio.c @@ -374,10 +374,9 @@ static const struct i2c_driver_api mcux_lpi2c_driver_api = { .ctx = &CONCAT(_i2c, n, _lpi2c_rtio), \ }; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, mcux_lpi2c_init, NULL, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, mcux_lpi2c_init, NULL, \ &mcux_lpi2c_data_##n, \ &mcux_lpi2c_config_##n, POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ &mcux_lpi2c_driver_api); \ \ static void mcux_lpi2c_config_func_##n(const struct device *dev)\ diff --git a/drivers/i2c/i2c_nios2.c b/drivers/i2c/i2c_nios2.c index bbd1cf2223a5e..067e1fa236217 100644 --- a/drivers/i2c/i2c_nios2.c +++ b/drivers/i2c/i2c_nios2.c @@ -194,7 +194,6 @@ static int i2c_nios2_init(const struct device *dev) return 0; } -I2C_DEVICE_DT_INST_DEFINE(0, i2c_nios2_init, NULL, +I2C_DEVICE_INSTANCE_FROM_DT_INST(0, i2c_nios2_init, NULL, &i2c_nios2_dev_data, NULL, - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, - &i2c_nios2_driver_api); + POST_KERNEL, &i2c_nios2_driver_api); diff --git a/drivers/i2c/i2c_npcx_controller.c b/drivers/i2c/i2c_npcx_controller.c index 8adcf792e6af6..03a262100889e 100644 --- a/drivers/i2c/i2c_npcx_controller.c +++ b/drivers/i2c/i2c_npcx_controller.c @@ -1327,12 +1327,11 @@ static int i2c_ctrl_init(const struct device *dev) \ static struct i2c_ctrl_data i2c_ctrl_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ NPCX_I2C_CTRL_INIT_FUNC(inst), \ NULL, \ &i2c_ctrl_data_##inst, &i2c_ctrl_cfg_##inst, \ - PRE_KERNEL_1, CONFIG_I2C_INIT_PRIORITY, \ - NULL); \ + PRE_KERNEL_1, NULL); \ \ NPCX_I2C_CTRL_INIT_FUNC_IMPL(inst) diff --git a/drivers/i2c/i2c_npcx_port.c b/drivers/i2c/i2c_npcx_port.c index 1763890956172..5ccc75008c142 100644 --- a/drivers/i2c/i2c_npcx_port.c +++ b/drivers/i2c/i2c_npcx_port.c @@ -225,11 +225,10 @@ static const struct i2c_driver_api i2c_port_npcx_driver_api = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ }; \ \ - I2C_DEVICE_DT_INST_DEFINE(inst, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(inst, \ i2c_npcx_port_init, \ NULL, NULL, \ &i2c_npcx_port_cfg_##inst, \ - PRE_KERNEL_1, CONFIG_I2C_NPCX_PORT_INIT_PRIORITY, \ - &i2c_port_npcx_driver_api); + PRE_KERNEL_1, &i2c_port_npcx_driver_api); DT_INST_FOREACH_STATUS_OKAY(NPCX_I2C_PORT_INIT) diff --git a/drivers/i2c/i2c_nrfx_twi.c b/drivers/i2c/i2c_nrfx_twi.c index 56d3727e125ef..bc9f4a08dbe29 100644 --- a/drivers/i2c/i2c_nrfx_twi.c +++ b/drivers/i2c/i2c_nrfx_twi.c @@ -166,13 +166,12 @@ static const struct i2c_driver_api i2c_nrfx_twi_driver_api = { .pcfg = PINCTRL_DT_DEV_CONFIG_GET(I2C(idx)), \ }; \ PM_DEVICE_DT_DEFINE(I2C(idx), twi_nrfx_pm_action); \ - I2C_DEVICE_DT_DEFINE(I2C(idx), \ - twi_##idx##_init, \ - PM_DEVICE_DT_GET(I2C(idx)), \ - &twi_##idx##_data, \ - &twi_##idx##z_config, \ - POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ + I2C_DEVICE_INSTANCE(I2C(idx), \ + twi_##idx##_init, \ + PM_DEVICE_DT_GET(I2C(idx)), \ + &twi_##idx##_data, \ + &twi_##idx##z_config, \ + POST_KERNEL, \ &i2c_nrfx_twi_driver_api) #ifdef CONFIG_HAS_HW_NRF_TWI0 diff --git a/drivers/i2c/i2c_nrfx_twi_rtio.c b/drivers/i2c/i2c_nrfx_twi_rtio.c index 1eb9b3762b297..109d73711a897 100644 --- a/drivers/i2c/i2c_nrfx_twi_rtio.c +++ b/drivers/i2c/i2c_nrfx_twi_rtio.c @@ -196,13 +196,12 @@ static const struct i2c_driver_api i2c_nrfx_twi_rtio_driver_api = { .pcfg = PINCTRL_DT_DEV_CONFIG_GET(I2C(idx)), \ }; \ PM_DEVICE_DT_DEFINE(I2C(idx), twi_nrfx_pm_action); \ - I2C_DEVICE_DT_DEFINE(I2C(idx), \ - twi_##idx##_init, \ - PM_DEVICE_DT_GET(I2C(idx)), \ - &twi_##idx##_data, \ - &twi_##idx##z_config, \ - POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ + I2C_DEVICE_INSTANCE(I2C(idx), \ + twi_##idx##_init, \ + PM_DEVICE_DT_GET(I2C(idx)), \ + &twi_##idx##_data, \ + &twi_##idx##z_config, \ + POST_KERNEL, \ &i2c_nrfx_twi_rtio_driver_api) #ifdef CONFIG_HAS_HW_NRF_TWI0 diff --git a/drivers/i2c/i2c_nrfx_twim.c b/drivers/i2c/i2c_nrfx_twim.c index 9609709d8c354..adbb8e998d1b1 100644 --- a/drivers/i2c/i2c_nrfx_twim.c +++ b/drivers/i2c/i2c_nrfx_twim.c @@ -259,13 +259,12 @@ static const struct i2c_driver_api i2c_nrfx_twim_driver_api = { DT_PROP(I2C(idx), easydma_maxcnt_bits)), \ }; \ PM_DEVICE_DT_DEFINE(I2C(idx), twim_nrfx_pm_action); \ - I2C_DEVICE_DT_DEFINE(I2C(idx), \ - i2c_nrfx_twim_init, \ - PM_DEVICE_DT_GET(I2C(idx)), \ - &twim_##idx##_data, \ - &twim_##idx##z_config, \ - POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ + I2C_DEVICE_INSTANCE(I2C(idx), \ + i2c_nrfx_twim_init, \ + PM_DEVICE_DT_GET(I2C(idx)), \ + &twim_##idx##_data, \ + &twim_##idx##z_config, \ + POST_KERNEL, \ &i2c_nrfx_twim_driver_api) #define I2C_MEMORY_SECTION(idx) \ diff --git a/drivers/i2c/i2c_nrfx_twim_rtio.c b/drivers/i2c/i2c_nrfx_twim_rtio.c index ad4554332639b..a07f46ef4bfe2 100644 --- a/drivers/i2c/i2c_nrfx_twim_rtio.c +++ b/drivers/i2c/i2c_nrfx_twim_rtio.c @@ -211,9 +211,8 @@ int i2c_nrfx_twim_rtio_init(const struct device *dev) .ctx = &_i2c##idx##_twim_rtio, \ }; \ PM_DEVICE_DT_DEFINE(I2C(idx), twim_nrfx_pm_action); \ - I2C_DEVICE_DT_DEFINE(I2C(idx), i2c_nrfx_twim_rtio_init, PM_DEVICE_DT_GET(I2C(idx)), NULL, \ - &twim_##idx##z_config, POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &i2c_nrfx_twim_driver_api) + I2C_DEVICE_INSTANCE(I2C(idx), i2c_nrfx_twim_rtio_init, PM_DEVICE_DT_GET(I2C(idx)), NULL, \ + &twim_##idx##z_config, POST_KERNEL, &i2c_nrfx_twim_driver_api) #define I2C_MEMORY_SECTION(idx) \ COND_CODE_1(I2C_HAS_PROP(idx, memory_regions), \ diff --git a/drivers/i2c/i2c_numaker.c b/drivers/i2c/i2c_numaker.c index 9441db55ca0e5..1c0820e622b51 100644 --- a/drivers/i2c/i2c_numaker.c +++ b/drivers/i2c/i2c_numaker.c @@ -775,13 +775,12 @@ static const struct i2c_driver_api i2c_numaker_driver_api = { \ static struct i2c_numaker_data i2c_numaker_data_##inst; \ \ - I2C_DEVICE_DT_INST_DEFINE(inst, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(inst, \ i2c_numaker_init, \ NULL, \ &i2c_numaker_data_##inst, \ &i2c_numaker_config_##inst, \ POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ &i2c_numaker_driver_api); DT_INST_FOREACH_STATUS_OKAY(I2C_NUMAKER_INIT); diff --git a/drivers/i2c/i2c_rcar.c b/drivers/i2c/i2c_rcar.c index 495579bb1e431..fd475f5f1f0f3 100644 --- a/drivers/i2c/i2c_rcar.c +++ b/drivers/i2c/i2c_rcar.c @@ -368,13 +368,12 @@ static const struct i2c_driver_api i2c_rcar_driver_api = { \ static struct i2c_rcar_data i2c_rcar_data_##n; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, \ - i2c_rcar_init, \ - NULL, \ - &i2c_rcar_data_##n, \ - &i2c_rcar_cfg_##n, \ - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &i2c_rcar_driver_api \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, \ + i2c_rcar_init, \ + NULL, \ + &i2c_rcar_data_##n, \ + &i2c_rcar_cfg_##n, \ + POST_KERNEL, &i2c_rcar_driver_api, \ ); \ static void i2c_rcar_##n##_init(const struct device *dev) \ { \ diff --git a/drivers/i2c/i2c_renesas_ra_iic.c b/drivers/i2c/i2c_renesas_ra_iic.c index 98eb46f625d59..52eea71c79f62 100644 --- a/drivers/i2c/i2c_renesas_ra_iic.c +++ b/drivers/i2c/i2c_renesas_ra_iic.c @@ -549,8 +549,8 @@ static const struct i2c_driver_api i2c_ra_iic_driver_api = { }, \ }; \ \ - I2C_DEVICE_DT_INST_DEFINE(index, i2c_ra_iic_init, NULL, &i2c_ra_iic_data_##index, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(index, i2c_ra_iic_init, NULL, &i2c_ra_iic_data_##index, \ &i2c_ra_iic_config_##index, POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, &i2c_ra_iic_driver_api); + &i2c_ra_iic_driver_api); DT_INST_FOREACH_STATUS_OKAY(I2C_RA_IIC_INIT) diff --git a/drivers/i2c/i2c_rv32m1_lpi2c.c b/drivers/i2c/i2c_rv32m1_lpi2c.c index a7bffef4d4b4d..a5e28ad260f6d 100644 --- a/drivers/i2c/i2c_rv32m1_lpi2c.c +++ b/drivers/i2c/i2c_rv32m1_lpi2c.c @@ -284,13 +284,12 @@ static const struct i2c_driver_api rv32m1_lpi2c_driver_api = { .completion_sync = Z_SEM_INITIALIZER( \ rv32m1_lpi2c_##id##_data.completion_sync, 0, 1), \ }; \ - I2C_DEVICE_DT_INST_DEFINE(id, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(id, \ rv32m1_lpi2c_init, \ NULL, \ &rv32m1_lpi2c_##id##_data, \ &rv32m1_lpi2c_##id##_config, \ - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &rv32m1_lpi2c_driver_api); \ + POST_KERNEL, &rv32m1_lpi2c_driver_api); \ static void rv32m1_lpi2c_irq_config_func_##id(const struct device *dev) \ { \ IRQ_CONNECT(DT_INST_IRQN(id), \ diff --git a/drivers/i2c/i2c_sam0.c b/drivers/i2c/i2c_sam0.c index ff0b6c67fb652..e375bce2c375d 100644 --- a/drivers/i2c/i2c_sam0.c +++ b/drivers/i2c/i2c_sam0.c @@ -846,12 +846,11 @@ 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; \ - I2C_DEVICE_DT_INST_DEFINE(n, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, \ i2c_sam0_initialize, \ NULL, \ &i2c_sam0_dev_data_##n, \ &i2c_sam0_dev_config_##n, POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ &i2c_sam0_driver_api); \ I2C_SAM0_IRQ_HANDLER(n) diff --git a/drivers/i2c/i2c_sam4l_twim.c b/drivers/i2c/i2c_sam4l_twim.c index 3f8551267f76a..35b66316a7e92 100644 --- a/drivers/i2c/i2c_sam4l_twim.c +++ b/drivers/i2c/i2c_sam4l_twim.c @@ -629,10 +629,9 @@ static const struct i2c_driver_api i2c_sam_twim_driver_api = { \ static struct i2c_sam_twim_dev_data i2c##n##_sam_data; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, i2c_sam_twim_initialize, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, i2c_sam_twim_initialize, \ NULL, \ &i2c##n##_sam_data, &i2c##n##_sam_config, \ - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &i2c_sam_twim_driver_api) + POST_KERNEL, &i2c_sam_twim_driver_api) DT_INST_FOREACH_STATUS_OKAY(I2C_TWIM_SAM_INIT); diff --git a/drivers/i2c/i2c_sam_twi.c b/drivers/i2c/i2c_sam_twi.c index ad6a327785988..1f8037004d5b7 100644 --- a/drivers/i2c/i2c_sam_twi.c +++ b/drivers/i2c/i2c_sam_twi.c @@ -378,10 +378,9 @@ static const struct i2c_driver_api i2c_sam_twi_driver_api = { \ static struct i2c_sam_twi_dev_data i2c##n##_sam_data; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, i2c_sam_twi_initialize, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, i2c_sam_twi_initialize, \ NULL, \ &i2c##n##_sam_data, &i2c##n##_sam_config, \ - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &i2c_sam_twi_driver_api); + POST_KERNEL, &i2c_sam_twi_driver_api); DT_INST_FOREACH_STATUS_OKAY(I2C_TWI_SAM_INIT) diff --git a/drivers/i2c/i2c_sam_twihs.c b/drivers/i2c/i2c_sam_twihs.c index 4b1fda4ce573c..394f542d912e9 100644 --- a/drivers/i2c/i2c_sam_twihs.c +++ b/drivers/i2c/i2c_sam_twihs.c @@ -346,10 +346,9 @@ static const struct i2c_driver_api i2c_sam_twihs_driver_api = { \ static struct i2c_sam_twihs_dev_data i2c##n##_sam_data; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, i2c_sam_twihs_initialize, \ - NULL, \ - &i2c##n##_sam_data, &i2c##n##_sam_config, \ - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &i2c_sam_twihs_driver_api); + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, i2c_sam_twihs_initialize,\ + NULL, \ + &i2c##n##_sam_data, &i2c##n##_sam_config,\ + POST_KERNEL, &i2c_sam_twihs_driver_api); DT_INST_FOREACH_STATUS_OKAY(I2C_TWIHS_SAM_INIT) diff --git a/drivers/i2c/i2c_sam_twihs_rtio.c b/drivers/i2c/i2c_sam_twihs_rtio.c index bbece9d50e506..842ece161013f 100644 --- a/drivers/i2c/i2c_sam_twihs_rtio.c +++ b/drivers/i2c/i2c_sam_twihs_rtio.c @@ -359,10 +359,9 @@ static const struct i2c_driver_api i2c_sam_twihs_driver_api = { .ctx = &_i2c##n##_sam_rtio, \ }; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, i2c_sam_twihs_initialize, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, i2c_sam_twihs_initialize, \ NULL, \ &i2c##n##_sam_data, &i2c##n##_sam_config, \ - POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \ - &i2c_sam_twihs_driver_api); + POST_KERNEL, &i2c_sam_twihs_driver_api); DT_INST_FOREACH_STATUS_OKAY(I2C_TWIHS_SAM_INIT) diff --git a/drivers/i2c/i2c_sbcon.c b/drivers/i2c/i2c_sbcon.c index 0212593ed3e53..63263634e2d59 100644 --- a/drivers/i2c/i2c_sbcon.c +++ b/drivers/i2c/i2c_sbcon.c @@ -149,11 +149,11 @@ static const struct i2c_sbcon_config i2c_sbcon_dev_cfg_##_num = { \ .bitrate = DT_INST_PROP(_num, clock_frequency), \ }; \ \ -I2C_DEVICE_DT_INST_DEFINE(_num, \ +I2C_DEVICE_INSTANCE_FROM_DT_INST(_num, \ i2c_sbcon_init, \ NULL, \ &i2c_sbcon_dev_data_##_num, \ &i2c_sbcon_dev_cfg_##_num, \ - PRE_KERNEL_2, CONFIG_I2C_INIT_PRIORITY, &api); + PRE_KERNEL_2, &api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_I2C_SBCON) diff --git a/drivers/i2c/i2c_sc18im704.c b/drivers/i2c/i2c_sc18im704.c index 64ea3482b28af..33dec190595bf 100644 --- a/drivers/i2c/i2c_sc18im704.c +++ b/drivers/i2c/i2c_sc18im704.c @@ -340,9 +340,8 @@ static const struct i2c_driver_api i2c_sc18im_driver_api = { .i2c_config = I2C_MODE_CONTROLLER | (I2C_SPEED_STANDARD << I2C_SPEED_SHIFT), \ }; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, i2c_sc18im_init, NULL, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, i2c_sc18im_init, NULL, \ &i2c_sc18im_data_##n, &i2c_sc18im_config_##n, \ - POST_KERNEL, CONFIG_I2C_SC18IM704_INIT_PRIORITY, \ - &i2c_sc18im_driver_api); + POST_KERNEL, &i2c_sc18im_driver_api); DT_INST_FOREACH_STATUS_OKAY(I2C_SC18IM_DEFINE) diff --git a/drivers/i2c/i2c_sedi.c b/drivers/i2c/i2c_sedi.c index 00ec5e06d4a0f..6dede13332e83 100644 --- a/drivers/i2c/i2c_sedi.c +++ b/drivers/i2c/i2c_sedi.c @@ -238,8 +238,8 @@ static void i2c_sedi_isr(const struct device *dev) .irq_config = &i2c_sedi_irq_config_##n, \ }; \ PM_DEVICE_DT_DEFINE(DT_NODELABEL(i2c##n), i2c_sedi_pm_action); \ - I2C_DEVICE_DT_INST_DEFINE(n, i2c_sedi_init, PM_DEVICE_DT_GET(DT_NODELABEL(i2c##n)), \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, i2c_sedi_init, PM_DEVICE_DT_GET(DT_NODELABEL(i2c##n)), \ &i2c_sedi_data_##n, &i2c_sedi_config_##n, PRE_KERNEL_2, \ - CONFIG_I2C_INIT_PRIORITY, &i2c_sedi_apis); + &i2c_sedi_apis); DT_INST_FOREACH_STATUS_OKAY(I2C_DEVICE_INIT_SEDI) diff --git a/drivers/i2c/i2c_sifive.c b/drivers/i2c/i2c_sifive.c index 54ba5a779e462..acad75d961e74 100644 --- a/drivers/i2c/i2c_sifive.c +++ b/drivers/i2c/i2c_sifive.c @@ -332,13 +332,12 @@ static const struct i2c_driver_api i2c_sifive_api = { .f_sys = SIFIVE_PERIPHERAL_CLOCK_FREQUENCY, \ .f_bus = DT_INST_PROP(n, clock_frequency), \ }; \ - I2C_DEVICE_DT_INST_DEFINE(n, \ - i2c_sifive_init, \ - NULL, \ - NULL, \ - &i2c_sifive_cfg_##n, \ - POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n,\ + i2c_sifive_init,\ + NULL, \ + NULL, \ + &i2c_sifive_cfg_##n,\ + POST_KERNEL,\ &i2c_sifive_api); DT_INST_FOREACH_STATUS_OKAY(I2C_SIFIVE_INIT) diff --git a/drivers/i2c/i2c_smartbond.c b/drivers/i2c/i2c_smartbond.c index c402251e49b0e..cfb3d010b7c20 100644 --- a/drivers/i2c/i2c_smartbond.c +++ b/drivers/i2c/i2c_smartbond.c @@ -670,9 +670,9 @@ static int i2c_smartbond_init(const struct device *dev) I2C_SMARTBOND_CONFIGURE(id); \ return ret; \ } \ - I2C_DEVICE_DT_INST_DEFINE(id, i2c_smartbond_##id##_init, PM_DEVICE_DT_INST_GET(id), \ - &i2c_smartbond_##id##_data, \ - &i2c_smartbond_##id##_cfg, POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, &i2c_smartbond_driver_api); + I2C_DEVICE_INSTANCE_FROM_DT_INST(id, i2c_smartbond_##id##_init, PM_DEVICE_DT_INST_GET(id),\ + &i2c_smartbond_##id##_data, \ + &i2c_smartbond_##id##_cfg, POST_KERNEL, \ + &i2c_smartbond_driver_api); DT_INST_FOREACH_STATUS_OKAY(I2C_SMARTBOND_DEVICE) diff --git a/drivers/i2c/i2c_tca954x.c b/drivers/i2c/i2c_tca954x.c index 572b8daaf62e0..5d942daf543a8 100644 --- a/drivers/i2c/i2c_tca954x.c +++ b/drivers/i2c/i2c_tca954x.c @@ -172,13 +172,12 @@ BUILD_ASSERT(CONFIG_I2C_TCA954X_CHANNEL_INIT_PRIO > CONFIG_I2C_TCA954X_ROOT_INIT .root = DEVICE_DT_GET(DT_PARENT(node_id)), \ .has_enable = has_enable_bit, \ }; \ - DEVICE_DT_DEFINE(node_id, \ + DEVICE_INSTANCE(node_id, \ tca954x_channel_init, \ NULL, \ NULL, \ &tca##n##a_down_config_##node_id, \ - POST_KERNEL, CONFIG_I2C_TCA954X_CHANNEL_INIT_PRIO, \ - &tca954x_api_funcs); + POST_KERNEL, &tca954x_api_funcs); #define TCA954x_ROOT_DEFINE(n, inst, ch, has_enable_bit) \ static const struct tca954x_root_config tca##n##a_cfg_##inst = { \ @@ -190,10 +189,10 @@ BUILD_ASSERT(CONFIG_I2C_TCA954X_CHANNEL_INIT_PRIO > CONFIG_I2C_TCA954X_ROOT_INIT static struct tca954x_root_data tca##n##a_data_##inst = { \ .lock = Z_MUTEX_INITIALIZER(tca##n##a_data_##inst.lock), \ }; \ - I2C_DEVICE_DT_DEFINE(DT_INST(inst, ti_tca##n##a), \ + I2C_DEVICE_INSTANCE(DT_INST(inst, ti_tca##n##a), \ tca954x_root_init, NULL, \ &tca##n##a_data_##inst, &tca##n##a_cfg_##inst, \ - POST_KERNEL, CONFIG_I2C_TCA954X_ROOT_INIT_PRIO, \ + POST_KERNEL, \ NULL); \ DT_FOREACH_CHILD_VARGS(DT_INST(inst, ti_tca##n##a), TCA954x_CHILD_DEFINE, n, \ has_enable_bit); diff --git a/drivers/i2c/i2c_test.c b/drivers/i2c/i2c_test.c index 89001f617827e..5c469232d9fea 100644 --- a/drivers/i2c/i2c_test.c +++ b/drivers/i2c/i2c_test.c @@ -33,7 +33,7 @@ static const struct i2c_driver_api vnd_i2c_api = { }; #define VND_I2C_INIT(n) \ - I2C_DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, &vnd_i2c_api); + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, NULL, NULL, POST_KERNEL,\ + &vnd_i2c_api); DT_INST_FOREACH_STATUS_OKAY(VND_I2C_INIT) diff --git a/drivers/i2c/i2c_xilinx_axi.c b/drivers/i2c/i2c_xilinx_axi.c index 715deaa6bb71d..ff06352c5c566 100644 --- a/drivers/i2c/i2c_xilinx_axi.c +++ b/drivers/i2c/i2c_xilinx_axi.c @@ -642,10 +642,10 @@ static const struct i2c_driver_api i2c_xilinx_axi_driver_api = { \ static struct i2c_xilinx_axi_data i2c_xilinx_axi_data_##compat##_##n; \ \ - I2C_DEVICE_DT_INST_DEFINE(n, i2c_xilinx_axi_init, NULL, \ + I2C_DEVICE_INSTANCE_FROM_DT_INST(n, i2c_xilinx_axi_init, NULL, \ &i2c_xilinx_axi_data_##compat##_##n, \ &i2c_xilinx_axi_config_##compat##_##n, POST_KERNEL, \ - CONFIG_I2C_INIT_PRIORITY, &i2c_xilinx_axi_driver_api); \ + &i2c_xilinx_axi_driver_api); \ \ static void i2c_xilinx_axi_config_func_##compat##_##n(const struct device *dev) \ { \ diff --git a/drivers/i2c/target/eeprom_target.c b/drivers/i2c/target/eeprom_target.c index 69ae35cfcd8d0..8234ffa020de5 100644 --- a/drivers/i2c/target/eeprom_target.c +++ b/drivers/i2c/target/eeprom_target.c @@ -280,13 +280,12 @@ static int i2c_eeprom_target_init(const struct device *dev) .buffer = i2c_eeprom_target_##inst##_buffer \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &i2c_eeprom_target_init, \ - NULL, \ + NULL, \ &i2c_eeprom_target_##inst##_dev_data, \ &i2c_eeprom_target_##inst##_cfg, \ POST_KERNEL, \ - CONFIG_I2C_TARGET_INIT_PRIORITY, \ &api_funcs); DT_INST_FOREACH_STATUS_OKAY(I2C_EEPROM_INIT) diff --git a/drivers/i2s/i2s_esp32.c b/drivers/i2s/i2s_esp32.c index 6de53e56f52e6..f720689a01d2e 100644 --- a/drivers/i2s/i2s_esp32.c +++ b/drivers/i2s/i2s_esp32.c @@ -923,8 +923,7 @@ static const struct i2s_driver_api i2s_esp32_driver_api = { static struct i2s_esp32_data i2s_esp32_data_##index = { \ I2S_ESP32_DMA_CHANNEL_INIT(index, rx), I2S_ESP32_DMA_CHANNEL_INIT(index, tx)}; \ \ - DEVICE_DT_INST_DEFINE(index, &i2s_esp32_initialize, NULL, &i2s_esp32_data_##index, \ - &i2s_esp32_config_##index, POST_KERNEL, CONFIG_I2S_INIT_PRIORITY, \ - &i2s_esp32_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(index, &i2s_esp32_initialize, NULL, &i2s_esp32_data_##index, \ + &i2s_esp32_config_##index, POST_KERNEL, &i2s_esp32_driver_api); DT_INST_FOREACH_STATUS_OKAY(I2S_ESP32_INIT) diff --git a/drivers/i2s/i2s_litex.c b/drivers/i2s/i2s_litex.c index 6105804d8ceed..11fde5a48b940 100644 --- a/drivers/i2s/i2s_litex.c +++ b/drivers/i2s/i2s_litex.c @@ -618,11 +618,10 @@ static const struct i2s_driver_api i2s_litex_driver_api = { .fifo_depth = DT_PROP(DT_NODELABEL(i2s_##dir), fifo_depth), \ .irq_config = i2s_litex_irq_config_func_##dir \ }; \ - DEVICE_DT_DEFINE(DT_NODELABEL(i2s_##dir), i2s_litex_initialize, \ - NULL, &i2s_litex_data_##dir, \ + DEVICE_INSTANCE(DT_NODELABEL(i2s_##dir), i2s_litex_initialize, \ + NULL, &i2s_litex_data_##dir, \ &i2s_litex_cfg_##dir, POST_KERNEL, \ - CONFIG_I2S_INIT_PRIORITY, \ - &i2s_litex_driver_api); \ + &i2s_litex_driver_api); \ \ static void i2s_litex_irq_config_func_##dir(const struct device *dev) \ { \ diff --git a/drivers/i2s/i2s_ll_stm32.c b/drivers/i2s/i2s_ll_stm32.c index 5f121e7da9348..552851f9d08e4 100644 --- a/drivers/i2s/i2s_ll_stm32.c +++ b/drivers/i2s/i2s_ll_stm32.c @@ -1043,11 +1043,11 @@ static struct i2s_stm32_data i2s_stm32_data_##index = { \ UTIL_AND(DT_INST_DMAS_HAS_NAME(index, tx), \ I2S_DMA_CHANNEL_INIT(index, tx, TX, MEMORY, PERIPHERAL)),\ }; \ -DEVICE_DT_INST_DEFINE(index, \ +DEVICE_INSTANCE_FROM_DT_INST(index, \ &i2s_stm32_initialize, NULL, \ &i2s_stm32_data_##index, \ &i2s_stm32_config_##index, POST_KERNEL, \ - CONFIG_I2S_INIT_PRIORITY, &i2s_stm32_driver_api); \ + &i2s_stm32_driver_api); \ \ static void i2s_stm32_irq_config_func_##index(const struct device *dev) \ { \ diff --git a/drivers/i2s/i2s_mcux_flexcomm.c b/drivers/i2s/i2s_mcux_flexcomm.c index f91aa3489a546..ee20f01dd1bd7 100644 --- a/drivers/i2s/i2s_mcux_flexcomm.c +++ b/drivers/i2s/i2s_mcux_flexcomm.c @@ -971,13 +971,12 @@ static int i2s_mcux_init(const struct device *dev) static struct i2s_mcux_data i2s_mcux_data_##id = { \ I2S_DMA_CHANNELS(id) \ }; \ - DEVICE_DT_INST_DEFINE(id, \ - &i2s_mcux_init, \ - NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(id, \ + &i2s_mcux_init, \ + NULL, \ &i2s_mcux_data_##id, \ &i2s_mcux_config_##id, \ POST_KERNEL, \ - CONFIG_I2S_INIT_PRIORITY, \ &i2s_mcux_driver_api); \ static void i2s_mcux_config_func_##id(const struct device *dev) \ { \ diff --git a/drivers/i2s/i2s_mcux_sai.c b/drivers/i2s/i2s_mcux_sai.c index 27439d6f46b09..ae863939caad6 100644 --- a/drivers/i2s/i2s_mcux_sai.c +++ b/drivers/i2s/i2s_mcux_sai.c @@ -1234,9 +1234,8 @@ static const struct i2s_driver_api i2s_mcux_driver_api = { }, \ }; \ \ - DEVICE_DT_INST_DEFINE(i2s_id, &i2s_mcux_initialize, NULL, &i2s_##i2s_id##_data, \ - &i2s_##i2s_id##_config, POST_KERNEL, CONFIG_I2S_INIT_PRIORITY, \ - &i2s_mcux_driver_api); \ + DEVICE_INSTANCE_FROM_DT_INST(i2s_id, &i2s_mcux_initialize, NULL, &i2s_##i2s_id##_data, \ + &i2s_##i2s_id##_config, POST_KERNEL, &i2s_mcux_driver_api); \ \ static void i2s_irq_connect_##i2s_id(const struct device *dev) \ { \ diff --git a/drivers/i2s/i2s_nrfx.c b/drivers/i2s/i2s_nrfx.c index 1bc71f649d6cb..e9ad038bfbb7d 100644 --- a/drivers/i2s/i2s_nrfx.c +++ b/drivers/i2s/i2s_nrfx.c @@ -978,10 +978,9 @@ static const struct i2s_driver_api i2s_nrf_drv_api = { hfclkaudio_frequency), \ "Clock source ACLK requires the hfclkaudio-frequency " \ "property to be defined in the nordic,nrf-clock node."); \ - DEVICE_DT_DEFINE(I2S(idx), i2s_nrfx_init##idx, NULL, \ - &i2s_nrfx_data##idx, &i2s_nrfx_cfg##idx, \ - POST_KERNEL, CONFIG_I2S_INIT_PRIORITY, \ - &i2s_nrf_drv_api); + DEVICE_INSTANCE(I2S(idx), i2s_nrfx_init##idx, NULL, \ + &i2s_nrfx_data##idx, &i2s_nrfx_cfg##idx, \ + POST_KERNEL, &i2s_nrf_drv_api); #ifdef CONFIG_HAS_HW_NRF_I2S0 I2S_NRFX_DEVICE(0); diff --git a/drivers/i2s/i2s_sam_ssc.c b/drivers/i2s/i2s_sam_ssc.c index d18011755b78a..987daaf17a379 100644 --- a/drivers/i2s/i2s_sam_ssc.c +++ b/drivers/i2s/i2s_sam_ssc.c @@ -1048,6 +1048,6 @@ static struct i2s_sam_dev_data i2s0_sam_data = { }, }; -DEVICE_DT_INST_DEFINE(0, &i2s_sam_initialize, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &i2s_sam_initialize, NULL, &i2s0_sam_data, &i2s0_sam_config, POST_KERNEL, - CONFIG_I2S_INIT_PRIORITY, &i2s_sam_driver_api); + &i2s_sam_driver_api); diff --git a/drivers/i2s/i2s_test.c b/drivers/i2s/i2s_test.c index 9c5688b5b97c3..9a9be93301434 100644 --- a/drivers/i2s/i2s_test.c +++ b/drivers/i2s/i2s_test.c @@ -49,7 +49,7 @@ static int vnd_i2s_init(const struct device *dev) } #define VND_I2S_INIT(index) \ - DEVICE_DT_INST_DEFINE(index, &vnd_i2s_init, NULL, NULL, NULL, POST_KERNEL, \ - CONFIG_I2S_INIT_PRIORITY, &vnd_i2s_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(index, &vnd_i2s_init, NULL, NULL, NULL, POST_KERNEL, \ + &vnd_i2s_driver_api); DT_INST_FOREACH_STATUS_OKAY(VND_I2S_INIT) diff --git a/drivers/i3c/i3c_cdns.c b/drivers/i3c/i3c_cdns.c index 1690b33f9a43b..f57d1ee53bfbc 100644 --- a/drivers/i3c/i3c_cdns.c +++ b/drivers/i3c/i3c_cdns.c @@ -3331,8 +3331,8 @@ static struct i3c_driver_api api = { .common.ctrl_config.scl.i3c = DT_INST_PROP_OR(n, i3c_scl_hz, 0), \ .common.ctrl_config.scl.i2c = DT_INST_PROP_OR(n, i2c_scl_hz, 0), \ }; \ - DEVICE_DT_INST_DEFINE(n, cdns_i3c_bus_init, NULL, &i3c_data_##n, &i3c_config_##n, \ - POST_KERNEL, CONFIG_I3C_CONTROLLER_INIT_PRIORITY, &api); \ + DEVICE_INSTANCE_FROM_DT_INST(n, cdns_i3c_bus_init, NULL, &i3c_data_##n, &i3c_config_##n, \ + POST_KERNEL, &api); \ static void cdns_i3c_config_func_##n(const struct device *dev) \ { \ IRQ_CONNECT(DT_INST_IRQN(n), DT_INST_IRQ(n, priority), cdns_i3c_irq_handler, \ diff --git a/drivers/i3c/i3c_mcux.c b/drivers/i3c/i3c_mcux.c index 3c81dd0d22496..8be7b0525ff9b 100644 --- a/drivers/i3c/i3c_mcux.c +++ b/drivers/i3c/i3c_mcux.c @@ -2139,13 +2139,12 @@ static const struct i3c_driver_api mcux_i3c_driver_api = { .common.ctrl_config.scl.i3c = DT_INST_PROP_OR(id, i3c_scl_hz, 0), \ .common.ctrl_config.scl.i2c = DT_INST_PROP_OR(id, i2c_scl_hz, 0), \ }; \ - DEVICE_DT_INST_DEFINE(id, \ + DEVICE_INSTANCE_FROM_DT_INST(id, \ mcux_i3c_init, \ NULL, \ &mcux_i3c_data_##id, \ &mcux_i3c_config_##id, \ POST_KERNEL, \ - CONFIG_I3C_CONTROLLER_INIT_PRIORITY, \ &mcux_i3c_driver_api); \ static void mcux_i3c_config_func_##id(const struct device *dev) \ { \ diff --git a/drivers/i3c/i3c_npcx.c b/drivers/i3c/i3c_npcx.c index 11b4c1efe9e08..e96d0f6f17dae 100644 --- a/drivers/i3c/i3c_npcx.c +++ b/drivers/i3c/i3c_npcx.c @@ -3038,8 +3038,7 @@ static const struct i3c_driver_api npcx_i3c_driver_api = { .config_target.max_write_len = DT_INST_PROP_OR(id, maximum_write, 0), \ .config_target.supported_hdr = false, \ }; \ - DEVICE_DT_INST_DEFINE(id, npcx_i3c_init, NULL, &npcx_i3c_data_##id, &npcx_i3c_config_##id, \ - POST_KERNEL, CONFIG_I3C_CONTROLLER_INIT_PRIORITY, \ - &npcx_i3c_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(id, npcx_i3c_init, NULL, &npcx_i3c_data_##id, &npcx_i3c_config_##id,\ + POST_KERNEL, &npcx_i3c_driver_api); DT_INST_FOREACH_STATUS_OKAY(I3C_NPCX_DEVICE) diff --git a/drivers/i3c/i3c_test.c b/drivers/i3c/i3c_test.c index 165449747d859..6f694f89dfc75 100644 --- a/drivers/i3c/i3c_test.c +++ b/drivers/i3c/i3c_test.c @@ -39,9 +39,8 @@ static const struct i3c_driver_api vnd_i3c_api = { }; #define VND_I3C_INIT(n) \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, NULL, NULL, \ POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &vnd_i3c_api); DT_INST_FOREACH_STATUS_OKAY(VND_I3C_INIT) diff --git a/drivers/ieee802154/ieee802154_b91.c b/drivers/ieee802154/ieee802154_b91.c index 0a28af4715d08..b7c8143ee7026 100644 --- a/drivers/ieee802154/ieee802154_b91.c +++ b/drivers/ieee802154/ieee802154_b91.c @@ -644,11 +644,9 @@ static const struct ieee802154_radio_api b91_radio_api = { /* IEEE802154 driver registration */ #if defined(CONFIG_NET_L2_IEEE802154) || defined(CONFIG_NET_L2_OPENTHREAD) -NET_DEVICE_DT_INST_DEFINE(0, b91_init, NULL, &data, NULL, - CONFIG_IEEE802154_B91_INIT_PRIO, +NET_DEVICE_INSTANCE_FROM_DT_INST(0, b91_init, NULL, &data, NULL, &b91_radio_api, L2, L2_CTX_TYPE, MTU); #else -DEVICE_DT_INST_DEFINE(0, b91_init, NULL, &data, NULL, - POST_KERNEL, CONFIG_IEEE802154_B91_INIT_PRIO, - &b91_radio_api); +DEVICE_INSTANCE_FROM_DT_INST(0, b91_init, NULL, &data, NULL, + POST_KERNEL, &b91_radio_api); #endif diff --git a/drivers/ieee802154/ieee802154_cc1200.c b/drivers/ieee802154/ieee802154_cc1200.c index 50dad26faee89..cdd47cc3b5ed7 100644 --- a/drivers/ieee802154/ieee802154_cc1200.c +++ b/drivers/ieee802154/ieee802154_cc1200.c @@ -824,7 +824,6 @@ static const struct ieee802154_radio_api cc1200_radio_api = { .attr_get = cc1200_attr_get, }; -NET_DEVICE_DT_INST_DEFINE(0, cc1200_init, NULL, &cc1200_context_data, - &cc1200_config, CONFIG_IEEE802154_CC1200_INIT_PRIO, - &cc1200_radio_api, IEEE802154_L2, +NET_DEVICE_INSTANCE_FROM_DT_INST(0, cc1200_init, NULL, &cc1200_context_data, + &cc1200_config, &cc1200_radio_api, IEEE802154_L2, NET_L2_GET_CTX_TYPE(IEEE802154_L2), 125); diff --git a/drivers/ieee802154/ieee802154_cc13xx_cc26xx.c b/drivers/ieee802154/ieee802154_cc13xx_cc26xx.c index 62f0a151b3d78..849df3d63888b 100644 --- a/drivers/ieee802154/ieee802154_cc13xx_cc26xx.c +++ b/drivers/ieee802154/ieee802154_cc13xx_cc26xx.c @@ -816,14 +816,12 @@ static struct ieee802154_cc13xx_cc26xx_data ieee802154_cc13xx_cc26xx_data = { #endif #if defined(CONFIG_NET_L2_IEEE802154) || defined(CONFIG_NET_L2_PHY_IEEE802154) -NET_DEVICE_DT_INST_DEFINE(0, ieee802154_cc13xx_cc26xx_init, NULL, +NET_DEVICE_INSTANCE_FROM_DT_INST(0, ieee802154_cc13xx_cc26xx_init, NULL, &ieee802154_cc13xx_cc26xx_data, NULL, - CONFIG_IEEE802154_CC13XX_CC26XX_INIT_PRIO, &ieee802154_cc13xx_cc26xx_radio_api, L2, L2_CTX_TYPE, MTU); #else -DEVICE_DT_INST_DEFINE(0, ieee802154_cc13xx_cc26xx_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, ieee802154_cc13xx_cc26xx_init, NULL, &ieee802154_cc13xx_cc26xx_data, NULL, POST_KERNEL, - CONFIG_IEEE802154_CC13XX_CC26XX_INIT_PRIO, &ieee802154_cc13xx_cc26xx_radio_api); #endif diff --git a/drivers/ieee802154/ieee802154_cc13xx_cc26xx_subg.c b/drivers/ieee802154/ieee802154_cc13xx_cc26xx_subg.c index 3f6d7067705b6..e0e30effe53d9 100644 --- a/drivers/ieee802154/ieee802154_cc13xx_cc26xx_subg.c +++ b/drivers/ieee802154/ieee802154_cc13xx_cc26xx_subg.c @@ -1053,15 +1053,13 @@ static struct ieee802154_cc13xx_cc26xx_subg_data ieee802154_cc13xx_cc26xx_subg_d }; #if defined(CONFIG_NET_L2_IEEE802154) -NET_DEVICE_DT_INST_DEFINE(0, ieee802154_cc13xx_cc26xx_subg_init, NULL, +NET_DEVICE_INSTANCE_FROM_DT_INST(0, ieee802154_cc13xx_cc26xx_subg_init, NULL, &ieee802154_cc13xx_cc26xx_subg_data, NULL, - CONFIG_IEEE802154_CC13XX_CC26XX_SUB_GHZ_INIT_PRIO, &ieee802154_cc13xx_cc26xx_subg_radio_api, IEEE802154_L2, NET_L2_GET_CTX_TYPE(IEEE802154_L2), IEEE802154_MTU); #else -DEVICE_DT_INST_DEFINE(0, ieee802154_cc13xx_cc26xx_subg_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, ieee802154_cc13xx_cc26xx_subg_init, NULL, &ieee802154_cc13xx_cc26xx_subg_data, NULL, POST_KERNEL, - CONFIG_IEEE802154_CC13XX_CC26XX_SUB_GHZ_INIT_PRIO, &ieee802154_cc13xx_cc26xx_subg_radio_api); #endif diff --git a/drivers/ieee802154/ieee802154_cc2520.c b/drivers/ieee802154/ieee802154_cc2520.c index b1c7dd699e735..5a981cc84a43a 100644 --- a/drivers/ieee802154/ieee802154_cc2520.c +++ b/drivers/ieee802154/ieee802154_cc2520.c @@ -1070,13 +1070,11 @@ static const struct ieee802154_radio_api cc2520_radio_api = { }; #if defined(CONFIG_IEEE802154_RAW_MODE) -DEVICE_DT_INST_DEFINE(0, cc2520_init, NULL, &cc2520_context_data, NULL, - POST_KERNEL, CONFIG_IEEE802154_CC2520_INIT_PRIO, - &cc2520_radio_api); +DEVICE_INSTANCE_FROM_DT_INST(0, cc2520_init, NULL, &cc2520_context_data, NULL, + POST_KERNEL, &cc2520_radio_api); #else -NET_DEVICE_DT_INST_DEFINE(0, cc2520_init, NULL, &cc2520_context_data, - &cc2520_config, CONFIG_IEEE802154_CC2520_INIT_PRIO, - &cc2520_radio_api, IEEE802154_L2, +NET_DEVICE_INSTANCE_FROM_DT_INST(0, cc2520_init, NULL, &cc2520_context_data, + &cc2520_config, &cc2520_radio_api, IEEE802154_L2, NET_L2_GET_CTX_TYPE(IEEE802154_L2), 125); #endif @@ -1404,9 +1402,8 @@ struct crypto_driver_api cc2520_crypto_api = { .cipher_async_callback_set = NULL }; -DEVICE_DEFINE(cc2520_crypto, "cc2520_crypto", - cc2520_crypto_init, NULL, +DEVICE_INSTANCE(cc2520_crypto, cc2520_crypto_init, NULL, &cc2520_context_data, NULL, POST_KERNEL, - CONFIG_IEEE802154_CC2520_CRYPTO_INIT_PRIO, &cc2520_crypto_api); + &cc2520_crypto_api); #endif /* CONFIG_IEEE802154_CC2520_CRYPTO */ diff --git a/drivers/ieee802154/ieee802154_dw1000.c b/drivers/ieee802154/ieee802154_dw1000.c index b0e06488731f4..4cd32c92f87fd 100644 --- a/drivers/ieee802154/ieee802154_dw1000.c +++ b/drivers/ieee802154/ieee802154_dw1000.c @@ -1675,17 +1675,15 @@ static const struct ieee802154_radio_api dwt_radio_api = { #define DWT_PSDU_LENGTH (127 - DWT_FCS_LENGTH) #if defined(CONFIG_IEEE802154_RAW_MODE) -DEVICE_DT_INST_DEFINE(0, dw1000_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, dw1000_init, NULL, &dwt_0_context, &dw1000_0_config, - POST_KERNEL, CONFIG_IEEE802154_DW1000_INIT_PRIO, - &dwt_radio_api); + POST_KERNEL, &dwt_radio_api); #else -NET_DEVICE_DT_INST_DEFINE(0, +NET_DEVICE_INSTANCE_FROM_DT_INST(0, dw1000_init, NULL, &dwt_0_context, &dw1000_0_config, - CONFIG_IEEE802154_DW1000_INIT_PRIO, &dwt_radio_api, IEEE802154_L2, NET_L2_GET_CTX_TYPE(IEEE802154_L2), diff --git a/drivers/ieee802154/ieee802154_mcr20a.c b/drivers/ieee802154/ieee802154_mcr20a.c index a57de53754ea7..8fa76bdd66eb2 100644 --- a/drivers/ieee802154/ieee802154_mcr20a.c +++ b/drivers/ieee802154/ieee802154_mcr20a.c @@ -1464,13 +1464,12 @@ static const struct ieee802154_radio_api mcr20a_radio_api = { }; #if defined(CONFIG_IEEE802154_RAW_MODE) -DEVICE_DT_INST_DEFINE(0, mcr20a_init, NULL, &mcr20a_context_data, +DEVICE_INSTANCE_FROM_DT_INST(0, mcr20a_init, NULL, &mcr20a_context_data, &mcr20a_config, POST_KERNEL, - CONFIG_IEEE802154_MCR20A_INIT_PRIO, &mcr20a_radio_api); + &mcr20a_radio_api); #else -NET_DEVICE_DT_INST_DEFINE(0, mcr20a_init, NULL, &mcr20a_context_data, - &mcr20a_config, CONFIG_IEEE802154_MCR20A_INIT_PRIO, - &mcr20a_radio_api, IEEE802154_L2, +NET_DEVICE_INSTANCE_FROM_DT_INST(0, mcr20a_init, NULL, &mcr20a_context_data, + &mcr20a_config, &mcr20a_radio_api, IEEE802154_L2, NET_L2_GET_CTX_TYPE(IEEE802154_L2), MCR20A_PSDU_LENGTH); #endif diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index e9a0433d3b591..9ad6af8bd2566 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -1297,11 +1297,10 @@ static const struct ieee802154_radio_api nrf5_radio_api = { #endif #if defined(CONFIG_NET_L2_PHY_IEEE802154) -NET_DEVICE_DT_INST_DEFINE(0, nrf5_init, NULL, &nrf5_data, &nrf5_radio_cfg, - CONFIG_IEEE802154_NRF5_INIT_PRIO, &nrf5_radio_api, L2, +NET_DEVICE_INSTANCE_FROM_DT_INST(0, nrf5_init, NULL, &nrf5_data, &nrf5_radio_cfg, + &nrf5_radio_api, L2, L2_CTX_TYPE, MTU); #else -DEVICE_DT_INST_DEFINE(0, nrf5_init, NULL, &nrf5_data, &nrf5_radio_cfg, - POST_KERNEL, CONFIG_IEEE802154_NRF5_INIT_PRIO, - &nrf5_radio_api); +DEVICE_INSTANCE_FROM_DT_INST(0, nrf5_init, NULL, &nrf5_data, &nrf5_radio_cfg, + POST_KERNEL, &nrf5_radio_api); #endif diff --git a/drivers/ieee802154/ieee802154_rf2xx.c b/drivers/ieee802154/ieee802154_rf2xx.c index 1dd00c213ba7d..254ed99529548 100644 --- a/drivers/ieee802154/ieee802154_rf2xx.c +++ b/drivers/ieee802154/ieee802154_rf2xx.c @@ -1150,24 +1150,22 @@ static const struct ieee802154_radio_api rf2xx_radio_api = { } #define IEEE802154_RF2XX_RAW_DEVICE_INIT(n) \ - DEVICE_DT_INST_DEFINE( \ + DEVICE_INSTANCE_FROM_DT_INST( \ n, \ &rf2xx_init, \ NULL, \ &rf2xx_ctx_data_##n, \ &rf2xx_ctx_config_##n, \ POST_KERNEL, \ - CONFIG_IEEE802154_RF2XX_INIT_PRIO, \ &rf2xx_radio_api) #define IEEE802154_RF2XX_NET_DEVICE_INIT(n) \ - NET_DEVICE_DT_INST_DEFINE( \ + NET_DEVICE_INSTANCE_FROM_DT_INST( \ n, \ &rf2xx_init, \ NULL, \ &rf2xx_ctx_data_##n, \ &rf2xx_ctx_config_##n, \ - CONFIG_IEEE802154_RF2XX_INIT_PRIO, \ &rf2xx_radio_api, \ L2, \ L2_CTX_TYPE, \ diff --git a/drivers/ieee802154/ieee802154_uart_pipe.c b/drivers/ieee802154/ieee802154_uart_pipe.c index 3e006adacd1e5..6372da86400fa 100644 --- a/drivers/ieee802154/ieee802154_uart_pipe.c +++ b/drivers/ieee802154/ieee802154_uart_pipe.c @@ -398,7 +398,7 @@ static const struct ieee802154_radio_api upipe_radio_api = { .attr_get = upipe_attr_get, }; -NET_DEVICE_DT_INST_DEFINE(0, upipe_init, NULL, &upipe_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &upipe_radio_api, +NET_DEVICE_INSTANCE_FROM_DT_INST(0, upipe_init, NULL, &upipe_context_data, NULL, + &upipe_radio_api, IEEE802154_L2, NET_L2_GET_CTX_TYPE(IEEE802154_L2), IEEE802154_MTU); diff --git a/drivers/input/input_adc_keys.c b/drivers/input/input_adc_keys.c index d37d79bf0987c..0272a2309fbed 100644 --- a/drivers/input/input_adc_keys.c +++ b/drivers/input/input_adc_keys.c @@ -226,7 +226,7 @@ static int adc_keys_init(const struct device *dev) .key_cnt = ARRAY_SIZE(adc_keys_key_code_##n), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, adc_keys_init, NULL, &adc_keys_data_##n, &adc_keys_cfg_##n, \ - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL); + DEVICE_INSTANCE_FROM_DT_INST(n, adc_keys_init, NULL, &adc_keys_data_##n, &adc_keys_cfg_##n,\ + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(ADC_KEYS_INST) diff --git a/drivers/input/input_analog_axis.c b/drivers/input/input_analog_axis.c index f58d4b77a4025..5284ee5e674d8 100644 --- a/drivers/input/input_analog_axis.c +++ b/drivers/input/input_analog_axis.c @@ -369,8 +369,8 @@ static int analog_axis_pm_action(const struct device *dev, \ PM_DEVICE_DT_INST_DEFINE(inst, analog_axis_pm_action); \ \ - DEVICE_DT_INST_DEFINE(inst, analog_axis_init, PM_DEVICE_DT_INST_GET(inst), \ + DEVICE_INSTANCE_FROM_DT_INST(inst, analog_axis_init, PM_DEVICE_DT_INST_GET(inst), \ &analog_axis_data_##inst, &analog_axis_cfg_##inst, \ - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL); + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(ANALOG_AXIS_INIT) diff --git a/drivers/input/input_cap1203.c b/drivers/input/input_cap1203.c index 91965d3c255ce..8af24eb73c938 100644 --- a/drivers/input/input_cap1203.c +++ b/drivers/input/input_cap1203.c @@ -205,8 +205,7 @@ static int cap1203_init(const struct device *dev) .input_codes = cap1203_input_codes_##inst, \ }; \ static struct cap1203_data cap1203_data_##index; \ - DEVICE_DT_INST_DEFINE(index, cap1203_init, NULL, &cap1203_data_##index, \ - &cap1203_config_##index, POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, \ - NULL); + DEVICE_INSTANCE_FROM_DT_INST(index, cap1203_init, NULL, &cap1203_data_##index, \ + &cap1203_config_##index, POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(CAP1203_INIT) diff --git a/drivers/input/input_cf1133.c b/drivers/input/input_cf1133.c index 4907772f37d08..27a6ae7bf6fbf 100644 --- a/drivers/input/input_cf1133.c +++ b/drivers/input/input_cf1133.c @@ -327,8 +327,8 @@ static int cf1133_init(const struct device *dev) }; \ static struct cf1133_data cf1133_data_##index; \ \ - DEVICE_DT_INST_DEFINE(index, cf1133_init, NULL, &cf1133_data_##index, \ + DEVICE_INSTANCE_FROM_DT_INST(index, cf1133_init, NULL, &cf1133_data_##index, \ &cf1133_config_##index, POST_KERNEL, \ - CONFIG_INPUT_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(CF1133_INIT); diff --git a/drivers/input/input_chsc6x.c b/drivers/input/input_chsc6x.c index 2ef6880725ba1..d91f93827829a 100644 --- a/drivers/input/input_chsc6x.c +++ b/drivers/input/input_chsc6x.c @@ -132,8 +132,7 @@ static int chsc6x_init(const struct device *dev) .int_gpio = GPIO_DT_SPEC_INST_GET(index, irq_gpios), \ }; \ static struct chsc6x_data chsc6x_data_##index; \ - DEVICE_DT_INST_DEFINE(index, chsc6x_init, NULL, &chsc6x_data_##index, \ - &chsc6x_config_##index, POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, \ - NULL); + DEVICE_INSTANCE_FROM_DT_INST(index, chsc6x_init, NULL, &chsc6x_data_##index, \ + &chsc6x_config_##index, POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(CHSC6X_DEFINE) diff --git a/drivers/input/input_cst816s.c b/drivers/input/input_cst816s.c index 84381bac4c2df..b4914256058f9 100644 --- a/drivers/input/input_cst816s.c +++ b/drivers/input/input_cst816s.c @@ -300,8 +300,7 @@ static int cst816s_init(const struct device *dev) .rst_gpio = GPIO_DT_SPEC_INST_GET_OR(index, rst_gpios, {}), \ }; \ static struct cst816s_data cst816s_data_##index; \ - DEVICE_DT_INST_DEFINE(index, cst816s_init, NULL, &cst816s_data_##index, \ - &cst816s_config_##index, POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, \ - NULL); + DEVICE_INSTANCE_FROM_DT_INST(index, cst816s_init, NULL, &cst816s_data_##index, \ + &cst816s_config_##index, POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(CST816S_DEFINE) diff --git a/drivers/input/input_esp32_touch_sensor.c b/drivers/input/input_esp32_touch_sensor.c index c8595508107bf..ea303a513d899 100644 --- a/drivers/input/input_esp32_touch_sensor.c +++ b/drivers/input/input_esp32_touch_sensor.c @@ -328,12 +328,11 @@ static int esp32_touch_sensor_init(const struct device *dev) \ static struct esp32_touch_sensor_data esp32_touch_sensor_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &esp32_touch_sensor_init, \ NULL, \ &esp32_touch_sensor_data_##inst, \ &esp32_touch_sensor_config_##inst, \ - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, \ - NULL); + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(ESP32_TOUCH_SENSOR_INIT) diff --git a/drivers/input/input_ft5336.c b/drivers/input/input_ft5336.c index 2b82f7fbc7b92..ef513f0e58043 100644 --- a/drivers/input/input_ft5336.c +++ b/drivers/input/input_ft5336.c @@ -303,8 +303,8 @@ static int ft5336_pm_action(const struct device *dev, (.int_gpio = GPIO_DT_SPEC_INST_GET(index, int_gpios),)) \ }; \ static struct ft5336_data ft5336_data_##index; \ - DEVICE_DT_INST_DEFINE(index, ft5336_init, PM_DEVICE_DT_INST_GET(n), \ + DEVICE_INSTANCE_FROM_DT_INST(index, ft5336_init, PM_DEVICE_DT_INST_GET(n), \ &ft5336_data_##index, &ft5336_config_##index, \ - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL); + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(FT5336_INIT) diff --git a/drivers/input/input_gpio_kbd_matrix.c b/drivers/input/input_gpio_kbd_matrix.c index 3671b9de4d835..c9ae24d68de0d 100644 --- a/drivers/input/input_gpio_kbd_matrix.c +++ b/drivers/input/input_gpio_kbd_matrix.c @@ -332,9 +332,8 @@ static const struct input_kbd_matrix_api gpio_kbd_matrix_api = { \ PM_DEVICE_DT_INST_DEFINE(n, input_kbd_matrix_pm_action); \ \ - DEVICE_DT_INST_DEFINE(n, gpio_kbd_matrix_init, PM_DEVICE_DT_INST_GET(n), \ + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_kbd_matrix_init, PM_DEVICE_DT_INST_GET(n), \ &gpio_kbd_matrix_data_##n, &gpio_kbd_matrix_cfg_##n, \ - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, \ - NULL); + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(INPUT_GPIO_KBD_MATRIX_INIT) diff --git a/drivers/input/input_gpio_keys.c b/drivers/input/input_gpio_keys.c index 6d306ace4e592..72c6c41694ebb 100644 --- a/drivers/input/input_gpio_keys.c +++ b/drivers/input/input_gpio_keys.c @@ -316,8 +316,8 @@ static int gpio_keys_pm_action(const struct device *dev, \ PM_DEVICE_DT_INST_DEFINE(i, gpio_keys_pm_action); \ \ - DEVICE_DT_INST_DEFINE(i, &gpio_keys_init, PM_DEVICE_DT_INST_GET(i), \ + DEVICE_INSTANCE_FROM_DT_INST(i, &gpio_keys_init, PM_DEVICE_DT_INST_GET(i), \ &gpio_keys_data_##i, &gpio_keys_config_##i, \ - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL); + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(GPIO_KEYS_INIT) diff --git a/drivers/input/input_gpio_qdec.c b/drivers/input/input_gpio_qdec.c index 4a9b524f46141..99caecfa852ef 100644 --- a/drivers/input/input_gpio_qdec.c +++ b/drivers/input/input_gpio_qdec.c @@ -428,10 +428,9 @@ static int gpio_qdec_pm_action(const struct device *dev, \ PM_DEVICE_DT_INST_DEFINE(n, gpio_qdec_pm_action); \ \ - DEVICE_DT_INST_DEFINE(n, gpio_qdec_init, PM_DEVICE_DT_INST_GET(n), \ + DEVICE_INSTANCE_FROM_DT_INST(n, gpio_qdec_init, PM_DEVICE_DT_INST_GET(n),\ &gpio_qdec_data_##n, \ &gpio_qdec_cfg_##n, \ - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, \ - NULL); + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(QDEC_GPIO_INIT) diff --git a/drivers/input/input_gt911.c b/drivers/input/input_gt911.c index 3b021032cf73e..18840cc476b2e 100644 --- a/drivers/input/input_gt911.c +++ b/drivers/input/input_gt911.c @@ -401,7 +401,7 @@ static int gt911_init(const struct device *dev) .alt_addr = DT_INST_PROP_OR(index, alt_addr, 0), \ }; \ static struct gt911_data gt911_data_##index; \ - DEVICE_DT_INST_DEFINE(index, gt911_init, NULL, >911_data_##index, >911_config_##index, \ - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL); + DEVICE_INSTANCE_FROM_DT_INST(index, gt911_init, NULL, >911_data_##index, >911_config_##index,\ + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(GT911_INIT) diff --git a/drivers/input/input_ili2132a.c b/drivers/input/input_ili2132a.c index be31f55bae0c5..6590a5be686c1 100644 --- a/drivers/input/input_ili2132a.c +++ b/drivers/input/input_ili2132a.c @@ -128,8 +128,7 @@ static int ili2132a_init(const struct device *dev) .irq = GPIO_DT_SPEC_INST_GET(index, irq_gpios), \ }; \ static struct ili2132a_data ili2132a_data_##index; \ - DEVICE_DT_INST_DEFINE(index, ili2132a_init, NULL, &ili2132a_data_##index, \ - &ili2132a_config_##index, POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, \ - NULL); + DEVICE_INSTANCE_FROM_DT_INST(index, ili2132a_init, NULL, &ili2132a_data_##index, \ + &ili2132a_config_##index, POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(ILI2132A_INIT) diff --git a/drivers/input/input_ite_it8xxx2_kbd.c b/drivers/input/input_ite_it8xxx2_kbd.c index c7ff590f3c9ee..068a9ab354ddb 100644 --- a/drivers/input/input_ite_it8xxx2_kbd.c +++ b/drivers/input/input_ite_it8xxx2_kbd.c @@ -254,9 +254,9 @@ static struct it8xxx2_kbd_data it8xxx2_kbd_data_0; PM_DEVICE_DT_INST_DEFINE(0, input_kbd_matrix_pm_action); -DEVICE_DT_INST_DEFINE(0, &it8xxx2_kbd_init, PM_DEVICE_DT_INST_GET(0), +DEVICE_INSTANCE_FROM_DT_INST(0, &it8xxx2_kbd_init, PM_DEVICE_DT_INST_GET(0), &it8xxx2_kbd_data_0, &it8xxx2_kbd_cfg_0, - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL); + POST_KERNEL, NULL); BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED) || IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME), diff --git a/drivers/input/input_npcx_kbd.c b/drivers/input/input_npcx_kbd.c index 0467b681b62f6..8f0f7fe127408 100644 --- a/drivers/input/input_npcx_kbd.c +++ b/drivers/input/input_npcx_kbd.c @@ -228,9 +228,9 @@ static struct npcx_kbd_data npcx_kbd_data_0; PM_DEVICE_DT_INST_DEFINE(0, input_kbd_matrix_pm_action); -DEVICE_DT_INST_DEFINE(0, npcx_kbd_init, PM_DEVICE_DT_INST_GET(0), +DEVICE_INSTANCE_FROM_DT_INST(0, npcx_kbd_init, PM_DEVICE_DT_INST_GET(0), &npcx_kbd_data_0, &npcx_kbd_cfg_0, - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL); + POST_KERNEL, NULL); BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED) || IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME), diff --git a/drivers/input/input_pat912x.c b/drivers/input/input_pat912x.c index 2e0602fcedcba..bd000021876fb 100644 --- a/drivers/input/input_pat912x.c +++ b/drivers/input/input_pat912x.c @@ -350,9 +350,8 @@ static int pat912x_pm_action(const struct device *dev, \ PM_DEVICE_DT_INST_DEFINE(n, pat912x_pm_action); \ \ - DEVICE_DT_INST_DEFINE(n, pat912x_init, PM_DEVICE_DT_INST_GET(n), \ + DEVICE_INSTANCE_FROM_DT_INST(n, pat912x_init, PM_DEVICE_DT_INST_GET(n), \ &pat912x_data_##n, &pat912x_cfg_##n, \ - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, \ - NULL); + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(PAT912X_INIT) diff --git a/drivers/input/input_paw32xx.c b/drivers/input/input_paw32xx.c index be9db7c33949f..0171f0fcd5592 100644 --- a/drivers/input/input_paw32xx.c +++ b/drivers/input/input_paw32xx.c @@ -461,9 +461,8 @@ static int paw32xx_pm_action(const struct device *dev, \ PM_DEVICE_DT_INST_DEFINE(n, paw32xx_pm_action); \ \ - DEVICE_DT_INST_DEFINE(n, paw32xx_init, PM_DEVICE_DT_INST_GET(n), \ + DEVICE_INSTANCE_FROM_DT_INST(n, paw32xx_init, PM_DEVICE_DT_INST_GET(n), \ &paw32xx_data_##n, &paw32xx_cfg_##n, \ - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, \ - NULL); + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(PAW32XX_INIT) diff --git a/drivers/input/input_pinnacle.c b/drivers/input/input_pinnacle.c index c28fceeaeb3a2..053d93049d51b 100644 --- a/drivers/input/input_pinnacle.c +++ b/drivers/input/input_pinnacle.c @@ -891,9 +891,8 @@ static int pinnacle_init(const struct device *dev) .swap_xy = DT_INST_PROP(inst, swap_xy), \ }; \ static struct pinnacle_data pinnacle_data_##inst; \ - DEVICE_DT_INST_DEFINE(inst, pinnacle_init, NULL, &pinnacle_data_##inst, \ - &pinnacle_config_##inst, POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, \ - NULL); \ + DEVICE_INSTANCE_FROM_DT_INST(inst, pinnacle_init, NULL, &pinnacle_data_##inst, \ + &pinnacle_config_##inst, POST_KERNEL, NULL); \ BUILD_ASSERT(DT_INST_PROP(inst, active_range_x_min) < \ DT_INST_PROP(inst, active_range_x_max), \ "active-range-x-min must be less than active-range-x-max"); \ diff --git a/drivers/input/input_pmw3610.c b/drivers/input/input_pmw3610.c index f88e6b2b0e3ec..366a332aae1ad 100644 --- a/drivers/input/input_pmw3610.c +++ b/drivers/input/input_pmw3610.c @@ -585,9 +585,8 @@ static int pmw3610_pm_action(const struct device *dev, \ PM_DEVICE_DT_INST_DEFINE(n, pmw3610_pm_action); \ \ - DEVICE_DT_INST_DEFINE(n, pmw3610_init, PM_DEVICE_DT_INST_GET(n), \ + DEVICE_INSTANCE_FROM_DT_INST(n, pmw3610_init, PM_DEVICE_DT_INST_GET(n), \ &pmw3610_data_##n, &pmw3610_cfg_##n, \ - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, \ - NULL); + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(PMW3610_INIT) diff --git a/drivers/input/input_sbus.c b/drivers/input/input_sbus.c index b9eb44e03e668..e637fe91695d7 100644 --- a/drivers/input/input_sbus.c +++ b/drivers/input/input_sbus.c @@ -369,7 +369,7 @@ static int input_sbus_init(const struct device *dev) .cb = sbus_uart_isr, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, input_sbus_init, NULL, &sbus_data_##n, &sbus_cfg_##n, \ - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL); + DEVICE_INSTANCE_FROM_DT_INST(n, input_sbus_init, NULL, &sbus_data_##n, &sbus_cfg_##n, \ + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(INPUT_SBUS_INIT) diff --git a/drivers/input/input_sdl_touch.c b/drivers/input/input_sdl_touch.c index 14ed5469e17b1..9754a9494a43e 100644 --- a/drivers/input/input_sdl_touch.c +++ b/drivers/input/input_sdl_touch.c @@ -43,5 +43,5 @@ static int sdl_init(const struct device *dev) static struct sdl_input_data sdl_data_0; -DEVICE_DT_INST_DEFINE(0, sdl_init, NULL, &sdl_data_0, NULL, - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, sdl_init, NULL, &sdl_data_0, NULL, + POST_KERNEL, NULL); diff --git a/drivers/input/input_stmpe811.c b/drivers/input/input_stmpe811.c index b2f95cb5066ce..a58e1224f10f6 100644 --- a/drivers/input/input_stmpe811.c +++ b/drivers/input/input_stmpe811.c @@ -542,8 +542,7 @@ static int stmpe811_init(const struct device *dev) .touch_average_control = DT_INST_ENUM_IDX(index, touch_average_control), \ .tracking_index = DT_INST_ENUM_IDX(index, tracking_index)}; \ static struct stmpe811_data stmpe811_data_##index; \ - DEVICE_DT_INST_DEFINE(index, stmpe811_init, NULL, &stmpe811_data_##index, \ - &stmpe811_config_##index, POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, \ - NULL); + DEVICE_INSTANCE_FROM_DT_INST(index, stmpe811_init, NULL, &stmpe811_data_##index, \ + &stmpe811_config_##index, POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(STMPE811_DEFINE) diff --git a/drivers/input/input_xec_kbd.c b/drivers/input/input_xec_kbd.c index f2ba263716d18..a543840c1f4c6 100644 --- a/drivers/input/input_xec_kbd.c +++ b/drivers/input/input_xec_kbd.c @@ -244,9 +244,9 @@ static struct xec_kbd_config xec_kbd_cfg_0 = { static struct xec_kbd_data kbd_data_0; -DEVICE_DT_INST_DEFINE(0, xec_kbd_init, +DEVICE_INSTANCE_FROM_DT_INST(0, xec_kbd_init, PM_DEVICE_DT_INST_GET(0), &kbd_data_0, &xec_kbd_cfg_0, - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL); + POST_KERNEL, NULL); BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, "only one microchip,xec-kbd compatible node can be supported"); diff --git a/drivers/input/input_xpt2046.c b/drivers/input/input_xpt2046.c index 6e56fcb5874ee..e2faf4f1e575f 100644 --- a/drivers/input/input_xpt2046.c +++ b/drivers/input/input_xpt2046.c @@ -249,9 +249,8 @@ static int xpt2046_init(const struct device *dev) .reads = DT_INST_PROP(index, reads), \ }; \ static struct xpt2046_data xpt2046_data_##index; \ - DEVICE_DT_INST_DEFINE(index, xpt2046_init, NULL, &xpt2046_data_##index, \ - &xpt2046_config_##index, POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, \ - NULL); \ + DEVICE_INSTANCE_FROM_DT_INST(index, xpt2046_init, NULL, &xpt2046_data_##index, \ + &xpt2046_config_##index, POST_KERNEL, NULL); \ BUILD_ASSERT(DT_INST_PROP(index, min_x) < DT_INST_PROP(index, max_x), \ "min_x must be less than max_x"); \ BUILD_ASSERT(DT_INST_PROP(index, min_y) < DT_INST_PROP(index, max_y), \ diff --git a/drivers/input/linux_evdev.c b/drivers/input/linux_evdev.c index 55d412d567c26..1327ed9f72934 100644 --- a/drivers/input/linux_evdev.c +++ b/drivers/input/linux_evdev.c @@ -110,6 +110,6 @@ static int linux_evdev_init(const struct device *dev) BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, "Only one zephyr,native-linux-evdev compatible node is supported"); -DEVICE_DT_INST_DEFINE(0, linux_evdev_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, linux_evdev_init, NULL, NULL, NULL, - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL); + POST_KERNEL, NULL); diff --git a/drivers/interrupt_controller/intc_arcv2_irq_unit.c b/drivers/interrupt_controller/intc_arcv2_irq_unit.c index 8825e1a73458c..7cd38711f343c 100644 --- a/drivers/interrupt_controller/intc_arcv2_irq_unit.c +++ b/drivers/interrupt_controller/intc_arcv2_irq_unit.c @@ -151,5 +151,5 @@ static int arc_irq_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, arc_irq_init, NULL, NULL, NULL, - PRE_KERNEL_1, 0, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, arc_irq_init, NULL, NULL, NULL, + PRE_KERNEL_1, NULL); diff --git a/drivers/interrupt_controller/intc_cavs.c b/drivers/interrupt_controller/intc_cavs.c index 38e22c233e817..81e7fd596078b 100644 --- a/drivers/interrupt_controller/intc_cavs.c +++ b/drivers/interrupt_controller/intc_cavs.c @@ -140,12 +140,12 @@ static const struct irq_next_level_api cavs_apis = { static struct cavs_ictl_runtime cavs_##n##_runtime = { \ .base_addr = DT_INST_REG_ADDR(n), \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ cavs_ictl_##n##_initialize, \ NULL, \ &cavs_##n##_runtime, &cavs_config_##n, \ PRE_KERNEL_1, \ - CONFIG_CAVS_ICTL_INIT_PRIORITY, &cavs_apis);\ + &cavs_apis); \ \ static void cavs_config_##n##_irq(const struct device *port) \ { \ diff --git a/drivers/interrupt_controller/intc_dw.c b/drivers/interrupt_controller/intc_dw.c index 1abee2e514eaf..57d544dbe7200 100644 --- a/drivers/interrupt_controller/intc_dw.c +++ b/drivers/interrupt_controller/intc_dw.c @@ -146,9 +146,9 @@ static const struct irq_next_level_api dw_ictl_apis = { .intr_get_line_state = dw_ictl_intr_get_line_state, }; -DEVICE_DT_INST_DEFINE(0, dw_ictl_initialize, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, dw_ictl_initialize, NULL, NULL, &dw_config, PRE_KERNEL_1, - CONFIG_DW_ICTL_INIT_PRIORITY, &dw_ictl_apis); + &dw_ictl_apis); static void dw_ictl_config_irq(const struct device *port) { diff --git a/drivers/interrupt_controller/intc_dw_ace.c b/drivers/interrupt_controller/intc_dw_ace.c index 40f61a69e4e6a..8c1f82f8369e8 100644 --- a/drivers/interrupt_controller/intc_dw_ace.c +++ b/drivers/interrupt_controller/intc_dw_ace.c @@ -176,9 +176,8 @@ static const struct dw_ace_v1_ictl_driver_api dw_ictl_ace_v1x_apis = { #endif }; -DEVICE_DT_INST_DEFINE(0, dw_ace_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, - &dw_ictl_ace_v1x_apis); +DEVICE_INSTANCE_FROM_DT_INST(0, dw_ace_init, NULL, NULL, NULL, + PRE_KERNEL_1, &dw_ictl_ace_v1x_apis); IRQ_PARENT_ENTRY_DEFINE(ace_intc, DEVICE_DT_INST_GET(0), DT_INST_IRQN(0), INTC_BASE_ISR_TBL_OFFSET(DT_DRV_INST(0)), diff --git a/drivers/interrupt_controller/intc_eirq_nxp_s32.c b/drivers/interrupt_controller/intc_eirq_nxp_s32.c index 1992420ce7c3a..2b14c9ccf9e6a 100644 --- a/drivers/interrupt_controller/intc_eirq_nxp_s32.c +++ b/drivers/interrupt_controller/intc_eirq_nxp_s32.c @@ -255,8 +255,7 @@ static int eirq_nxp_s32_init(const struct device *dev) \ return 0; \ } \ - DEVICE_DT_INST_DEFINE(n, eirq_nxp_s32_init_##n, NULL, &eirq_nxp_s32_data_##n, \ - &eirq_nxp_s32_conf_##n, PRE_KERNEL_2, CONFIG_INTC_INIT_PRIORITY, \ - NULL); + DEVICE_INSTANCE_FROM_DT_INST(n, eirq_nxp_s32_init_##n, NULL, &eirq_nxp_s32_data_##n, \ + &eirq_nxp_s32_conf_##n, PRE_KERNEL_2, NULL); DT_INST_FOREACH_STATUS_OKAY(EIRQ_NXP_S32_INIT_DEVICE) diff --git a/drivers/interrupt_controller/intc_exti_stm32.c b/drivers/interrupt_controller/intc_exti_stm32.c index f83fbf9b4e1b6..cb0ea338e2126 100644 --- a/drivers/interrupt_controller/intc_exti_stm32.c +++ b/drivers/interrupt_controller/intc_exti_stm32.c @@ -228,11 +228,10 @@ static int stm32_exti_init(const struct device *dev) } static struct stm32_exti_data exti_data; -DEVICE_DT_DEFINE(EXTI_NODE, &stm32_exti_init, +DEVICE_INSTANCE(EXTI_NODE, &stm32_exti_init, NULL, &exti_data, NULL, - PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, - NULL); + PRE_KERNEL_1, NULL); /** * @brief EXTI GPIO interrupt controller API implementation diff --git a/drivers/interrupt_controller/intc_gd32_exti.c b/drivers/interrupt_controller/intc_gd32_exti.c index 587870553aab4..b5ef2b0848dde 100644 --- a/drivers/interrupt_controller/intc_gd32_exti.c +++ b/drivers/interrupt_controller/intc_gd32_exti.c @@ -194,5 +194,5 @@ static int gd32_exti_init(const struct device *dev) static struct gd32_exti_data data; -DEVICE_DT_INST_DEFINE(0, gd32_exti_init, NULL, &data, NULL, PRE_KERNEL_1, - CONFIG_INTC_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, gd32_exti_init, NULL, &data, NULL, PRE_KERNEL_1, + NULL); diff --git a/drivers/interrupt_controller/intc_gic.c b/drivers/interrupt_controller/intc_gic.c index 0b3050cf1af62..2b34842923fe7 100644 --- a/drivers/interrupt_controller/intc_gic.c +++ b/drivers/interrupt_controller/intc_gic.c @@ -297,8 +297,8 @@ int arm_gic_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, arm_gic_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, arm_gic_init, NULL, NULL, NULL, + PRE_KERNEL_1, NULL); #ifdef CONFIG_SMP void arm_gic_secondary_init(void) diff --git a/drivers/interrupt_controller/intc_gicv3.c b/drivers/interrupt_controller/intc_gicv3.c index c84a42c7e3632..036b4e9c25d18 100644 --- a/drivers/interrupt_controller/intc_gicv3.c +++ b/drivers/interrupt_controller/intc_gicv3.c @@ -626,8 +626,8 @@ int arm_gic_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, arm_gic_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, arm_gic_init, NULL, NULL, NULL, + PRE_KERNEL_1, NULL); #ifdef CONFIG_SMP void arm_gic_secondary_init(void) diff --git a/drivers/interrupt_controller/intc_gicv3_its.c b/drivers/interrupt_controller/intc_gicv3_its.c index c8e754e1752b8..67f061aab659f 100644 --- a/drivers/interrupt_controller/intc_gicv3_its.c +++ b/drivers/interrupt_controller/intc_gicv3_its.c @@ -673,11 +673,10 @@ struct its_driver_api gicv3_its_api = { .cmd_queue = gicv3_its_cmd##n, \ .cmd_queue_size = sizeof(gicv3_its_cmd##n), \ }; \ - DEVICE_DT_INST_DEFINE(n, &gicv3_its_init, NULL, \ - &gicv3_its_data##n, \ - &gicv3_its_config##n, \ - PRE_KERNEL_1, \ - CONFIG_INTC_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &gicv3_its_init, NULL, \ + &gicv3_its_data##n, \ + &gicv3_its_config##n, \ + PRE_KERNEL_1, \ &gicv3_its_api); DT_INST_FOREACH_STATUS_OKAY(GICV3_ITS_INIT) diff --git a/drivers/interrupt_controller/intc_gpio_stm32wb0.c b/drivers/interrupt_controller/intc_gpio_stm32wb0.c index 3e1105acda0ba..83226e1aa10ab 100644 --- a/drivers/interrupt_controller/intc_gpio_stm32wb0.c +++ b/drivers/interrupt_controller/intc_gpio_stm32wb0.c @@ -178,9 +178,9 @@ static int stm32wb0_gpio_intc_init(const struct device *dev) return 0; } -DEVICE_DT_DEFINE(INTC_NODE, &stm32wb0_gpio_intc_init, +DEVICE_INSTANCE(INTC_NODE, &stm32wb0_gpio_intc_init, NULL, &gpio_intc_data, NULL, PRE_KERNEL_1, - CONFIG_INTC_INIT_PRIORITY, NULL); + NULL); /** * @brief STM32 GPIO interrupt controller API implementation diff --git a/drivers/interrupt_controller/intc_intel_vtd.c b/drivers/interrupt_controller/intc_intel_vtd.c index fe2431d8a17cb..3c4d7f9397ddd 100644 --- a/drivers/interrupt_controller/intc_intel_vtd.c +++ b/drivers/interrupt_controller/intc_intel_vtd.c @@ -545,7 +545,7 @@ static const struct vtd_ictl_cfg vtd_ictl_cfg_0 = { DEVICE_MMIO_ROM_INIT(DT_DRV_INST(0)), }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, vtd_ictl_init, NULL, &vtd_ictl_data_0, &vtd_ictl_cfg_0, - PRE_KERNEL_1, CONFIG_INTEL_VTD_ICTL_INIT_PRIORITY, &vtd_api); + PRE_KERNEL_1, &vtd_api); diff --git a/drivers/interrupt_controller/intc_ioapic.c b/drivers/interrupt_controller/intc_ioapic.c index 0748ddccf7682..e337b5b143d89 100644 --- a/drivers/interrupt_controller/intc_ioapic.c +++ b/drivers/interrupt_controller/intc_ioapic.c @@ -537,5 +537,5 @@ static void IoApicRedUpdateLo(unsigned int irq, PM_DEVICE_DT_INST_DEFINE(0, ioapic_pm_action); -DEVICE_DT_INST_DEFINE(0, ioapic_init, PM_DEVICE_DT_INST_GET(0), NULL, NULL, - PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, ioapic_init, PM_DEVICE_DT_INST_GET(0), NULL, NULL, + PRE_KERNEL_1, NULL); diff --git a/drivers/interrupt_controller/intc_irqmp.c b/drivers/interrupt_controller/intc_irqmp.c index 6f023f38dcd20..1d138a86e103f 100644 --- a/drivers/interrupt_controller/intc_irqmp.c +++ b/drivers/interrupt_controller/intc_irqmp.c @@ -121,5 +121,5 @@ static int irqmp_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, irqmp_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, irqmp_init, NULL, NULL, NULL, + PRE_KERNEL_1, NULL); diff --git a/drivers/interrupt_controller/intc_loapic.c b/drivers/interrupt_controller/intc_loapic.c index 5d6aa8537f340..09e8928378969 100644 --- a/drivers/interrupt_controller/intc_loapic.c +++ b/drivers/interrupt_controller/intc_loapic.c @@ -414,8 +414,8 @@ static int loapic_pm_action(const struct device *dev, PM_DEVICE_DT_INST_DEFINE(0, loapic_pm_action); -DEVICE_DT_INST_DEFINE(0, loapic_init, PM_DEVICE_DT_INST_GET(0), NULL, NULL, - PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, loapic_init, PM_DEVICE_DT_INST_GET(0), NULL, NULL, + PRE_KERNEL_1, NULL); #if CONFIG_LOAPIC_SPURIOUS_VECTOR extern void z_loapic_spurious_handler(void); diff --git a/drivers/interrupt_controller/intc_mchp_ecia_xec.c b/drivers/interrupt_controller/intc_mchp_ecia_xec.c index c4844643ccbff..4c8cfe2d66665 100644 --- a/drivers/interrupt_controller/intc_mchp_ecia_xec.c +++ b/drivers/interrupt_controller/intc_mchp_ecia_xec.c @@ -572,10 +572,9 @@ static int xec_ecia_init(const struct device *dev) DT_FOREACH_PROP_ELEM(n, sources, XEC_GIRQ_SOURCES2) \ }; \ \ - DEVICE_DT_DEFINE(n, xec_girq_init_##n, \ + DEVICE_INSTANCE(n, xec_girq_init_##n, \ NULL, &xec_data_girq_##n, &xec_config_girq_##n, \ - PRE_KERNEL_1, CONFIG_XEC_GIRQ_INIT_PRIORITY, \ - NULL); \ + PRE_KERNEL_1, NULL); \ \ static int xec_girq_init_##n(const struct device *dev) \ { \ @@ -610,10 +609,9 @@ static const struct xec_ecia_config xec_config_ecia = { DT_FOREACH_CHILD_STATUS_OKAY(DT_NODELABEL(ecia), XEC_GIRQ_HANDLE) }; -DEVICE_DT_DEFINE(DT_NODELABEL(ecia), xec_ecia_init, +DEVICE_INSTANCE(DT_NODELABEL(ecia), xec_ecia_init, NULL, NULL, &xec_config_ecia, - PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, - NULL); + PRE_KERNEL_1, NULL); /* look up GIRQ node handle from ECIA configuration */ static const struct device *get_girq_dev(int girq_num) diff --git a/drivers/interrupt_controller/intc_miwu.c b/drivers/interrupt_controller/intc_miwu.c index 726a2f933454f..ccedc9f832622 100644 --- a/drivers/interrupt_controller/intc_miwu.c +++ b/drivers/interrupt_controller/intc_miwu.c @@ -453,12 +453,12 @@ int npcx_miwu_manage_callback(struct miwu_callback *cb, bool set) }; \ struct intc_miwu_data miwu_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, \ - NPCX_MIWU_INIT_FUNC(inst), \ - NULL, \ - &miwu_data_##inst, &miwu_config_##inst, \ - PRE_KERNEL_1, \ - CONFIG_INTC_INIT_PRIORITY, NULL); \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ + NPCX_MIWU_INIT_FUNC(inst), \ + NULL, \ + &miwu_data_##inst, &miwu_config_##inst, \ + PRE_KERNEL_1, \ + NULL); \ \ NPCX_MIWU_ISR_FUNC_IMPL(inst) \ \ diff --git a/drivers/interrupt_controller/intc_mtk_adsp.c b/drivers/interrupt_controller/intc_mtk_adsp.c index b562c9b501b7a..d7d4cb95bcf53 100644 --- a/drivers/interrupt_controller/intc_mtk_adsp.c +++ b/drivers/interrupt_controller/intc_mtk_adsp.c @@ -77,6 +77,6 @@ static const struct intc_mtk_cfg dev_cfg##N = { \ .sw_isr_off = (N + 1) * 32, \ .enable_reg = (void *)DT_INST_REG_ADDR(N), \ .status_reg = (void *)DT_INST_PROP(N, status_reg) }; \ -DEVICE_DT_INST_DEFINE(N, NULL, NULL, NULL, &dev_cfg##N, PRE_KERNEL_1, 0, NULL); +DEVICE_INSTANCE_FROM_DT_INST(N, NULL, NULL, NULL, &dev_cfg##N, PRE_KERNEL_1, NULL); DT_INST_FOREACH_STATUS_OKAY(DEF_DEV); diff --git a/drivers/interrupt_controller/intc_nuclei_eclic.c b/drivers/interrupt_controller/intc_nuclei_eclic.c index f141864bbf041..97b77a7e97738 100644 --- a/drivers/interrupt_controller/intc_nuclei_eclic.c +++ b/drivers/interrupt_controller/intc_nuclei_eclic.c @@ -189,5 +189,5 @@ static int nuclei_eclic_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, nuclei_eclic_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, nuclei_eclic_init, NULL, NULL, NULL, + PRE_KERNEL_1, NULL); diff --git a/drivers/interrupt_controller/intc_nxp_irqsteer.c b/drivers/interrupt_controller/intc_nxp_irqsteer.c index 02c310dfbe666..a0a978c4be603 100644 --- a/drivers/interrupt_controller/intc_nxp_irqsteer.c +++ b/drivers/interrupt_controller/intc_nxp_irqsteer.c @@ -599,12 +599,11 @@ static struct irqsteer_config irqsteer_config = { /* assumption: only 1 IRQ_STEER instance */ PM_DEVICE_DT_INST_DEFINE(0, irqstr_pm_action); -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, &irqsteer_init, PM_DEVICE_DT_INST_GET(0), NULL, &irqsteer_config, - PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, - NULL); + PRE_KERNEL_1, NULL); #define NXP_IRQSTEER_MASTER_IRQ_ENTRY_DEF(node_id) \ IRQ_PARENT_ENTRY_DEFINE(CONCAT(nxp_irqsteer_master_, DT_NODE_CHILD_IDX(node_id)), NULL, \ diff --git a/drivers/interrupt_controller/intc_nxp_pint.c b/drivers/interrupt_controller/intc_nxp_pint.c index 2a11fd7ad4584..1ee1fcbbe9866 100644 --- a/drivers/interrupt_controller/intc_nxp_pint.c +++ b/drivers/interrupt_controller/intc_nxp_pint.c @@ -210,5 +210,5 @@ static int intc_nxp_pint_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, intc_nxp_pint_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, intc_nxp_pint_init, NULL, NULL, NULL, + PRE_KERNEL_1, NULL); diff --git a/drivers/interrupt_controller/intc_plic.c b/drivers/interrupt_controller/intc_plic.c index 26468d40713f3..bff7166eb6d88 100644 --- a/drivers/interrupt_controller/intc_plic.c +++ b/drivers/interrupt_controller/intc_plic.c @@ -934,9 +934,8 @@ SHELL_CMD_REGISTER(plic, &plic_cmds, "PLIC shell commands", NULL); DT_INST_INTC_GET_AGGREGATOR_LEVEL(n)); \ PLIC_INTC_CONFIG_INIT(n) \ PLIC_INTC_DATA_INIT(n) \ - DEVICE_DT_INST_DEFINE(n, &plic_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &plic_init, NULL, \ &plic_data_##n, &plic_config_##n, \ - PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, \ - NULL); + PRE_KERNEL_1, NULL); DT_INST_FOREACH_STATUS_OKAY(PLIC_INTC_DEVICE_INIT) diff --git a/drivers/interrupt_controller/intc_renesas_ra_icu.c b/drivers/interrupt_controller/intc_renesas_ra_icu.c index 57b9ac731abef..51909072b457e 100644 --- a/drivers/interrupt_controller/intc_renesas_ra_icu.c +++ b/drivers/interrupt_controller/intc_renesas_ra_icu.c @@ -121,4 +121,4 @@ int ra_icu_irq_disconnect_dynamic(unsigned int irq, unsigned int priority, return 0; } -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1, NULL); diff --git a/drivers/interrupt_controller/intc_rv32m1_intmux.c b/drivers/interrupt_controller/intc_rv32m1_intmux.c index f5af9f70e7ebc..62ff738a49c86 100644 --- a/drivers/interrupt_controller/intc_rv32m1_intmux.c +++ b/drivers/interrupt_controller/intc_rv32m1_intmux.c @@ -216,9 +216,9 @@ static int rv32m1_intmux_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, &rv32m1_intmux_init, NULL, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &rv32m1_intmux_init, NULL, NULL, &rv32m1_intmux_cfg, PRE_KERNEL_1, - CONFIG_RV32M1_INTMUX_INIT_PRIORITY, &rv32m1_intmux_apis); + &rv32m1_intmux_apis); #define INTC_CHILD_IRQ_ENTRY_DEF(node_id) \ IRQ_PARENT_ENTRY_DEFINE(CONCAT(DT_DRV_COMPAT, _child_, DT_NODE_CHILD_IDX(node_id)), NULL, \ diff --git a/drivers/interrupt_controller/intc_sam0_eic.c b/drivers/interrupt_controller/intc_sam0_eic.c index 3bbfacdab1a04..c4f704a159e28 100644 --- a/drivers/interrupt_controller/intc_sam0_eic.c +++ b/drivers/interrupt_controller/intc_sam0_eic.c @@ -408,7 +408,6 @@ static int sam0_eic_init(const struct device *dev) } static struct sam0_eic_data eic_data; -DEVICE_DT_INST_DEFINE(0, sam0_eic_init, +DEVICE_INSTANCE_FROM_DT_INST(0, sam0_eic_init, NULL, &eic_data, NULL, - PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, - NULL); + PRE_KERNEL_1, NULL); diff --git a/drivers/interrupt_controller/intc_shared_irq.c b/drivers/interrupt_controller/intc_shared_irq.c index d8cf6c31c0c83..6c896082fbb98 100644 --- a/drivers/interrupt_controller/intc_shared_irq.c +++ b/drivers/interrupt_controller/intc_shared_irq.c @@ -178,11 +178,10 @@ void shared_irq_config_func_##n(void) \ .client_count = INST_SUPPORTS_DEP_ORDS_CNT(n), \ .config = shared_irq_config_func_##n \ }; \ - DEVICE_DT_INST_DEFINE(n, shared_irq_initialize, \ + DEVICE_INSTANCE_FROM_DT_INST(n, shared_irq_initialize, \ NULL, \ &shared_irq_data_##n, \ &shared_irq_config_##n, POST_KERNEL, \ - CONFIG_SHARED_IRQ_INIT_PRIORITY, \ &api_funcs); DT_INST_FOREACH_STATUS_OKAY(SHARED_IRQ_INIT) diff --git a/drivers/interrupt_controller/intc_swerv_pic.c b/drivers/interrupt_controller/intc_swerv_pic.c index 9ac4c4193627e..e6d99d4539d7b 100644 --- a/drivers/interrupt_controller/intc_swerv_pic.c +++ b/drivers/interrupt_controller/intc_swerv_pic.c @@ -238,5 +238,5 @@ int arch_irq_is_enabled(unsigned int irq) return !!(mie & (1 << irq)); } -DEVICE_DT_INST_DEFINE(0, swerv_pic_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, swerv_pic_init, NULL, NULL, NULL, + PRE_KERNEL_1, NULL); diff --git a/drivers/interrupt_controller/intc_vexriscv_litex.c b/drivers/interrupt_controller/intc_vexriscv_litex.c index 9d23afaa87f15..2382fea5ad7db 100644 --- a/drivers/interrupt_controller/intc_vexriscv_litex.c +++ b/drivers/interrupt_controller/intc_vexriscv_litex.c @@ -94,5 +94,5 @@ static int vexriscv_litex_irq_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, vexriscv_litex_irq_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, vexriscv_litex_irq_init, NULL, NULL, NULL, + PRE_KERNEL_1, NULL); diff --git a/drivers/interrupt_controller/intc_wkpu_nxp_s32.c b/drivers/interrupt_controller/intc_wkpu_nxp_s32.c index bc17d1b68683d..73075333e479b 100644 --- a/drivers/interrupt_controller/intc_wkpu_nxp_s32.c +++ b/drivers/interrupt_controller/intc_wkpu_nxp_s32.c @@ -220,8 +220,7 @@ static int wkpu_nxp_s32_init(const struct device *dev) \ return 0; \ } \ - DEVICE_DT_INST_DEFINE(n, wkpu_nxp_s32_init_##n, NULL, &wkpu_nxp_s32_data_##n, \ - &wkpu_nxp_s32_conf_##n, PRE_KERNEL_2, CONFIG_INTC_INIT_PRIORITY, \ - NULL); + DEVICE_INSTANCE_FROM_DT_INST(n, wkpu_nxp_s32_init_##n, NULL, &wkpu_nxp_s32_data_##n, \ + &wkpu_nxp_s32_conf_##n, PRE_KERNEL_2, NULL); DT_INST_FOREACH_STATUS_OKAY(WKPU_NXP_S32_INIT_DEVICE) diff --git a/drivers/interrupt_controller/intc_xmc4xxx.c b/drivers/interrupt_controller/intc_xmc4xxx.c index b5de41c1df933..339fc14770da3 100644 --- a/drivers/interrupt_controller/intc_xmc4xxx.c +++ b/drivers/interrupt_controller/intc_xmc4xxx.c @@ -222,6 +222,6 @@ struct intc_xmc4xxx_config intc_xmc4xxx_config0 = { }, }; -DEVICE_DT_INST_DEFINE(0, intc_xmc4xxx_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, intc_xmc4xxx_init, NULL, &intc_xmc4xxx_data0, &intc_xmc4xxx_config0, PRE_KERNEL_1, - CONFIG_INTC_INIT_PRIORITY, NULL); + NULL); diff --git a/drivers/interrupt_controller/wuc_ite_it8xxx2.c b/drivers/interrupt_controller/wuc_ite_it8xxx2.c index b8e59f8254b2b..641f41d7d32d7 100644 --- a/drivers/interrupt_controller/wuc_ite_it8xxx2.c +++ b/drivers/interrupt_controller/wuc_ite_it8xxx2.c @@ -108,13 +108,12 @@ void it8xxx2_wuc_set_polarity(const struct device *dev, uint8_t mask, uint32_t f .reg_wubemr = (uint8_t *) DT_INST_REG_ADDR_BY_IDX(inst, 3), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ - NULL, \ - NULL, \ - NULL, \ - &it8xxx2_wuc_cfg_##inst, \ - PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_OBJECTS, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ + NULL, \ + NULL, \ + NULL, \ + &it8xxx2_wuc_cfg_##inst, \ + PRE_KERNEL_1, \ NULL); DT_INST_FOREACH_STATUS_OKAY(IT8XXX2_WUC_INIT) diff --git a/drivers/ipm/ipm_cavs_host.c b/drivers/ipm/ipm_cavs_host.c index 2a6acef6efb6e..0c627d9726ee7 100644 --- a/drivers/ipm/ipm_cavs_host.c +++ b/drivers/ipm/ipm_cavs_host.c @@ -208,5 +208,5 @@ static const struct ipm_driver_api api = { static struct ipm_cavs_host_data data; -DEVICE_DEFINE(ipm_cavs_host, "ipm_cavs_host", init, NULL, &data, NULL, - PRE_KERNEL_2, 1, &api); +DEVICE_INSTANCE(ipm_cavs_host, init, NULL, &data, NULL, + PRE_KERNEL_2, &api); diff --git a/drivers/ipm/ipm_esp32.c b/drivers/ipm/ipm_esp32.c index fd84919b80a1c..f7480ca3ac387 100644 --- a/drivers/ipm/ipm_esp32.c +++ b/drivers/ipm/ipm_esp32.c @@ -301,9 +301,8 @@ static struct esp32_ipm_data esp32_ipm_device_data_##idx = { \ .control = (struct esp32_ipm_control *)DT_INST_REG_ADDR(idx), \ }; \ \ -DEVICE_DT_INST_DEFINE(idx, &esp32_ipm_init, NULL, \ - &esp32_ipm_device_data_##idx, &esp32_ipm_device_cfg_##idx, \ - PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ - &esp32_ipm_driver_api); \ +DEVICE_INSTANCE_FROM_DT_INST(idx, &esp32_ipm_init, NULL,\ + &esp32_ipm_device_data_##idx, &esp32_ipm_device_cfg_##idx,\ + PRE_KERNEL_2, &esp32_ipm_driver_api);\ DT_INST_FOREACH_STATUS_OKAY(ESP32_IPM_INIT); diff --git a/drivers/ipm/ipm_imx.c b/drivers/ipm/ipm_imx.c index b8e716af7b09d..dbbb4953a19fe 100644 --- a/drivers/ipm/ipm_imx.c +++ b/drivers/ipm/ipm_imx.c @@ -360,12 +360,11 @@ static const struct imx_mu_config imx_mu_b_config = { static struct imx_mu_data imx_mu_b_data; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, &imx_mu_init, NULL, &imx_mu_b_data, &imx_mu_b_config, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &imx_mu_driver_api); + PRE_KERNEL_1, &imx_mu_driver_api); static void imx_mu_config_func_b(const struct device *dev) { diff --git a/drivers/ipm/ipm_ivshmem.c b/drivers/ipm/ipm_ivshmem.c index f0d18a45dbdad..c793429e0698b 100644 --- a/drivers/ipm/ipm_ivshmem.c +++ b/drivers/ipm/ipm_ivshmem.c @@ -126,11 +126,10 @@ static const struct ipm_driver_api ivshmem_ipm_driver_api = { .cb = NULL, \ .user_data = NULL, \ }; \ - DEVICE_DT_INST_DEFINE(inst, \ - ivshmem_ipm_init, \ + DEVICE_INSTANCE_FROM_DT_INST(inst,\ + ivshmem_ipm_init,\ NULL, \ - &ivshmem_ipm_data_##inst, &ivshmem_ipm_cfg_##inst, \ - POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY, \ - &ivshmem_ipm_driver_api); \ + &ivshmem_ipm_data_##inst, &ivshmem_ipm_cfg_##inst,\ + POST_KERNEL, &ivshmem_ipm_driver_api);\ DT_INST_FOREACH_STATUS_OKAY(IPM_IVSHMEM_INIT); diff --git a/drivers/ipm/ipm_mbox.c b/drivers/ipm/ipm_mbox.c index 7d2c85b95329e..a456a6da62e90 100644 --- a/drivers/ipm/ipm_mbox.c +++ b/drivers/ipm/ipm_mbox.c @@ -103,13 +103,12 @@ static const struct ipm_driver_api ipm_mbox_funcs = { .mbox_tx = MBOX_DT_SPEC_INST_GET(n, tx), \ .mbox_rx = MBOX_DT_SPEC_INST_GET(n, rx), \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &ipm_mbox_init, \ NULL, \ &ipm_mbox_data_##n, \ &ipm_mbox_config_##n, \ POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &ipm_mbox_funcs); DT_INST_FOREACH_STATUS_OKAY(IPM_MBOX_DEV_DEFINE) diff --git a/drivers/ipm/ipm_mcux.c b/drivers/ipm/ipm_mcux.c index e323dc9ec786e..fd8c5f0667bb7 100644 --- a/drivers/ipm/ipm_mcux.c +++ b/drivers/ipm/ipm_mcux.c @@ -203,12 +203,11 @@ static const struct mcux_mailbox_config mcux_mailbox_0_config = { static struct mcux_mailbox_data mcux_mailbox_0_data; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, &mcux_mailbox_init, NULL, &mcux_mailbox_0_data, &mcux_mailbox_0_config, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &mcux_mailbox_driver_api); + PRE_KERNEL_1, &mcux_mailbox_driver_api); static void mcux_mailbox_config_func_0(const struct device *dev) diff --git a/drivers/ipm/ipm_mhu.c b/drivers/ipm/ipm_mhu.c index 2b83b2728c4a7..3f5e15a0c2e8b 100644 --- a/drivers/ipm/ipm_mhu.c +++ b/drivers/ipm/ipm_mhu.c @@ -183,12 +183,11 @@ static struct ipm_mhu_data ipm_mhu_data_0 = { .user_data = NULL, }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, &ipm_mhu_init, NULL, &ipm_mhu_data_0, &ipm_mhu_cfg_0, PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &ipm_mhu_driver_api); static void ipm_mhu_irq_config_func_0(const struct device *d) @@ -214,12 +213,11 @@ static struct ipm_mhu_data ipm_mhu_data_1 = { .user_data = NULL, }; -DEVICE_DT_INST_DEFINE(1, +DEVICE_INSTANCE_FROM_DT_INST(1, &ipm_mhu_init, NULL, &ipm_mhu_data_1, &ipm_mhu_cfg_1, PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &ipm_mhu_driver_api); static void ipm_mhu_irq_config_func_1(const struct device *d) diff --git a/drivers/ipm/ipm_nrfx_ipc.c b/drivers/ipm/ipm_nrfx_ipc.c index 2dfbf75823757..9c81915eeb976 100644 --- a/drivers/ipm/ipm_nrfx_ipc.c +++ b/drivers/ipm/ipm_nrfx_ipc.c @@ -104,9 +104,8 @@ static const struct ipm_driver_api ipm_nrf_driver_api = { .set_enabled = ipm_nrf_set_enabled }; -DEVICE_DT_INST_DEFINE(0, ipm_nrf_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &ipm_nrf_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, ipm_nrf_init, NULL, NULL, NULL, + PRE_KERNEL_1, &ipm_nrf_driver_api); #else @@ -216,10 +215,8 @@ static const struct ipm_driver_api vipm_nrf_##_idx##_driver_api = { \ .set_enabled = vipm_nrf_##_idx##_set_enabled \ }; \ \ -DEVICE_DEFINE(vipm_nrf_##_idx, "IPM_"#_idx, \ - vipm_nrf_init, NULL, NULL, NULL, \ - PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ - &vipm_nrf_##_idx##_driver_api) +DEVICE_INSTANCE(vipm_nrf_##_idx, vipm_nrf_init, NULL, NULL, NULL, \ + PRE_KERNEL_2, &vipm_nrf_##_idx##_driver_api) #define VIPM_DEVICE(_idx, _) \ IF_ENABLED(CONFIG_IPM_MSG_CH_##_idx##_ENABLE, (VIPM_DEVICE_1(_idx))) diff --git a/drivers/ipm/ipm_sedi.c b/drivers/ipm/ipm_sedi.c index 04a48029c6db4..f9f763cb5ba69 100644 --- a/drivers/ipm/ipm_sedi.c +++ b/drivers/ipm/ipm_sedi.c @@ -285,13 +285,12 @@ static const struct ipm_driver_api ipm_funcs = { DT_INST_IRQ(n, sense)); \ } \ PM_DEVICE_DT_DEFINE(DT_NODELABEL(ipm##n), ipm_power_ctrl); \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &ipm_init, \ - PM_DEVICE_DT_GET(DT_NODELABEL(ipm##n)), \ + PM_DEVICE_DT_GET(DT_NODELABEL(ipm##n)), \ &ipm_data_##n, \ &ipm_config_##n, \ POST_KERNEL, \ - 0, \ &ipm_funcs); DT_INST_FOREACH_STATUS_OKAY(IPM_SEDI_DEV_DEFINE) diff --git a/drivers/ipm/ipm_stm32_hsem.c b/drivers/ipm/ipm_stm32_hsem.c index b19e32d755459..a38f73fc4e41d 100644 --- a/drivers/ipm/ipm_stm32_hsem.c +++ b/drivers/ipm/ipm_stm32_hsem.c @@ -209,13 +209,12 @@ static const struct stm32_hsem_mailbox_config stm32_hsem_mailbox_0_config = { #define IPM_STM32_HSEM_INIT(inst) \ BUILD_ASSERT((inst) == 0, \ "multiple instances not supported"); \ - DEVICE_DT_INST_DEFINE(0, \ + DEVICE_INSTANCE_FROM_DT_INST(0, \ &stm32_hsem_mailbox_init, \ - NULL, \ + NULL, \ &stm32_hsem_mailbox_0_data, \ - &stm32_hsem_mailbox_0_config, \ - POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ - &stm32_hsem_mailbox_ipm_dirver_api); \ + &stm32_hsem_mailbox_0_config, \ + POST_KERNEL, \ + &stm32_hsem_mailbox_ipm_dirver_api); \ DT_INST_FOREACH_STATUS_OKAY(IPM_STM32_HSEM_INIT) diff --git a/drivers/ipm/ipm_stm32_ipcc.c b/drivers/ipm/ipm_stm32_ipcc.c index 4dc6207f2dfa8..5c7782d9eadd8 100644 --- a/drivers/ipm/ipm_stm32_ipcc.c +++ b/drivers/ipm/ipm_stm32_ipcc.c @@ -296,12 +296,11 @@ static const struct stm32_ipcc_mailbox_config stm32_ipcc_mailbox_0_config = { }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, &stm32_ipcc_mailbox_init, NULL, &stm32_IPCC_data, &stm32_ipcc_mailbox_0_config, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &stm32_ipcc_mailbox_driver_api); + POST_KERNEL, &stm32_ipcc_mailbox_driver_api); static void stm32_ipcc_mailbox_config_func(const struct device *dev) { diff --git a/drivers/ipm/ipm_xlnx_ipi.c b/drivers/ipm/ipm_xlnx_ipi.c index a7a967e3d1b8b..0ec330c7a7d2c 100644 --- a/drivers/ipm/ipm_xlnx_ipi.c +++ b/drivers/ipm/ipm_xlnx_ipi.c @@ -223,9 +223,9 @@ static struct ipm_driver_api xlnx_ipi_api = { xlnx_ipi_reg_info_zynqmp[DT_PROP(ch_node, remote_ipi_id)].ipi_ch_bit, \ .host_ipi_reg = DT_REG_ADDR_BY_NAME(DT_PARENT(ch_node), host_ipi_reg), \ }; \ - DEVICE_DT_DEFINE(ch_node, NULL, NULL, &xlnx_ipi_child_data##ch_node, \ - &xlnx_ipi_child_config##ch_node, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &xlnx_ipi_api); + DEVICE_INSTANCE(ch_node, NULL, NULL, &xlnx_ipi_child_data##ch_node, \ + &xlnx_ipi_child_config##ch_node, POST_KERNEL, \ + &xlnx_ipi_api); #define XLNX_IPI(inst) \ DT_INST_FOREACH_CHILD_STATUS_OKAY(inst, XLNX_IPI_CHILD); \ diff --git a/drivers/kscan/kscan_input.c b/drivers/kscan/kscan_input.c index 7e98ae4723e58..b911d29b54a63 100644 --- a/drivers/kscan/kscan_input.c +++ b/drivers/kscan/kscan_input.c @@ -109,10 +109,9 @@ static const struct kscan_driver_api kscan_input_driver_api = { .input_dev = DEVICE_DT_GET(DT_INST_PARENT(index)), \ }; \ static struct kscan_input_data kscan_input_data_##index; \ - DEVICE_DT_INST_DEFINE(index, kscan_input_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(index, kscan_input_init, NULL, \ &kscan_input_data_##index, \ &kscan_input_config_##index, \ - POST_KERNEL, CONFIG_KSCAN_INIT_PRIORITY, \ - &kscan_input_driver_api); + POST_KERNEL, &kscan_input_driver_api); DT_INST_FOREACH_STATUS_OKAY(KSCAN_INPUT_INIT) diff --git a/drivers/led/ht16k33.c b/drivers/led/ht16k33.c index 8985dde6a4fd2..c33f092f8a313 100644 --- a/drivers/led/ht16k33.c +++ b/drivers/led/ht16k33.c @@ -430,10 +430,10 @@ static const struct led_driver_api ht16k33_leds_api = { \ static struct ht16k33_data ht16k33_##id##_data; \ \ - DEVICE_DT_INST_DEFINE(id, &ht16k33_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(id, &ht16k33_init, NULL, \ &ht16k33_##id##_data, \ &ht16k33_##id##_cfg, POST_KERNEL, \ - CONFIG_LED_INIT_PRIORITY, &ht16k33_leds_api) + &ht16k33_leds_api) #ifdef CONFIG_HT16K33_KEYSCAN #define HT16K33_DEVICE_WITH_IRQ(id) \ @@ -445,10 +445,10 @@ static const struct led_driver_api ht16k33_leds_api = { \ static struct ht16k33_data ht16k33_##id##_data; \ \ - DEVICE_DT_INST_DEFINE(id, &ht16k33_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(id, &ht16k33_init, NULL, \ &ht16k33_##id##_data, \ &ht16k33_##id##_cfg, POST_KERNEL, \ - CONFIG_LED_INIT_PRIORITY, &ht16k33_leds_api) + &ht16k33_leds_api) #else /* ! CONFIG_HT16K33_KEYSCAN */ #define HT16K33_DEVICE_WITH_IRQ(id) HT16K33_DEVICE(id) #endif /* ! CONFIG_HT16K33_KEYSCAN */ diff --git a/drivers/led/is31fl3194.c b/drivers/led/is31fl3194.c index 5b0c34ebf571c..d6eec3fa8845c 100644 --- a/drivers/led/is31fl3194.c +++ b/drivers/led/is31fl3194.c @@ -352,8 +352,8 @@ static const struct led_driver_api is31fl3194_led_api = { .led_infos = is31fl3194_leds_##id, \ .current_limits = is31fl3194_currents_##id, \ }; \ - DEVICE_DT_INST_DEFINE(id, &is31fl3194_init, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(id, &is31fl3194_init, NULL, NULL, \ &is31fl3194_config_##id, POST_KERNEL, \ - CONFIG_LED_INIT_PRIORITY, &is31fl3194_led_api); + &is31fl3194_led_api); DT_INST_FOREACH_STATUS_OKAY(IS31FL3194_DEFINE) diff --git a/drivers/led/is31fl3216a.c b/drivers/led/is31fl3216a.c index b5b6ead10e685..41ce5599a76e3 100644 --- a/drivers/led/is31fl3216a.c +++ b/drivers/led/is31fl3216a.c @@ -233,8 +233,8 @@ static const struct led_driver_api is31fl3216a_led_api = { static const struct is31fl3216a_cfg is31fl3216a_##id##_cfg = { \ .i2c = I2C_DT_SPEC_INST_GET(id), \ }; \ - DEVICE_DT_INST_DEFINE(id, &is31fl3216a_init, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(id, &is31fl3216a_init, NULL, NULL, \ &is31fl3216a_##id##_cfg, POST_KERNEL, \ - CONFIG_LED_INIT_PRIORITY, &is31fl3216a_led_api); + &is31fl3216a_led_api); DT_INST_FOREACH_STATUS_OKAY(IS31FL3216A_INIT) diff --git a/drivers/led/is31fl3733.c b/drivers/led/is31fl3733.c index 3298bbc9b7c40..ba052b8b758d3 100644 --- a/drivers/led/is31fl3733.c +++ b/drivers/led/is31fl3733.c @@ -294,8 +294,7 @@ static const struct led_driver_api is31fl3733_api = { .selected_page = CMD_SEL_LED, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &is31fl3733_init, NULL, &is31fl3733_data_##n, \ - &is31fl3733_config_##n, POST_KERNEL, CONFIG_LED_INIT_PRIORITY, \ - &is31fl3733_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &is31fl3733_init, NULL, &is31fl3733_data_##n, \ + &is31fl3733_config_##n, POST_KERNEL, &is31fl3733_api); DT_INST_FOREACH_STATUS_OKAY(IS31FL3733_DEVICE) diff --git a/drivers/led/led_gpio.c b/drivers/led/led_gpio.c index 58caba7f3f21a..37bee8cbb5b78 100644 --- a/drivers/led/led_gpio.c +++ b/drivers/led/led_gpio.c @@ -94,9 +94,8 @@ static const struct led_gpio_config led_gpio_config_##i = { \ .led = gpio_dt_spec_##i, \ }; \ \ -DEVICE_DT_INST_DEFINE(i, &led_gpio_init, NULL, \ +DEVICE_INSTANCE_FROM_DT_INST(i, &led_gpio_init, NULL, \ NULL, &led_gpio_config_##i, \ - POST_KERNEL, CONFIG_LED_INIT_PRIORITY, \ - &led_gpio_api); + POST_KERNEL, &led_gpio_api); DT_INST_FOREACH_STATUS_OKAY(LED_GPIO_DEVICE) diff --git a/drivers/led/led_mchp_xec.c b/drivers/led/led_mchp_xec.c index 588a8bc2642da..aebbb6793fbdc 100644 --- a/drivers/led/led_mchp_xec.c +++ b/drivers/led/led_mchp_xec.c @@ -280,9 +280,8 @@ XEC_BBLED_PINCTRL_DEF(i); \ \ XEC_BBLED_CONFIG(i); \ \ -DEVICE_DT_INST_DEFINE(i, &xec_bbled_init, NULL, \ +DEVICE_INSTANCE_FROM_DT_INST(i, &xec_bbled_init, NULL, \ NULL, &xec_bbled_config_##i, \ - POST_KERNEL, CONFIG_LED_INIT_PRIORITY, \ - &xec_bbled_api); + POST_KERNEL, &xec_bbled_api); DT_INST_FOREACH_STATUS_OKAY(XEC_BBLED_DEVICE) diff --git a/drivers/led/led_npm1300.c b/drivers/led/led_npm1300.c index 528700630e970..a282b0211cd0d 100644 --- a/drivers/led/led_npm1300.c +++ b/drivers/led/led_npm1300.c @@ -94,7 +94,7 @@ static int led_npm1300_init(const struct device *dev) DT_INST_ENUM_IDX(n, nordic_led1_mode), \ DT_INST_ENUM_IDX(n, nordic_led2_mode)}}; \ \ - DEVICE_DT_INST_DEFINE(n, &led_npm1300_init, NULL, NULL, &led_npm1300_config##n, \ - POST_KERNEL, CONFIG_LED_INIT_PRIORITY, &led_npm1300_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &led_npm1300_init, NULL, NULL, &led_npm1300_config##n, \ + POST_KERNEL, &led_npm1300_api); DT_INST_FOREACH_STATUS_OKAY(LED_NPM1300_DEFINE) diff --git a/drivers/led/led_pwm.c b/drivers/led/led_pwm.c index 7a860ec97b748..44b961d40d967 100644 --- a/drivers/led/led_pwm.c +++ b/drivers/led/led_pwm.c @@ -144,9 +144,9 @@ static const struct led_pwm_config led_pwm_config_##id = { \ \ PM_DEVICE_DT_INST_DEFINE(id, led_pwm_pm_action); \ \ -DEVICE_DT_INST_DEFINE(id, &led_pwm_init, \ +DEVICE_INSTANCE_FROM_DT_INST(id, &led_pwm_init, \ PM_DEVICE_DT_INST_GET(id), NULL, \ &led_pwm_config_##id, POST_KERNEL, \ - CONFIG_LED_INIT_PRIORITY, &led_pwm_api); + &led_pwm_api); DT_INST_FOREACH_STATUS_OKAY(LED_PWM_DEVICE) diff --git a/drivers/led/lp3943.c b/drivers/led/lp3943.c index 1c583d259dc5c..e273bbb2868bc 100644 --- a/drivers/led/lp3943.c +++ b/drivers/led/lp3943.c @@ -282,6 +282,5 @@ static const struct led_driver_api lp3943_led_api = { .off = lp3943_led_off, }; -DEVICE_DT_INST_DEFINE(0, &lp3943_led_init, NULL, &lp3943_led_data, - &lp3943_led_config, POST_KERNEL, CONFIG_LED_INIT_PRIORITY, - &lp3943_led_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &lp3943_led_init, NULL, &lp3943_led_data, + &lp3943_led_config, POST_KERNEL, &lp3943_led_api); diff --git a/drivers/led/lp50xx.c b/drivers/led/lp50xx.c index 82333d6b14c4a..068123b991fcf 100644 --- a/drivers/led/lp50xx.c +++ b/drivers/led/lp50xx.c @@ -387,13 +387,12 @@ static const struct led_driver_api lp50xx_led_api = { \ PM_DEVICE_DT_INST_DEFINE(n, lp50xx_pm_action); \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ lp50xx_init, \ PM_DEVICE_DT_INST_GET(n), \ &lp##id##_data_##n, \ &lp##id##_config_##n, \ - POST_KERNEL, CONFIG_LED_INIT_PRIORITY, \ - &lp50xx_led_api); + POST_KERNEL, &lp50xx_led_api); #undef DT_DRV_COMPAT #define DT_DRV_COMPAT ti_lp5009 diff --git a/drivers/led/lp5562.c b/drivers/led/lp5562.c index 3ad3773c0de03..93c3757b4644a 100644 --- a/drivers/led/lp5562.c +++ b/drivers/led/lp5562.c @@ -1110,10 +1110,9 @@ static int lp5562_pm_action(const struct device *dev, enum pm_device_action acti PM_DEVICE_DT_INST_DEFINE(id, lp5562_pm_action); \ \ struct lp5562_data lp5562_data_##id; \ - DEVICE_DT_INST_DEFINE(id, &lp5562_led_init, PM_DEVICE_DT_INST_GET(id), \ - &lp5562_data_##id, \ - &lp5562_config_##id, POST_KERNEL, \ - CONFIG_LED_INIT_PRIORITY, \ - &lp5562_led_api); \ + DEVICE_INSTANCE_FROM_DT_INST(id, &lp5562_led_init, PM_DEVICE_DT_INST_GET(id),\ + &lp5562_data_##id, \ + &lp5562_config_##id, POST_KERNEL, \ + &lp5562_led_api); \ DT_INST_FOREACH_STATUS_OKAY(LP5562_DEFINE) diff --git a/drivers/led/lp5569.c b/drivers/led/lp5569.c index c87a574900dc1..509e33b5bdad3 100644 --- a/drivers/led/lp5569.c +++ b/drivers/led/lp5569.c @@ -199,8 +199,7 @@ static const struct led_driver_api lp5569_led_api = { \ PM_DEVICE_DT_INST_DEFINE(id, lp5569_pm_action); \ \ - DEVICE_DT_INST_DEFINE(id, &lp5569_init, PM_DEVICE_DT_INST_GET(id), NULL, \ - &lp5569_config_##id, POST_KERNEL, CONFIG_LED_INIT_PRIORITY, \ - &lp5569_led_api); + DEVICE_INSTANCE_FROM_DT_INST(id, &lp5569_init, PM_DEVICE_DT_INST_GET(id), NULL, \ + &lp5569_config_##id, POST_KERNEL, &lp5569_led_api); DT_INST_FOREACH_STATUS_OKAY(LP5569_DEFINE) diff --git a/drivers/led/ncp5623.c b/drivers/led/ncp5623.c index b197ab898421a..f1fbd76bbd926 100644 --- a/drivers/led/ncp5623.c +++ b/drivers/led/ncp5623.c @@ -214,7 +214,7 @@ static const struct led_driver_api ncp5623_led_api = { .num_leds = ARRAY_SIZE(ncp5623_leds_##id), \ .leds_info = ncp5623_leds_##id, \ }; \ - DEVICE_DT_INST_DEFINE(id, &ncp5623_led_init, NULL, NULL, &ncp5623_config_##id, \ - POST_KERNEL, CONFIG_LED_INIT_PRIORITY, &ncp5623_led_api); + DEVICE_INSTANCE_FROM_DT_INST(id, &ncp5623_led_init, NULL, NULL, &ncp5623_config_##id, \ + POST_KERNEL, &ncp5623_led_api); DT_INST_FOREACH_STATUS_OKAY(NCP5623_DEFINE) diff --git a/drivers/led/pca9633.c b/drivers/led/pca9633.c index a7f95d61872ca..683692fc465cb 100644 --- a/drivers/led/pca9633.c +++ b/drivers/led/pca9633.c @@ -230,10 +230,9 @@ static const struct led_driver_api pca9633_led_api = { }; \ static struct pca9633_data pca9633_##id##_data; \ \ - DEVICE_DT_INST_DEFINE(id, &pca9633_led_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(id, &pca9633_led_init, NULL, \ &pca9633_##id##_data, \ &pca9633_##id##_cfg, POST_KERNEL, \ - CONFIG_LED_INIT_PRIORITY, \ &pca9633_led_api); DT_INST_FOREACH_STATUS_OKAY(PCA9633_DEVICE) diff --git a/drivers/led/tlc59108.c b/drivers/led/tlc59108.c index d625488a16ab8..58c0ee4866ca0 100644 --- a/drivers/led/tlc59108.c +++ b/drivers/led/tlc59108.c @@ -221,10 +221,9 @@ static const struct led_driver_api tlc59108_led_api = { }; \ static struct tlc59108_data tlc59108_##id##_data; \ \ - DEVICE_DT_INST_DEFINE(id, &tlc59108_led_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(id, &tlc59108_led_init, NULL, \ &tlc59108_##id##_data, \ &tlc59108_##id##_cfg, POST_KERNEL, \ - CONFIG_LED_INIT_PRIORITY, \ &tlc59108_led_api); DT_INST_FOREACH_STATUS_OKAY(TLC59108_DEVICE) diff --git a/drivers/led_strip/apa102.c b/drivers/led_strip/apa102.c index 9f7de642358b7..d8347090f3bf2 100644 --- a/drivers/led_strip/apa102.c +++ b/drivers/led_strip/apa102.c @@ -106,13 +106,12 @@ static const struct led_strip_driver_api apa102_api = { .length = DT_INST_PROP(idx, chain_length), \ }; \ \ - DEVICE_DT_INST_DEFINE(idx, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, \ apa102_init, \ NULL, \ NULL, \ &apa102_##idx##_config, \ POST_KERNEL, \ - CONFIG_LED_STRIP_INIT_PRIORITY, \ &apa102_api); DT_INST_FOREACH_STATUS_OKAY(APA102_DEVICE) diff --git a/drivers/led_strip/lpd880x.c b/drivers/led_strip/lpd880x.c index c447f5435e882..a3eefca43cf10 100644 --- a/drivers/led_strip/lpd880x.c +++ b/drivers/led_strip/lpd880x.c @@ -156,7 +156,6 @@ static const struct led_strip_driver_api lpd880x_strip_api = { .length = lpd880x_strip_length, }; -DEVICE_DT_INST_DEFINE(0, lpd880x_strip_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, lpd880x_strip_init, NULL, NULL, &lpd880x_config, - POST_KERNEL, CONFIG_LED_STRIP_INIT_PRIORITY, - &lpd880x_strip_api); + POST_KERNEL, &lpd880x_strip_api); diff --git a/drivers/led_strip/tlc5971.c b/drivers/led_strip/tlc5971.c index ace45414fbf82..4ea76023e0476 100644 --- a/drivers/led_strip/tlc5971.c +++ b/drivers/led_strip/tlc5971.c @@ -345,8 +345,8 @@ static const struct led_strip_driver_api tlc5971_api = { .gbc_color_2 = TLC5971_GLOBAL_BRIGHTNESS_CONTROL_MAX, \ .gbc_color_3 = TLC5971_GLOBAL_BRIGHTNESS_CONTROL_MAX, \ }; \ - DEVICE_DT_INST_DEFINE(inst, tlc5971_init, NULL, &tlc5971_##inst##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, tlc5971_init, NULL, &tlc5971_##inst##_data, \ &tlc5971_##inst##_config, POST_KERNEL, \ - CONFIG_LED_STRIP_INIT_PRIORITY, &tlc5971_api); + &tlc5971_api); DT_INST_FOREACH_STATUS_OKAY(TLC5971_DEVICE) diff --git a/drivers/led_strip/tlc59731.c b/drivers/led_strip/tlc59731.c index c8501156e8143..8cd42b274eda6 100644 --- a/drivers/led_strip/tlc59731.c +++ b/drivers/led_strip/tlc59731.c @@ -184,6 +184,6 @@ static int tlc59731_gpio_init(const struct device *dev) .length = DT_INST_PROP(i, chain_length), \ }; \ \ - DEVICE_DT_INST_DEFINE(i, tlc59731_gpio_init, NULL, NULL, &tlc59731_cfg_##i, POST_KERNEL, \ - CONFIG_LED_STRIP_INIT_PRIORITY, &tlc59731_gpio_api); + DEVICE_INSTANCE_FROM_DT_INST(i, tlc59731_gpio_init, NULL, NULL, &tlc59731_cfg_##i, POST_KERNEL,\ + &tlc59731_gpio_api); DT_INST_FOREACH_STATUS_OKAY(TLC59731_DEVICE) diff --git a/drivers/led_strip/ws2812_gpio.c b/drivers/led_strip/ws2812_gpio.c index 5b3d472a21d69..659b44f34efed 100644 --- a/drivers/led_strip/ws2812_gpio.c +++ b/drivers/led_strip/ws2812_gpio.c @@ -233,12 +233,11 @@ static const uint8_t ws2812_gpio_##idx##_color_mapping[] = \ .length = DT_INST_PROP(idx, chain_length), \ }; \ \ - DEVICE_DT_INST_DEFINE(idx, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, \ ws2812_gpio_##idx##_init, \ NULL, \ NULL, \ &ws2812_gpio_##idx##_cfg, POST_KERNEL, \ - CONFIG_LED_STRIP_INIT_PRIORITY, \ &ws2812_gpio_api); DT_INST_FOREACH_STATUS_OKAY(WS2812_GPIO_DEVICE) diff --git a/drivers/led_strip/ws2812_i2s.c b/drivers/led_strip/ws2812_i2s.c index b1b951216282a..87751d447e419 100644 --- a/drivers/led_strip/ws2812_i2s.c +++ b/drivers/led_strip/ws2812_i2s.c @@ -261,7 +261,7 @@ static const struct led_strip_driver_api ws2812_i2s_api = { .nibble_zero = DT_INST_PROP(idx, nibble_zero), \ }; \ \ - DEVICE_DT_INST_DEFINE(idx, ws2812_i2s_init, NULL, NULL, &ws2812_i2s_##idx##_cfg, \ - POST_KERNEL, CONFIG_LED_STRIP_INIT_PRIORITY, &ws2812_i2s_api); + DEVICE_INSTANCE_FROM_DT_INST(idx, ws2812_i2s_init, NULL, NULL, &ws2812_i2s_##idx##_cfg, \ + POST_KERNEL, &ws2812_i2s_api); DT_INST_FOREACH_STATUS_OKAY(WS2812_I2S_DEVICE) diff --git a/drivers/led_strip/ws2812_rpi_pico_pio.c b/drivers/led_strip/ws2812_rpi_pico_pio.c index 45b19da8f8400..9c559e9816dd1 100644 --- a/drivers/led_strip/ws2812_rpi_pico_pio.c +++ b/drivers/led_strip/ws2812_rpi_pico_pio.c @@ -198,9 +198,9 @@ static int ws2812_rpi_pico_pio_init(const struct device *dev) .cycles_per_bit = CYCLES_PER_BIT(DT_PARENT(node)), \ }; \ \ - DEVICE_DT_DEFINE(node, &ws2812_led_strip_init, NULL, &ws2812_led_strip_##node##_data, \ + DEVICE_INSTANCE(node, &ws2812_led_strip_init, NULL, &ws2812_led_strip_##node##_data, \ &ws2812_led_strip_##node##_config, POST_KERNEL, \ - CONFIG_LED_STRIP_INIT_PRIORITY, &ws2812_led_strip_api); + &ws2812_led_strip_api); #define SET_DELAY(op, inst, i) \ (op | (((DT_INST_PROP_BY_IDX(inst, bit_waveform, i) - 1) & 0xF) << 8)) @@ -245,8 +245,8 @@ static int ws2812_rpi_pico_pio_init(const struct device *dev) }, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &ws2812_rpi_pico_pio_init, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &ws2812_rpi_pico_pio_init, NULL, NULL, \ &rpi_pico_pio_ws2812_##inst##_config, POST_KERNEL, \ - CONFIG_LED_STRIP_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(WS2812_RPI_PICO_PIO_INIT) diff --git a/drivers/led_strip/ws2812_spi.c b/drivers/led_strip/ws2812_spi.c index 536da5463c9a0..427549279ffc0 100644 --- a/drivers/led_strip/ws2812_spi.c +++ b/drivers/led_strip/ws2812_spi.c @@ -215,13 +215,12 @@ static const struct led_strip_driver_api ws2812_spi_api = { .reset_delay = WS2812_RESET_DELAY(idx), \ }; \ \ - DEVICE_DT_INST_DEFINE(idx, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, \ ws2812_spi_init, \ NULL, \ NULL, \ &ws2812_spi_##idx##_cfg, \ POST_KERNEL, \ - CONFIG_LED_STRIP_INIT_PRIORITY, \ &ws2812_spi_api); DT_INST_FOREACH_STATUS_OKAY(WS2812_SPI_DEVICE) diff --git a/drivers/lora/rylrxxx.c b/drivers/lora/rylrxxx.c index d89f14ce012c4..11cf081936f25 100644 --- a/drivers/lora/rylrxxx.c +++ b/drivers/lora/rylrxxx.c @@ -679,7 +679,7 @@ static const struct lora_driver_api rylr_lora_api = { .uart = DEVICE_DT_GET(DT_INST_BUS(n)), \ .reset = GPIO_DT_SPEC_INST_GET(n, reset_gpios), \ }; \ - DEVICE_DT_INST_DEFINE(n, &rylr_init, NULL, &dev_data_##n, &dev_config_##n, POST_KERNEL, \ - CONFIG_LORA_INIT_PRIORITY, &rylr_lora_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &rylr_init, NULL, &dev_data_##n, &dev_config_##n, POST_KERNEL,\ + &rylr_lora_api); DT_INST_FOREACH_STATUS_OKAY(RYLR_DEVICE_INIT) diff --git a/drivers/lora/sx126x.c b/drivers/lora/sx126x.c index aeb9efe8981dc..cd27d9ddc0e85 100644 --- a/drivers/lora/sx126x.c +++ b/drivers/lora/sx126x.c @@ -472,6 +472,5 @@ static const struct lora_driver_api sx126x_lora_api = { .test_cw = sx12xx_lora_test_cw, }; -DEVICE_DT_INST_DEFINE(0, &sx126x_lora_init, NULL, &dev_data, - &dev_config, POST_KERNEL, CONFIG_LORA_INIT_PRIORITY, - &sx126x_lora_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &sx126x_lora_init, NULL, &dev_data, + &dev_config, POST_KERNEL, &sx126x_lora_api); diff --git a/drivers/lora/sx127x.c b/drivers/lora/sx127x.c index 4826ea47325ee..9dd8de1542085 100644 --- a/drivers/lora/sx127x.c +++ b/drivers/lora/sx127x.c @@ -634,6 +634,5 @@ static const struct lora_driver_api sx127x_lora_api = { .test_cw = sx12xx_lora_test_cw, }; -DEVICE_DT_INST_DEFINE(0, &sx127x_lora_init, NULL, NULL, - NULL, POST_KERNEL, CONFIG_LORA_INIT_PRIORITY, - &sx127x_lora_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &sx127x_lora_init, NULL, NULL, + NULL, POST_KERNEL, &sx127x_lora_api); diff --git a/drivers/mbox/mbox_andes_plic_sw.c b/drivers/mbox/mbox_andes_plic_sw.c index b297200233180..cf0f78c561214 100644 --- a/drivers/mbox/mbox_andes_plic_sw.c +++ b/drivers/mbox/mbox_andes_plic_sw.c @@ -153,7 +153,7 @@ static const struct mbox_driver_api mbox_plic_driver_api = { .channel_max = ARRAY_SIZE(irq_sources##n), \ .irq_sources = irq_sources##n, \ }; \ - DEVICE_DT_INST_DEFINE(n, &mbox_plic_init##n, NULL, &mbox_plic_data##n, &mbox_plic_conf##n, \ - PRE_KERNEL_2, CONFIG_MBOX_INIT_PRIORITY, &mbox_plic_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &mbox_plic_init##n, NULL, &mbox_plic_data##n, &mbox_plic_conf##n,\ + PRE_KERNEL_2, &mbox_plic_driver_api); DT_INST_FOREACH_STATUS_OKAY(MBOX_PLIC_DEVICE_INIT) diff --git a/drivers/mbox/mbox_esp32.c b/drivers/mbox/mbox_esp32.c index b7764b0f2daf7..252a796bd371a 100644 --- a/drivers/mbox/mbox_esp32.c +++ b/drivers/mbox/mbox_esp32.c @@ -263,8 +263,8 @@ static const struct mbox_driver_api esp32_mbox_driver_api = { ESP32_MBOX_SHM_SIZE_BY_IDX(idx) / 2, \ .control = (struct esp32_mbox_control *)DT_INST_REG_ADDR(idx), \ }; \ - DEVICE_DT_INST_DEFINE(idx, &esp32_mbox_init, NULL, &esp32_mbox_device_data_##idx, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, &esp32_mbox_init, NULL, &esp32_mbox_device_data_##idx, \ &esp32_mbox_device_cfg_##idx, PRE_KERNEL_2, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &esp32_mbox_driver_api); + &esp32_mbox_driver_api); DT_INST_FOREACH_STATUS_OKAY(ESP32_MBOX_INIT); diff --git a/drivers/mbox/mbox_ivshmem.c b/drivers/mbox/mbox_ivshmem.c index 39b30087a7589..4fc1da04be4ea 100644 --- a/drivers/mbox/mbox_ivshmem.c +++ b/drivers/mbox/mbox_ivshmem.c @@ -148,8 +148,8 @@ static const struct mbox_driver_api ivshmem_mbox_driver_api = { .cb = NULL, \ .user_data = NULL, \ }; \ - DEVICE_DT_INST_DEFINE(inst, ivshmem_mbox_init, NULL, &ivshmem_mbox_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, ivshmem_mbox_init, NULL, &ivshmem_mbox_data_##inst, \ &ivshmem_mbox_cfg_##inst, POST_KERNEL, \ - CONFIG_APPLICATION_INIT_PRIORITY, &ivshmem_mbox_driver_api); + &ivshmem_mbox_driver_api); DT_INST_FOREACH_STATUS_OKAY(MBOX_IVSHMEM_INIT); diff --git a/drivers/mbox/mbox_nrf_bellboard_rx.c b/drivers/mbox/mbox_nrf_bellboard_rx.c index 54dd21b9624ff..546f9153ba96c 100644 --- a/drivers/mbox/mbox_nrf_bellboard_rx.c +++ b/drivers/mbox/mbox_nrf_bellboard_rx.c @@ -175,5 +175,5 @@ static int bellboard_rx_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, bellboard_rx_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_MBOX_INIT_PRIORITY, &bellboard_rx_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, bellboard_rx_init, NULL, NULL, NULL, POST_KERNEL, + &bellboard_rx_driver_api); diff --git a/drivers/mbox/mbox_nrf_bellboard_tx.c b/drivers/mbox/mbox_nrf_bellboard_tx.c index 9f98f57ff5d2a..72110856189f0 100644 --- a/drivers/mbox/mbox_nrf_bellboard_tx.c +++ b/drivers/mbox/mbox_nrf_bellboard_tx.c @@ -56,7 +56,7 @@ static const struct mbox_driver_api bellboard_tx_driver_api = { .bellboard = (NRF_BELLBOARD_Type *)DT_INST_REG_ADDR(inst), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, &conf##inst, POST_KERNEL, \ - CONFIG_MBOX_INIT_PRIORITY, &bellboard_tx_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, NULL, &conf##inst, POST_KERNEL, \ + &bellboard_tx_driver_api); DT_INST_FOREACH_STATUS_OKAY(BELLBOARD_REMOTE_DEFINE) diff --git a/drivers/mbox/mbox_nrf_vevif_event_rx.c b/drivers/mbox/mbox_nrf_vevif_event_rx.c index b5be6a97b79dc..fb1acf14e6192 100644 --- a/drivers/mbox/mbox_nrf_vevif_event_rx.c +++ b/drivers/mbox/mbox_nrf_vevif_event_rx.c @@ -141,7 +141,7 @@ static int vevif_event_rx_init(const struct device *dev) .irq_connect = irq_connect##inst, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, vevif_event_rx_init, NULL, &data##inst, &conf##inst, \ - POST_KERNEL, CONFIG_MBOX_INIT_PRIORITY, &vevif_event_rx_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, vevif_event_rx_init, NULL, &data##inst, &conf##inst, \ + POST_KERNEL, &vevif_event_rx_driver_api); DT_INST_FOREACH_STATUS_OKAY(VEVIF_EVENT_RX_DEFINE) diff --git a/drivers/mbox/mbox_nrf_vevif_event_tx.c b/drivers/mbox/mbox_nrf_vevif_event_tx.c index 8bd731f56a592..5bec8e0d95899 100644 --- a/drivers/mbox/mbox_nrf_vevif_event_tx.c +++ b/drivers/mbox/mbox_nrf_vevif_event_tx.c @@ -62,5 +62,4 @@ static const struct mbox_driver_api vevif_event_tx_driver_api = { .max_channels_get = vevif_event_tx_max_channels_get, }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, POST_KERNEL, CONFIG_MBOX_INIT_PRIORITY, - &vevif_event_tx_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, NULL, POST_KERNEL, &vevif_event_tx_driver_api); diff --git a/drivers/mbox/mbox_nrf_vevif_task_rx.c b/drivers/mbox/mbox_nrf_vevif_task_rx.c index 8783424ae9899..1a34adb60509a 100644 --- a/drivers/mbox/mbox_nrf_vevif_task_rx.c +++ b/drivers/mbox/mbox_nrf_vevif_task_rx.c @@ -140,5 +140,5 @@ static int vevif_task_rx_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, vevif_task_rx_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_MBOX_INIT_PRIORITY, &vevif_task_rx_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, vevif_task_rx_init, NULL, NULL, NULL, POST_KERNEL, + &vevif_task_rx_driver_api); diff --git a/drivers/mbox/mbox_nrf_vevif_task_tx.c b/drivers/mbox/mbox_nrf_vevif_task_tx.c index a409ef214b7de..bb717b911bfb5 100644 --- a/drivers/mbox/mbox_nrf_vevif_task_tx.c +++ b/drivers/mbox/mbox_nrf_vevif_task_tx.c @@ -72,7 +72,7 @@ static const struct mbox_driver_api vevif_task_tx_driver_api = { .tasks_mask = DT_INST_PROP(inst, nordic_tasks_mask), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, &conf##inst, POST_KERNEL, \ - CONFIG_MBOX_INIT_PRIORITY, &vevif_task_tx_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, NULL, &conf##inst, POST_KERNEL, \ + &vevif_task_tx_driver_api); DT_INST_FOREACH_STATUS_OKAY(VEVIF_TASK_TX_DEFINE) diff --git a/drivers/mbox/mbox_nrfx_ipc.c b/drivers/mbox/mbox_nrfx_ipc.c index 189e00d5967e6..a6c7928bb7702 100644 --- a/drivers/mbox/mbox_nrfx_ipc.c +++ b/drivers/mbox/mbox_nrfx_ipc.c @@ -198,6 +198,5 @@ static const struct mbox_driver_api mbox_nrf_driver_api = { .set_enabled = mbox_nrf_set_enabled, }; -DEVICE_DT_INST_DEFINE(0, mbox_nrf_init, NULL, &nrfx_mbox_data, &nrfx_mbox_conf, - POST_KERNEL, CONFIG_MBOX_INIT_PRIORITY, - &mbox_nrf_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, mbox_nrf_init, NULL, &nrfx_mbox_data, &nrfx_mbox_conf, + POST_KERNEL, &mbox_nrf_driver_api); diff --git a/drivers/mbox/mbox_nxp_imx_mu.c b/drivers/mbox/mbox_nxp_imx_mu.c index fa11f84bfc2c6..92d7c3fc8f53f 100644 --- a/drivers/mbox/mbox_nxp_imx_mu.c +++ b/drivers/mbox/mbox_nxp_imx_mu.c @@ -138,9 +138,8 @@ static void handle_irq(const struct device *dev); irq_enable(DT_INST_IRQN(idx)); \ return 0; \ } \ - DEVICE_DT_INST_DEFINE(idx, nxp_imx_mu_##idx##_init, NULL, &nxp_imx_mu_##idx##_data, \ - &nxp_imx_mu_##idx##_config, PRE_KERNEL_1, CONFIG_MBOX_INIT_PRIORITY, \ - &nxp_imx_mu_driver_api) + DEVICE_INSTANCE_FROM_DT_INST(idx, nxp_imx_mu_##idx##_init, NULL, &nxp_imx_mu_##idx##_data, \ + &nxp_imx_mu_##idx##_config, PRE_KERNEL_1, &nxp_imx_mu_driver_api) #define MU_IRQ_HANDLER(idx) \ void MU_##idx##_IRQHandler(void) \ diff --git a/drivers/mbox/mbox_nxp_mailbox.c b/drivers/mbox/mbox_nxp_mailbox.c index cfd0640cddc00..6933e4cb0d98b 100644 --- a/drivers/mbox/mbox_nxp_mailbox.c +++ b/drivers/mbox/mbox_nxp_mailbox.c @@ -202,9 +202,8 @@ static const struct mbox_driver_api nxp_mailbox_driver_api = { irq_enable(DT_INST_IRQN(idx)); \ return 0; \ } \ - DEVICE_DT_INST_DEFINE(idx, nxp_mailbox_##idx##_init, NULL, &nxp_mailbox_##idx##_data, \ - &nxp_mailbox_##idx##_config, POST_KERNEL, CONFIG_MBOX_INIT_PRIORITY, \ - &nxp_mailbox_driver_api) + DEVICE_INSTANCE_FROM_DT_INST(idx, nxp_mailbox_##idx##_init, NULL, &nxp_mailbox_##idx##_data,\ + &nxp_mailbox_##idx##_config, POST_KERNEL, &nxp_mailbox_driver_api) #define MAILBOX_INST(idx) MAILBOX_INSTANCE_DEFINE(idx); diff --git a/drivers/mbox/mbox_nxp_s32_mru.c b/drivers/mbox/mbox_nxp_s32_mru.c index 4a3f8cdff219c..bf9040d369afc 100644 --- a/drivers/mbox/mbox_nxp_s32_mru.c +++ b/drivers/mbox/mbox_nxp_s32_mru.c @@ -292,9 +292,8 @@ static const struct mbox_driver_api nxp_s32_mru_driver_api = { (NULL), (nxp_s32_mru_##n##_init_irq)), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, nxp_s32_mru_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, nxp_s32_mru_init, NULL, \ &nxp_s32_mru_##n##_data, &nxp_s32_mru_##n##_config, \ - POST_KERNEL, CONFIG_MBOX_INIT_PRIORITY, \ - &nxp_s32_mru_driver_api); + POST_KERNEL, &nxp_s32_mru_driver_api); DT_INST_FOREACH_STATUS_OKAY(MRU_INSTANCE_DEFINE) diff --git a/drivers/mbox/mbox_stm32_hsem.c b/drivers/mbox/mbox_stm32_hsem.c index 3f416c2b85dac..a65e4b7f57fc4 100644 --- a/drivers/mbox/mbox_stm32_hsem.c +++ b/drivers/mbox/mbox_stm32_hsem.c @@ -249,12 +249,11 @@ static const struct mbox_driver_api mbox_stm32_hsem_driver_api = { .set_enabled = mbox_stm32_hsem_set_enabled, }; -DEVICE_DT_INST_DEFINE( +DEVICE_INSTANCE_FROM_DT_INST( 0, mbox_stm32_hsem_init, NULL, &stm32_hsem_mbox_data, &stm32_hsem_mbox_conf, POST_KERNEL, - CONFIG_MBOX_INIT_PRIORITY, &mbox_stm32_hsem_driver_api); diff --git a/drivers/mdio/mdio_adin2111.c b/drivers/mdio/mdio_adin2111.c index ff3cf80e43be0..b5420eecbe6e7 100644 --- a/drivers/mdio/mdio_adin2111.c +++ b/drivers/mdio/mdio_adin2111.c @@ -200,9 +200,8 @@ static const struct mdio_driver_api mdio_adin2111_api = { static const struct mdio_adin2111_config mdio_adin2111_config_##n = { \ .adin = DEVICE_DT_GET(DT_INST_BUS(n)), \ }; \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, \ NULL, &mdio_adin2111_config_##n, \ - POST_KERNEL, CONFIG_MDIO_INIT_PRIORITY, \ - &mdio_adin2111_api); + POST_KERNEL, &mdio_adin2111_api); DT_INST_FOREACH_STATUS_OKAY(ADIN2111_MDIO_INIT) diff --git a/drivers/mdio/mdio_dwcxgmac.c b/drivers/mdio/mdio_dwcxgmac.c index 29e45d6da492d..74c5f5fc3446d 100644 --- a/drivers/mdio/mdio_dwcxgmac.c +++ b/drivers/mdio/mdio_dwcxgmac.c @@ -223,8 +223,8 @@ static const struct mdio_driver_api mdio_dwcxgmac_driver_api = { #define MDIO_DWCXGMAC_DEVICE(n) \ MDIO_DWCXGMAC_CONFIG(n); \ static struct mdio_dwcxgmac_dev_data mdio_dwcxgmac_dev_data##n; \ - DEVICE_DT_INST_DEFINE(n, &mdio_dwcxgmac_initialize, NULL, &mdio_dwcxgmac_dev_data##n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &mdio_dwcxgmac_initialize, NULL, &mdio_dwcxgmac_dev_data##n,\ &mdio_dwcxgmac_dev_config_##n, POST_KERNEL, \ - CONFIG_MDIO_INIT_PRIORITY, &mdio_dwcxgmac_driver_api); + &mdio_dwcxgmac_driver_api); DT_INST_FOREACH_STATUS_OKAY(MDIO_DWCXGMAC_DEVICE) diff --git a/drivers/mdio/mdio_esp32.c b/drivers/mdio/mdio_esp32.c index b4c1a70f19af8..5be4f7c87a7df 100644 --- a/drivers/mdio/mdio_esp32.c +++ b/drivers/mdio/mdio_esp32.c @@ -136,12 +136,11 @@ static const struct mdio_esp32_dev_config mdio_esp32_dev_config_##n = { \ PINCTRL_DT_INST_DEFINE(n); \ MDIO_ESP32_CONFIG(n); \ static struct mdio_esp32_dev_data mdio_esp32_dev_data##n; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &mdio_esp32_initialize, \ NULL, \ &mdio_esp32_dev_data##n, \ &mdio_esp32_dev_config_##n, POST_KERNEL, \ - CONFIG_MDIO_INIT_PRIORITY, \ &mdio_esp32_driver_api); DT_INST_FOREACH_STATUS_OKAY(MDIO_ESP32_DEVICE) diff --git a/drivers/mdio/mdio_gpio.c b/drivers/mdio/mdio_gpio.c index f097004900b43..7c8a844f2f3fc 100644 --- a/drivers/mdio/mdio_gpio.c +++ b/drivers/mdio/mdio_gpio.c @@ -171,8 +171,8 @@ static const struct mdio_driver_api mdio_gpio_driver_api = { #define MDIO_GPIO_DEVICE(inst) \ MDIO_GPIO_CONFIG(inst); \ static struct mdio_gpio_data mdio_gpio_dev_data_##inst; \ - DEVICE_DT_INST_DEFINE(inst, &mdio_gpio_initialize, NULL, &mdio_gpio_dev_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &mdio_gpio_initialize, NULL, &mdio_gpio_dev_data_##inst,\ &mdio_gpio_dev_config_##inst, POST_KERNEL, \ - CONFIG_MDIO_INIT_PRIORITY, &mdio_gpio_driver_api); + &mdio_gpio_driver_api); DT_INST_FOREACH_STATUS_OKAY(MDIO_GPIO_DEVICE) diff --git a/drivers/mdio/mdio_litex_liteeth.c b/drivers/mdio/mdio_litex_liteeth.c index 5609837a3dca8..220ee23937763 100644 --- a/drivers/mdio/mdio_litex_liteeth.c +++ b/drivers/mdio/mdio_litex_liteeth.c @@ -163,8 +163,8 @@ static const struct mdio_driver_api mdio_litex_driver_api = { .r_addr = DT_INST_REG_ADDR_BY_NAME(inst, mdio_r), \ }; \ static struct mdio_litex_data mdio_litex_dev_data_##inst; \ - DEVICE_DT_INST_DEFINE(inst, &mdio_litex_initialize, NULL, &mdio_litex_dev_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &mdio_litex_initialize, NULL, &mdio_litex_dev_data_##inst,\ &mdio_litex_dev_config_##inst, POST_KERNEL, \ - CONFIG_MDIO_INIT_PRIORITY, &mdio_litex_driver_api); + &mdio_litex_driver_api); DT_INST_FOREACH_STATUS_OKAY(MDIO_LITEX_DEVICE) diff --git a/drivers/mdio/mdio_nxp_enet.c b/drivers/mdio/mdio_nxp_enet.c index 05a67acd90afb..94657de4effed 100644 --- a/drivers/mdio/mdio_nxp_enet.c +++ b/drivers/mdio/mdio_nxp_enet.c @@ -257,10 +257,9 @@ static int nxp_enet_mdio_init(const struct device *dev) \ static struct nxp_enet_mdio_data nxp_enet_mdio_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, &nxp_enet_mdio_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &nxp_enet_mdio_init, NULL, \ &nxp_enet_mdio_data_##inst, &nxp_enet_mdio_cfg_##inst, \ - POST_KERNEL, CONFIG_MDIO_INIT_PRIORITY, \ - &nxp_enet_mdio_api); + POST_KERNEL, &nxp_enet_mdio_api); DT_INST_FOREACH_STATUS_OKAY(NXP_ENET_MDIO_INIT) diff --git a/drivers/mdio/mdio_nxp_enet_qos.c b/drivers/mdio/mdio_nxp_enet_qos.c index 61de09d2bd5b9..f9f0f1e619317 100644 --- a/drivers/mdio/mdio_nxp_enet_qos.c +++ b/drivers/mdio/mdio_nxp_enet_qos.c @@ -200,10 +200,9 @@ static int nxp_enet_qos_mdio_init(const struct device *dev) \ static struct nxp_enet_qos_mdio_data nxp_enet_qos_mdio_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, &nxp_enet_qos_mdio_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &nxp_enet_qos_mdio_init, NULL, \ &nxp_enet_qos_mdio_data_##inst, \ &nxp_enet_qos_mdio_cfg_##inst, \ - POST_KERNEL, CONFIG_MDIO_INIT_PRIORITY, \ - &nxp_enet_qos_mdio_api); \ + POST_KERNEL, &nxp_enet_qos_mdio_api); \ DT_INST_FOREACH_STATUS_OKAY(NXP_ENET_QOS_MDIO_INIT) diff --git a/drivers/mdio/mdio_nxp_imx_netc.c b/drivers/mdio/mdio_nxp_imx_netc.c index 1e61785e14d00..758f24087f8fb 100644 --- a/drivers/mdio/mdio_nxp_imx_netc.c +++ b/drivers/mdio/mdio_nxp_imx_netc.c @@ -93,8 +93,8 @@ static const struct mdio_driver_api nxp_imx_netc_mdio_api = { .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \ .clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name), \ }; \ - DEVICE_DT_INST_DEFINE(n, &nxp_imx_netc_mdio_initialize, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &nxp_imx_netc_mdio_initialize, NULL, \ &nxp_imx_netc_mdio##n##_data, &nxp_imx_netc_mdio##n##_cfg, \ - POST_KERNEL, CONFIG_MDIO_INIT_PRIORITY, &nxp_imx_netc_mdio_api); + POST_KERNEL, &nxp_imx_netc_mdio_api); DT_INST_FOREACH_STATUS_OKAY(NXP_IMX_NETC_MDIO_INSTANCE_DEFINE) diff --git a/drivers/mdio/mdio_nxp_s32_gmac.c b/drivers/mdio/mdio_nxp_s32_gmac.c index 4e8cc2942b415..2d99719483e19 100644 --- a/drivers/mdio/mdio_nxp_s32_gmac.c +++ b/drivers/mdio/mdio_nxp_s32_gmac.c @@ -165,13 +165,12 @@ static const struct mdio_driver_api mdio_nxp_s32_driver_api = { .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \ .clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name), \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &mdio_nxp_s32_init, \ NULL, \ &mdio_nxp_s32_data_##n, \ &mdio_nxp_s32_config_##n, \ POST_KERNEL, \ - CONFIG_MDIO_INIT_PRIORITY, \ &mdio_nxp_s32_driver_api); DT_INST_FOREACH_STATUS_OKAY(MDIO_NXP_S32_DEVICE) diff --git a/drivers/mdio/mdio_nxp_s32_netc.c b/drivers/mdio/mdio_nxp_s32_netc.c index 6f2acea2cafd4..f527f87393458 100644 --- a/drivers/mdio/mdio_nxp_s32_netc.c +++ b/drivers/mdio/mdio_nxp_s32_netc.c @@ -85,13 +85,12 @@ static const struct mdio_driver_api nxp_s32_mdio_api = { .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ .instance = NXP_S32_MDIO_HW_INSTANCE(n), \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &nxp_s32_mdio_initialize, \ NULL, \ &nxp_s32_mdio##n##_data, \ &nxp_s32_mdio##n##_cfg, \ POST_KERNEL, \ - CONFIG_MDIO_INIT_PRIORITY, \ &nxp_s32_mdio_api); DT_INST_FOREACH_STATUS_OKAY(NXP_S32_MDIO_INSTANCE_DEFINE) diff --git a/drivers/mdio/mdio_sam.c b/drivers/mdio/mdio_sam.c index 216e0dd80f421..77350b172cac7 100644 --- a/drivers/mdio/mdio_sam.c +++ b/drivers/mdio/mdio_sam.c @@ -183,12 +183,11 @@ static const struct mdio_sam_dev_config mdio_sam_dev_config_##n = { \ PINCTRL_DT_INST_DEFINE(n); \ MDIO_SAM_CONFIG(n); \ static struct mdio_sam_dev_data mdio_sam_dev_data##n; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &mdio_sam_initialize, \ NULL, \ &mdio_sam_dev_data##n, \ &mdio_sam_dev_config_##n, POST_KERNEL, \ - CONFIG_MDIO_INIT_PRIORITY, \ &mdio_sam_driver_api); DT_INST_FOREACH_STATUS_OKAY(MDIO_SAM_DEVICE) diff --git a/drivers/mdio/mdio_stm32_hal.c b/drivers/mdio/mdio_stm32_hal.c index 3e788027fae0e..05ae383d28854 100644 --- a/drivers/mdio/mdio_stm32_hal.c +++ b/drivers/mdio/mdio_stm32_hal.c @@ -115,9 +115,8 @@ static const struct mdio_driver_api mdio_stm32_api = { static struct mdio_stm32_config mdio_stm32_config_##inst = { \ .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ }; \ - DEVICE_DT_INST_DEFINE(inst, &mdio_stm32_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &mdio_stm32_init, NULL, \ &mdio_stm32_data_##inst, &mdio_stm32_config_##inst, \ - POST_KERNEL, CONFIG_ETH_INIT_PRIORITY, \ - &mdio_stm32_api); + POST_KERNEL, &mdio_stm32_api); DT_INST_FOREACH_STATUS_OKAY(MDIO_STM32_HAL_DEVICE) diff --git a/drivers/mdio/mdio_xmc4xxx.c b/drivers/mdio/mdio_xmc4xxx.c index 02ebfc5096d84..808d4ceee6176 100644 --- a/drivers/mdio/mdio_xmc4xxx.c +++ b/drivers/mdio/mdio_xmc4xxx.c @@ -180,6 +180,6 @@ static const struct mdio_xmc4xxx_dev_config mdio_xmc4xxx_dev_config_0 = { static struct mdio_xmc4xxx_dev_data mdio_xmc4xxx_dev_data_0; -DEVICE_DT_INST_DEFINE(0, &mdio_xmc4xxx_initialize, NULL, &mdio_xmc4xxx_dev_data_0, +DEVICE_INSTANCE_FROM_DT_INST(0, &mdio_xmc4xxx_initialize, NULL, &mdio_xmc4xxx_dev_data_0, &mdio_xmc4xxx_dev_config_0, POST_KERNEL, - CONFIG_MDIO_INIT_PRIORITY, &mdio_xmc4xxx_driver_api); + &mdio_xmc4xxx_driver_api); diff --git a/drivers/memc/memc_mcux_flexspi.c b/drivers/memc/memc_mcux_flexspi.c index f62b418f7ad8e..46d28735e08e7 100644 --- a/drivers/memc/memc_mcux_flexspi.c +++ b/drivers/memc/memc_mcux_flexspi.c @@ -437,13 +437,12 @@ static int memc_flexspi_pm_action(const struct device *dev, enum pm_device_actio \ PM_DEVICE_DT_INST_DEFINE(n, memc_flexspi_pm_action); \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ memc_flexspi_init, \ PM_DEVICE_DT_INST_GET(n), \ &memc_flexspi_data_##n, \ NULL, \ POST_KERNEL, \ - CONFIG_MEMC_MCUX_FLEXSPI_INIT_PRIORITY, \ NULL); DT_INST_FOREACH_STATUS_OKAY(MEMC_FLEXSPI) diff --git a/drivers/memc/memc_mcux_flexspi_aps6404l.c b/drivers/memc/memc_mcux_flexspi_aps6404l.c index cbf7182112df9..56a6e4dcf4a0f 100644 --- a/drivers/memc/memc_mcux_flexspi_aps6404l.c +++ b/drivers/memc/memc_mcux_flexspi_aps6404l.c @@ -256,13 +256,12 @@ static int memc_flexspi_aps6404l_init(const struct device *dev) .controller = DEVICE_DT_GET(DT_INST_BUS(n)), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ memc_flexspi_aps6404l_init, \ NULL, \ - &memc_flexspi_aps6404l_data_##n, \ + &memc_flexspi_aps6404l_data_##n, \ &memc_flexspi_aps6404l_config_##n, \ POST_KERNEL, \ - CONFIG_MEMC_INIT_PRIORITY, \ NULL); DT_INST_FOREACH_STATUS_OKAY(MEMC_FLEXSPI_APS6404L) diff --git a/drivers/memc/memc_mcux_flexspi_aps6408l.c b/drivers/memc/memc_mcux_flexspi_aps6408l.c index a9b51e77bfa81..df3093cfc5994 100644 --- a/drivers/memc/memc_mcux_flexspi_aps6408l.c +++ b/drivers/memc/memc_mcux_flexspi_aps6408l.c @@ -312,13 +312,12 @@ static int memc_flexspi_aps6408l_init(const struct device *dev) .controller = DEVICE_DT_GET(DT_INST_BUS(n)), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ memc_flexspi_aps6408l_init, \ NULL, \ - &memc_flexspi_aps6408l_data_##n, \ + &memc_flexspi_aps6408l_data_##n, \ &memc_flexspi_aps6408l_config_##n, \ POST_KERNEL, \ - CONFIG_MEMC_INIT_PRIORITY, \ NULL); DT_INST_FOREACH_STATUS_OKAY(MEMC_FLEXSPI_APS6408L) diff --git a/drivers/memc/memc_mcux_flexspi_is66wvq8m4.c b/drivers/memc/memc_mcux_flexspi_is66wvq8m4.c index 1a964b1454f1e..d6c4f6dabf55c 100644 --- a/drivers/memc/memc_mcux_flexspi_is66wvq8m4.c +++ b/drivers/memc/memc_mcux_flexspi_is66wvq8m4.c @@ -235,13 +235,12 @@ static int memc_flexspi_is66wvq8m4_init(const struct device *dev) .controller = DEVICE_DT_GET(DT_INST_BUS(n)), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ memc_flexspi_is66wvq8m4_init, \ NULL, \ &memc_flexspi_is66wvq8m4_data_##n, \ - &memc_flexspi_is66wvq8m4_config_##n,\ + &memc_flexspi_is66wvq8m4_config_##n, \ POST_KERNEL, \ - CONFIG_MEMC_INIT_PRIORITY, \ NULL); DT_INST_FOREACH_STATUS_OKAY(MEMC_FLEXSPI_IS66WVQ8M4) diff --git a/drivers/memc/memc_mcux_flexspi_s27ks0641.c b/drivers/memc/memc_mcux_flexspi_s27ks0641.c index 36fc5bf830690..c152c3f45165d 100644 --- a/drivers/memc/memc_mcux_flexspi_s27ks0641.c +++ b/drivers/memc/memc_mcux_flexspi_s27ks0641.c @@ -186,13 +186,12 @@ static int memc_flexspi_s27ks0641_init(const struct device *dev) .controller = DEVICE_DT_GET(DT_INST_BUS(n)), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ memc_flexspi_s27ks0641_init, \ NULL, \ - &memc_flexspi_s27ks0641_data_##n, \ + &memc_flexspi_s27ks0641_data_##n, \ &memc_flexspi_s27ks0641_config_##n, \ POST_KERNEL, \ - CONFIG_MEMC_INIT_PRIORITY, \ NULL); DT_INST_FOREACH_STATUS_OKAY(MEMC_FLEXSPI_S27KS0641) diff --git a/drivers/memc/memc_mcux_flexspi_w956a8mbya.c b/drivers/memc/memc_mcux_flexspi_w956a8mbya.c index 60c5949b73fc5..ea188cfd533c1 100644 --- a/drivers/memc/memc_mcux_flexspi_w956a8mbya.c +++ b/drivers/memc/memc_mcux_flexspi_w956a8mbya.c @@ -178,13 +178,12 @@ static int memc_flexspi_w956a8mbya_init(const struct device *dev) .controller = DEVICE_DT_GET(DT_INST_BUS(n)), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ memc_flexspi_w956a8mbya_init, \ NULL, \ &memc_flexspi_w956a8mbya_data_##n, \ &memc_flexspi_w956a8mbya_config_##n, \ POST_KERNEL, \ - CONFIG_MEMC_INIT_PRIORITY, \ NULL); DT_INST_FOREACH_STATUS_OKAY(MEMC_FLEXSPI_W956A8MBYA) diff --git a/drivers/memc/memc_mspi_aps6404l.c b/drivers/memc/memc_mspi_aps6404l.c index a3bf64cb45006..63ca71068ae18 100644 --- a/drivers/memc/memc_mspi_aps6404l.c +++ b/drivers/memc/memc_mspi_aps6404l.c @@ -457,13 +457,12 @@ static int memc_mspi_aps6404l_init(const struct device *psram) .lock = Z_SEM_INITIALIZER(memc_mspi_aps6404l_data_##n.lock, 0, 1), \ }; \ PM_DEVICE_DT_INST_DEFINE(n, memc_mspi_aps6404l_pm_action); \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ memc_mspi_aps6404l_init, \ PM_DEVICE_DT_INST_GET(n), \ &memc_mspi_aps6404l_data_##n, \ &memc_mspi_aps6404l_config_##n, \ POST_KERNEL, \ - CONFIG_MEMC_INIT_PRIORITY, \ NULL); DT_INST_FOREACH_STATUS_OKAY(MEMC_MSPI_APS6404L) diff --git a/drivers/memc/memc_nxp_s32_qspi.c b/drivers/memc/memc_nxp_s32_qspi.c index e1d5c60bd67d7..82ea1144f75e0 100644 --- a/drivers/memc/memc_nxp_s32_qspi.c +++ b/drivers/memc/memc_nxp_s32_qspi.c @@ -185,13 +185,12 @@ uint8_t memc_nxp_s32_qspi_get_instance(const struct device *dev) .controller_cfg = &memc_nxp_s32_qspi_controller_cfg_##n, \ .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ memc_nxp_s32_qspi_init, \ NULL, \ &memc_nxp_s32_qspi_data_##n, \ &memc_nxp_s32_qspi_config_##n, \ POST_KERNEL, \ - CONFIG_MEMC_INIT_PRIORITY, \ NULL); DT_INST_FOREACH_STATUS_OKAY(MEMC_NXP_S32_QSPI_INIT_DEVICE) diff --git a/drivers/memc/memc_sam_smc.c b/drivers/memc/memc_sam_smc.c index b54f18f55bbc9..441f482201818 100644 --- a/drivers/memc/memc_sam_smc.c +++ b/drivers/memc/memc_sam_smc.c @@ -99,8 +99,8 @@ static int memc_smc_init(const struct device *dev) .banks = smc_bank_config_##inst, \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ }; \ - DEVICE_DT_INST_DEFINE(inst, memc_smc_init, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, memc_smc_init, NULL, NULL, \ &smc_config_##inst, POST_KERNEL, \ - CONFIG_MEMC_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(MEMC_SMC_DEFINE) diff --git a/drivers/memc/memc_smartbond_nor_psram.c b/drivers/memc/memc_smartbond_nor_psram.c index 2d0ae79e5fa26..eb33531609b96 100644 --- a/drivers/memc/memc_smartbond_nor_psram.c +++ b/drivers/memc/memc_smartbond_nor_psram.c @@ -235,8 +235,8 @@ static int memc_smartbond_pm_action(const struct device *dev, enum pm_device_act \ PM_DEVICE_DT_INST_DEFINE(inst, memc_smartbond_pm_action); \ \ - DEVICE_DT_INST_DEFINE(inst, memc_smartbond_init, PM_DEVICE_DT_INST_GET(inst), \ - NULL, NULL, \ - POST_KERNEL, CONFIG_MEMC_INIT_PRIORITY, NULL); + DEVICE_INSTANCE_FROM_DT_INST(inst, memc_smartbond_init, PM_DEVICE_DT_INST_GET(inst),\ + NULL, NULL, \ + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(SMARTBOND_MEMC_INIT) diff --git a/drivers/memc/memc_stm32.c b/drivers/memc/memc_stm32.c index 1609926b8885c..e4c57f737aae2 100644 --- a/drivers/memc/memc_stm32.c +++ b/drivers/memc/memc_stm32.c @@ -97,5 +97,5 @@ static const struct memc_stm32_config config = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0), }; -DEVICE_DT_INST_DEFINE(0, memc_stm32_init, NULL, NULL, - &config, POST_KERNEL, CONFIG_MEMC_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, memc_stm32_init, NULL, NULL, + &config, POST_KERNEL, NULL); diff --git a/drivers/memc/memc_stm32_nor_psram.c b/drivers/memc/memc_stm32_nor_psram.c index 023e71f5d4ca8..4ff3a62d14b11 100644 --- a/drivers/memc/memc_stm32_nor_psram.c +++ b/drivers/memc/memc_stm32_nor_psram.c @@ -172,7 +172,6 @@ static const struct memc_stm32_nor_psram_config config = { .banks_len = ARRAY_SIZE(bank_config), }; -DEVICE_DT_INST_DEFINE(0, memc_stm32_nor_psram_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, memc_stm32_nor_psram_init, NULL, NULL, &config, - POST_KERNEL, CONFIG_MEMC_INIT_PRIORITY, - NULL); + POST_KERNEL, NULL); diff --git a/drivers/memc/memc_stm32_sdram.c b/drivers/memc/memc_stm32_sdram.c index d6b7891fe13d0..34808f98e547f 100644 --- a/drivers/memc/memc_stm32_sdram.c +++ b/drivers/memc/memc_stm32_sdram.c @@ -130,5 +130,5 @@ static const struct memc_stm32_sdram_config config = { .banks_len = ARRAY_SIZE(bank_config), }; -DEVICE_DT_INST_DEFINE(0, memc_stm32_sdram_init, NULL, - NULL, &config, POST_KERNEL, CONFIG_MEMC_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, memc_stm32_sdram_init, NULL, + NULL, &config, POST_KERNEL, NULL); diff --git a/drivers/memc/sifive_ddr.c b/drivers/memc/sifive_ddr.c index f7005836e1cf1..9f9c19d50817e 100644 --- a/drivers/memc/sifive_ddr.c +++ b/drivers/memc/sifive_ddr.c @@ -208,5 +208,5 @@ static struct ddr_ctrl_data ddrctl_private_data = { .ddr_size = DT_REG_SIZE(DT_NODELABEL(ram0)), }; -DEVICE_DT_INST_DEFINE(0, ddr_init, NULL, &ddrctl_private_data, NULL, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, ddr_init, NULL, &ddrctl_private_data, NULL, POST_KERNEL, + NULL); diff --git a/drivers/mfd/mfd_ad559x.c b/drivers/mfd/mfd_ad559x.c index 1d298e8edae02..a805d53c2a149 100644 --- a/drivers/mfd/mfd_ad559x.c +++ b/drivers/mfd/mfd_ad559x.c @@ -103,8 +103,7 @@ static int mfd_ad559x_init(const struct device *dev) MFD_AD559X_DEFINE_BUS(inst), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, mfd_ad559x_init, NULL, &mfd_ad559x_data_##inst, \ - &mfd_ad559x_config_##inst, POST_KERNEL, CONFIG_MFD_INIT_PRIORITY, \ - NULL); + DEVICE_INSTANCE_FROM_DT_INST(inst, mfd_ad559x_init, NULL, &mfd_ad559x_data_##inst, \ + &mfd_ad559x_config_##inst, POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(MFD_AD559X_DEFINE); diff --git a/drivers/mfd/mfd_adp5585.c b/drivers/mfd/mfd_adp5585.c index d57b82035dca4..9f96b86e29b3b 100644 --- a/drivers/mfd/mfd_adp5585.c +++ b/drivers/mfd/mfd_adp5585.c @@ -138,8 +138,8 @@ static int mfd_adp5585_init(const struct device *dev) .dev = DEVICE_DT_INST_GET(inst), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, mfd_adp5585_init, NULL, &mfd_adp5585_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, mfd_adp5585_init, NULL, &mfd_adp5585_data_##inst, \ &mfd_adp5585_config_##inst, POST_KERNEL, \ - CONFIG_MFD_ADP5585_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(MFD_ADP5585_DEFINE); diff --git a/drivers/mfd/mfd_axp192.c b/drivers/mfd/mfd_axp192.c index 421f5d19a37cb..967dce8a52de5 100644 --- a/drivers/mfd/mfd_axp192.c +++ b/drivers/mfd/mfd_axp192.c @@ -614,7 +614,7 @@ int mfd_axp192_gpio_write_port(const struct device *dev, uint8_t value, uint8_t \ static struct mfd_axp192_data data##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, mfd_axp192_init, NULL, &data##inst, &config##inst, \ - POST_KERNEL, CONFIG_MFD_INIT_PRIORITY, NULL); + DEVICE_INSTANCE_FROM_DT_INST(inst, mfd_axp192_init, NULL, &data##inst, &config##inst, \ + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(MFD_AXP192_DEFINE); diff --git a/drivers/mfd/mfd_bd8lb600fs.c b/drivers/mfd/mfd_bd8lb600fs.c index 02e977e702df4..36ad51d7cb4ae 100644 --- a/drivers/mfd/mfd_bd8lb600fs.c +++ b/drivers/mfd/mfd_bd8lb600fs.c @@ -235,8 +235,7 @@ static int bd8lb600fs_init(const struct device *dev) }; \ \ /* This has to be initialized after the SPI peripheral. */ \ - DEVICE_DT_INST_DEFINE(inst, bd8lb600fs_init, NULL, &bd8lb600fs_##inst##_data, \ - &bd8lb600fs_##inst##_config, POST_KERNEL, CONFIG_MFD_INIT_PRIORITY, \ - NULL); + DEVICE_INSTANCE_FROM_DT_INST(inst, bd8lb600fs_init, NULL, &bd8lb600fs_##inst##_data, \ + &bd8lb600fs_##inst##_config, POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(BD8LB600FS_INIT) diff --git a/drivers/mfd/mfd_max20335.c b/drivers/mfd/mfd_max20335.c index 7ea6a9f198cfd..3c5ca97abfec1 100644 --- a/drivers/mfd/mfd_max20335.c +++ b/drivers/mfd/mfd_max20335.c @@ -44,8 +44,8 @@ static int mfd_max20335_init(const struct device *dev) .bus = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, mfd_max20335_init, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, mfd_max20335_init, NULL, NULL,\ &mfd_max20335_config##inst, POST_KERNEL, \ - CONFIG_MFD_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(MFD_MA20335_DEFINE) diff --git a/drivers/mfd/mfd_max31790.c b/drivers/mfd/mfd_max31790.c index f89bcc87fdd7a..d1e0c28e13839 100644 --- a/drivers/mfd/mfd_max31790.c +++ b/drivers/mfd/mfd_max31790.c @@ -75,7 +75,7 @@ static int max31790_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, max31790_init, NULL, NULL, &max31790_##inst##_config, \ - POST_KERNEL, CONFIG_MFD_INIT_PRIORITY, NULL); + DEVICE_INSTANCE_FROM_DT_INST(inst, max31790_init, NULL, NULL, &max31790_##inst##_config, \ + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(MAX31790_INIT); diff --git a/drivers/mfd/mfd_nct38xx.c b/drivers/mfd/mfd_nct38xx.c index 81b6ece4d1a6c..fc296ef883fac 100644 --- a/drivers/mfd/mfd_nct38xx.c +++ b/drivers/mfd/mfd_nct38xx.c @@ -50,7 +50,7 @@ const struct i2c_dt_spec *mfd_nct38xx_get_i2c_dt_spec(const struct device *dev) .i2c_dev = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, mfd_nct38xx_init, NULL, &nct38xx_data_##inst, \ - &nct38xx_cfg_##inst, POST_KERNEL, CONFIG_MFD_INIT_PRIORITY, NULL); + DEVICE_INSTANCE_FROM_DT_INST(inst, mfd_nct38xx_init, NULL, &nct38xx_data_##inst, \ + &nct38xx_cfg_##inst, POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(MFD_NCT38XX_DEFINE) diff --git a/drivers/mfd/mfd_npm1300.c b/drivers/mfd/mfd_npm1300.c index 2ea0818faeec4..d2c81c16ffde9 100644 --- a/drivers/mfd/mfd_npm1300.c +++ b/drivers/mfd/mfd_npm1300.c @@ -319,7 +319,7 @@ int mfd_npm1300_remove_callback(const struct device *dev, struct gpio_callback * .lp_reset = DT_INST_ENUM_IDX_OR(inst, long_press_reset, 0), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, mfd_npm1300_init, NULL, &data_##inst, &config##inst, \ - POST_KERNEL, CONFIG_MFD_NPM1300_INIT_PRIORITY, NULL); + DEVICE_INSTANCE_FROM_DT_INST(inst, mfd_npm1300_init, NULL, &data_##inst, &config##inst, \ + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(MFD_NPM1300_DEFINE) diff --git a/drivers/mfd/mfd_npm6001.c b/drivers/mfd/mfd_npm6001.c index b03b10b4cba99..111880e76dbe2 100644 --- a/drivers/mfd/mfd_npm6001.c +++ b/drivers/mfd/mfd_npm6001.c @@ -93,7 +93,7 @@ static int mfd_npm6001_init(const struct device *dev) NPM6001_PADDRIVESTRENGTH_SDA_HIGH)), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, mfd_npm6001_init, NULL, NULL, &config##inst, POST_KERNEL, \ - CONFIG_MFD_NPM6001_INIT_PRIORITY, NULL); + DEVICE_INSTANCE_FROM_DT_INST(inst, mfd_npm6001_init, NULL, NULL, &config##inst, POST_KERNEL,\ + NULL); DT_INST_FOREACH_STATUS_OKAY(MFD_NPM6001_DEFINE) diff --git a/drivers/mfd/mfd_nxp_lp_flexcomm.c b/drivers/mfd/mfd_nxp_lp_flexcomm.c index ec6a325d3d0e8..ac16c3b3f753f 100644 --- a/drivers/mfd/mfd_nxp_lp_flexcomm.c +++ b/drivers/mfd/mfd_nxp_lp_flexcomm.c @@ -150,13 +150,12 @@ static int nxp_lp_flexcomm_init(const struct device *dev) .num_children = ARRAY_SIZE(nxp_lp_flexcomm_children_##n), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &nxp_lp_flexcomm_init, \ NULL, \ &nxp_lp_flexcomm_data_##n, \ &nxp_lp_flexcomm_config_##n, \ PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ NULL); \ \ static void nxp_lp_flexcomm_config_func_##n(const struct device *dev) \ diff --git a/drivers/mfd/mfd_tle9104.c b/drivers/mfd/mfd_tle9104.c index 710c6d1d8a5d7..1c6fc28fbf6f2 100644 --- a/drivers/mfd/mfd_tle9104.c +++ b/drivers/mfd/mfd_tle9104.c @@ -618,8 +618,7 @@ static int tle9104_init(const struct device *dev) \ static struct tle9104_data tle9104_##inst##_data; \ \ - DEVICE_DT_INST_DEFINE(inst, tle9104_init, NULL, &tle9104_##inst##_data, \ - &tle9104_##inst##_config, POST_KERNEL, CONFIG_MFD_INIT_PRIORITY, \ - NULL); + DEVICE_INSTANCE_FROM_DT_INST(inst, tle9104_init, NULL, &tle9104_##inst##_data, \ + &tle9104_##inst##_config, POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(TLE9104_INIT); diff --git a/drivers/mipi_dbi/mipi_dbi_bitbang.c b/drivers/mipi_dbi/mipi_dbi_bitbang.c index 5c2b39f17493d..e30f8ad6e31db 100644 --- a/drivers/mipi_dbi/mipi_dbi_bitbang.c +++ b/drivers/mipi_dbi/mipi_dbi_bitbang.c @@ -340,8 +340,8 @@ static const struct mipi_dbi_driver_api mipi_dbi_bitbang_driver_api = { BUILD_ASSERT(DT_INST_PROP_LEN(n, data_gpios) < MIPI_DBI_MAX_DATA_BUS_WIDTH, \ "Number of data GPIOs in DT exceeds MIPI_DBI_MAX_DATA_BUS_WIDTH"); \ static struct mipi_dbi_bitbang_data mipi_dbi_bitbang_data_##n; \ - DEVICE_DT_INST_DEFINE(n, mipi_dbi_bitbang_init, NULL, &mipi_dbi_bitbang_data_##n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, mipi_dbi_bitbang_init, NULL, &mipi_dbi_bitbang_data_##n, \ &mipi_dbi_bitbang_config_##n, POST_KERNEL, \ - CONFIG_MIPI_DBI_INIT_PRIORITY, &mipi_dbi_bitbang_driver_api); + &mipi_dbi_bitbang_driver_api); DT_INST_FOREACH_STATUS_OKAY(MIPI_DBI_BITBANG_INIT) diff --git a/drivers/mipi_dbi/mipi_dbi_nxp_flexio_lcdif.c b/drivers/mipi_dbi/mipi_dbi_nxp_flexio_lcdif.c index fac05f7ca44d2..378c1e59f12eb 100644 --- a/drivers/mipi_dbi/mipi_dbi_nxp_flexio_lcdif.c +++ b/drivers/mipi_dbi/mipi_dbi_nxp_flexio_lcdif.c @@ -473,13 +473,12 @@ static struct mipi_dbi_driver_api mipi_dbi_lcdif_driver_api = { } \ }, \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &flexio_lcdif_init, \ NULL, \ &mcux_flexio_lcdif_data_##n, \ &mcux_flexio_lcdif_config_##n, \ POST_KERNEL, \ - CONFIG_MIPI_DBI_INIT_PRIORITY, \ &mipi_dbi_lcdif_driver_api); DT_INST_FOREACH_STATUS_OKAY(MCUX_FLEXIO_LCDIF_DEVICE_INIT) diff --git a/drivers/mipi_dbi/mipi_dbi_nxp_lcdic.c b/drivers/mipi_dbi/mipi_dbi_nxp_lcdic.c index 4c252a277feee..c4fa0e6ac6999 100644 --- a/drivers/mipi_dbi/mipi_dbi_nxp_lcdic.c +++ b/drivers/mipi_dbi/mipi_dbi_nxp_lcdic.c @@ -817,11 +817,10 @@ static void mipi_dbi_lcdic_isr(const struct device *dev) static struct mipi_dbi_lcdic_data mipi_dbi_lcdic_data_##n = { \ LCDIC_DMA_CHANNELS(n) \ }; \ - DEVICE_DT_INST_DEFINE(n, mipi_dbi_lcdic_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, mipi_dbi_lcdic_init, NULL, \ &mipi_dbi_lcdic_data_##n, \ &mipi_dbi_lcdic_config_##n, \ POST_KERNEL, \ - CONFIG_MIPI_DBI_INIT_PRIORITY, \ &mipi_dbi_lcdic_driver_api); DT_INST_FOREACH_STATUS_OKAY(MIPI_DBI_LCDIC_INIT) diff --git a/drivers/mipi_dbi/mipi_dbi_smartbond.c b/drivers/mipi_dbi/mipi_dbi_smartbond.c index 24e5189ab715b..477b1d42810e8 100644 --- a/drivers/mipi_dbi/mipi_dbi_smartbond.c +++ b/drivers/mipi_dbi/mipi_dbi_smartbond.c @@ -561,12 +561,11 @@ static const struct mipi_dbi_driver_api mipi_dbi_smartbond_driver_api = { \ PM_DEVICE_DT_INST_DEFINE(inst, mipi_dbi_smartbond_pm_action); \ \ - DEVICE_DT_INST_DEFINE(inst, mipi_dbi_smartbond_init, \ - PM_DEVICE_DT_INST_GET(inst), \ - &mipi_dbi_smartbond_data_## inst, \ - &mipi_dbi_smartbond_config_## inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, mipi_dbi_smartbond_init,\ + PM_DEVICE_DT_INST_GET(inst),\ + &mipi_dbi_smartbond_data_## inst,\ + &mipi_dbi_smartbond_config_## inst,\ POST_KERNEL, \ - CONFIG_MIPI_DBI_INIT_PRIORITY, \ &mipi_dbi_smartbond_driver_api); SMARTBOND_MIPI_DBI_INIT(0); diff --git a/drivers/mipi_dbi/mipi_dbi_spi.c b/drivers/mipi_dbi/mipi_dbi_spi.c index abbb02977fa2a..0ca4ad6839b2a 100644 --- a/drivers/mipi_dbi/mipi_dbi_spi.c +++ b/drivers/mipi_dbi/mipi_dbi_spi.c @@ -334,11 +334,10 @@ static const struct mipi_dbi_driver_api mipi_dbi_spi_driver_api = { }; \ static struct mipi_dbi_spi_data mipi_dbi_spi_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, mipi_dbi_spi_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, mipi_dbi_spi_init, NULL, \ &mipi_dbi_spi_data_##n, \ &mipi_dbi_spi_config_##n, \ POST_KERNEL, \ - CONFIG_MIPI_DBI_INIT_PRIORITY, \ &mipi_dbi_spi_driver_api); DT_INST_FOREACH_STATUS_OKAY(MIPI_DBI_SPI_INIT) diff --git a/drivers/mipi_dbi/mipi_dbi_stm32_fmc.c b/drivers/mipi_dbi/mipi_dbi_stm32_fmc.c index b6580a6efd7a6..6f8efcd2e1c64 100644 --- a/drivers/mipi_dbi/mipi_dbi_stm32_fmc.c +++ b/drivers/mipi_dbi/mipi_dbi_stm32_fmc.c @@ -197,8 +197,8 @@ static struct mipi_dbi_driver_api mipi_dbi_stm32_fmc_driver_api = { \ static struct mipi_dbi_stm32_fmc_data mipi_dbi_stm32_fmc_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, mipi_dbi_stm32_fmc_init, NULL, &mipi_dbi_stm32_fmc_data_##n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, mipi_dbi_stm32_fmc_init, NULL, &mipi_dbi_stm32_fmc_data_##n,\ &mipi_dbi_stm32_fmc_config_##n, POST_KERNEL, \ - CONFIG_MIPI_DBI_INIT_PRIORITY, &mipi_dbi_stm32_fmc_driver_api); + &mipi_dbi_stm32_fmc_driver_api); DT_INST_FOREACH_STATUS_OKAY(MIPI_DBI_STM32_FMC_INIT) diff --git a/drivers/mipi_dsi/dsi_mcux.c b/drivers/mipi_dsi/dsi_mcux.c index 03b0c39ceaf97..dba38b1a049d7 100644 --- a/drivers/mipi_dsi/dsi_mcux.c +++ b/drivers/mipi_dsi/dsi_mcux.c @@ -353,13 +353,12 @@ static int display_mcux_mipi_dsi_init(const struct device *dev) .phy_clock = DT_INST_PROP(id, phy_clock), \ }; \ static struct display_mcux_mipi_dsi_data display_mcux_mipi_dsi_data_##id; \ - DEVICE_DT_INST_DEFINE(id, \ + DEVICE_INSTANCE_FROM_DT_INST(id, \ &display_mcux_mipi_dsi_init, \ NULL, \ &display_mcux_mipi_dsi_data_##id, \ &display_mcux_mipi_dsi_config_##id, \ POST_KERNEL, \ - CONFIG_MIPI_DSI_INIT_PRIORITY, \ &dsi_mcux_api); DT_INST_FOREACH_STATUS_OKAY(MCUX_MIPI_DSI_DEVICE) diff --git a/drivers/mipi_dsi/dsi_mcux_2l.c b/drivers/mipi_dsi/dsi_mcux_2l.c index 9ca8a60ca99a6..c7ae441b53465 100644 --- a/drivers/mipi_dsi/dsi_mcux_2l.c +++ b/drivers/mipi_dsi/dsi_mcux_2l.c @@ -549,13 +549,12 @@ static int mcux_mipi_dsi_init(const struct device *dev) }; \ \ static struct mcux_mipi_dsi_data mipi_dsi_data_##id; \ - DEVICE_DT_INST_DEFINE(id, \ + DEVICE_INSTANCE_FROM_DT_INST(id, \ &mcux_mipi_dsi_init, \ NULL, \ &mipi_dsi_data_##id, \ &mipi_dsi_config_##id, \ POST_KERNEL, \ - CONFIG_MIPI_DSI_INIT_PRIORITY, \ &dsi_mcux_api); DT_INST_FOREACH_STATUS_OKAY(MCUX_MIPI_DSI_DEVICE) diff --git a/drivers/mipi_dsi/dsi_stm32.c b/drivers/mipi_dsi/dsi_stm32.c index 827d7f9e33fa2..5afd2ff46f0c7 100644 --- a/drivers/mipi_dsi/dsi_stm32.c +++ b/drivers/mipi_dsi/dsi_stm32.c @@ -505,8 +505,8 @@ static int mipi_dsi_stm32_init(const struct device *dev) .PLLODF = DT_INST_PROP(inst, pll_odf), \ }, \ }; \ - DEVICE_DT_INST_DEFINE(inst, &mipi_dsi_stm32_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &mipi_dsi_stm32_init, NULL, \ &stm32_dsi_data_##inst, &stm32_dsi_config_##inst, \ - POST_KERNEL, CONFIG_MIPI_DSI_INIT_PRIORITY, &dsi_stm32_api); + POST_KERNEL, &dsi_stm32_api); DT_INST_FOREACH_STATUS_OKAY(STM32_MIPI_DSI_DEVICE) diff --git a/drivers/mipi_dsi/dsi_test.c b/drivers/mipi_dsi/dsi_test.c index 59e892e506e60..b82d0ceed6dce 100644 --- a/drivers/mipi_dsi/dsi_test.c +++ b/drivers/mipi_dsi/dsi_test.c @@ -50,7 +50,7 @@ static struct mipi_dsi_driver_api vnd_mipi_dsi_api = { }; #define VND_MIPI_DSI_INIT(n) \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, POST_KERNEL, \ - CONFIG_MIPI_DSI_INIT_PRIORITY, &vnd_mipi_dsi_api); + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, NULL, NULL, POST_KERNEL, \ + &vnd_mipi_dsi_api); DT_INST_FOREACH_STATUS_OKAY(VND_MIPI_DSI_INIT) diff --git a/drivers/misc/devmux/devmux.c b/drivers/misc/devmux/devmux.c index d8c1a9b90c74e..4b87a6a9e374b 100644 --- a/drivers/misc/devmux/devmux.c +++ b/drivers/misc/devmux/devmux.c @@ -174,8 +174,8 @@ static int devmux_init(struct device *const dev) .selected = DEVMUX_SELECTED(_n), \ }; \ \ - DEVICE_DT_INST_DEFINE(_n, devmux_init, NULL, &devmux_data_##_n, &devmux_config_##_n, \ - PRE_KERNEL_1, CONFIG_DEVMUX_INIT_PRIORITY, NULL); + DEVICE_INSTANCE_FROM_DT_INST(_n, devmux_init, NULL, &devmux_data_##_n, &devmux_config_##_n,\ + PRE_KERNEL_1, NULL); DT_INST_FOREACH_STATUS_OKAY(DEVMUX_DEFINE) diff --git a/drivers/misc/ethos_u/ethos_u.c b/drivers/misc/ethos_u/ethos_u.c index 308e689fe0fb1..2a827e6975931 100644 --- a/drivers/misc/ethos_u/ethos_u.c +++ b/drivers/misc/ethos_u/ethos_u.c @@ -167,7 +167,7 @@ static int ethosu_zephyr_init(const struct device *dev) .irq_config = ðosu_zephyr_irq_config_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, ethosu_zephyr_init, NULL, ðosu_data_##n, ðosu_dts_info_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); + DEVICE_INSTANCE_FROM_DT_INST(n, ethosu_zephyr_init, NULL, ðosu_data_##n, ðosu_dts_info_##n,\ + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(ETHOSU_DEVICE_INIT); diff --git a/drivers/misc/ft8xx/ft8xx.c b/drivers/misc/ft8xx/ft8xx.c index 1dcbe581b13e4..d19de3e309d19 100644 --- a/drivers/misc/ft8xx/ft8xx.c +++ b/drivers/misc/ft8xx/ft8xx.c @@ -167,8 +167,8 @@ static int ft8xx_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, ft8xx_init, NULL, &ft8xx_data, &ft8xx_config, - POST_KERNEL, CONFIG_FT800_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, ft8xx_init, NULL, &ft8xx_data, &ft8xx_config, + POST_KERNEL, NULL); int ft8xx_get_touch_tag(void) { diff --git a/drivers/misc/grove_lcd_rgb/grove_lcd_rgb.c b/drivers/misc/grove_lcd_rgb/grove_lcd_rgb.c index 5b026fe6e3ffd..f4793b3ce0aaf 100644 --- a/drivers/misc/grove_lcd_rgb/grove_lcd_rgb.c +++ b/drivers/misc/grove_lcd_rgb/grove_lcd_rgb.c @@ -285,6 +285,6 @@ static const struct glcd_config grove_lcd_config = { static struct glcd_data grove_lcd_data; -DEVICE_DT_INST_DEFINE(0, glcd_initialize, NULL, &grove_lcd_data, +DEVICE_INSTANCE_FROM_DT_INST(0, glcd_initialize, NULL, &grove_lcd_data, &grove_lcd_config, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, NULL); + NULL); diff --git a/drivers/misc/mcux_flexio/mcux_flexio.c b/drivers/misc/mcux_flexio/mcux_flexio.c index 46c39d0910d79..112f3e0384551 100644 --- a/drivers/misc/mcux_flexio/mcux_flexio.c +++ b/drivers/misc/mcux_flexio/mcux_flexio.c @@ -232,12 +232,11 @@ int nxp_flexio_child_attach(const struct device *dev, .irq_disable_func = mcux_flexio_irq_disable_func_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &mcux_flexio_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &mcux_flexio_init, \ NULL, \ &mcux_flexio_data_##n, \ &mcux_flexio_config_##n, \ POST_KERNEL, \ - CONFIG_MCUX_FLEXIO_INIT_PRIORITY, \ NULL); \ \ static void mcux_flexio_irq_config_func_##n(const struct device *dev) \ diff --git a/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c b/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c index 2c2915a798438..8f5dbf719fe8f 100644 --- a/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c +++ b/drivers/misc/nordic_vpr_launcher/nordic_vpr_launcher.c @@ -70,7 +70,7 @@ static int nordic_vpr_launcher_init(const struct device *dev) (.src_addr = VPR_ADDR(DT_INST_PHANDLE(inst, source_memory)), \ .size = DT_REG_SIZE(DT_INST_PHANDLE(inst, execution_memory)),))}; \ \ - DEVICE_DT_INST_DEFINE(inst, nordic_vpr_launcher_init, NULL, NULL, &config##inst, \ - POST_KERNEL, CONFIG_NORDIC_VPR_LAUNCHER_INIT_PRIORITY, NULL); + DEVICE_INSTANCE_FROM_DT_INST(inst, nordic_vpr_launcher_init, NULL, NULL, &config##inst, \ + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(NORDIC_VPR_LAUNCHER_DEFINE) diff --git a/drivers/misc/nxp_s32_emios/nxp_s32_emios.c b/drivers/misc/nxp_s32_emios/nxp_s32_emios.c index d22d94b301542..b92313c737942 100644 --- a/drivers/misc/nxp_s32_emios/nxp_s32_emios.c +++ b/drivers/misc/nxp_s32_emios/nxp_s32_emios.c @@ -128,13 +128,12 @@ static int nxp_s32_emios_init(const struct device *dev) .mcl_info = (Emios_Mcl_Ip_ConfigType *)&nxp_s32_emios_##n##_mcl_config, \ .irq_config = nxp_s32_emios_##n##_interrupt_config, \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &nxp_s32_emios_init, \ NULL, \ NULL, \ &nxp_s32_emios_##n##_config, \ POST_KERNEL, \ - CONFIG_NXP_S32_EMIOS_INIT_PRIORITY, \ NULL); DT_INST_FOREACH_STATUS_OKAY(NXP_S32_EMIOS_INIT_DEVICE) diff --git a/drivers/misc/pio_rpi_pico/pio_rpi_pico.c b/drivers/misc/pio_rpi_pico/pio_rpi_pico.c index 5182cdf32b0ea..1aecc74151538 100644 --- a/drivers/misc/pio_rpi_pico/pio_rpi_pico.c +++ b/drivers/misc/pio_rpi_pico/pio_rpi_pico.c @@ -67,7 +67,7 @@ static int pio_rpi_pico_init(const struct device *dev) .reset = RESET_DT_SPEC_INST_GET(idx), \ }; \ \ - DEVICE_DT_INST_DEFINE(idx, &pio_rpi_pico_init, NULL, NULL, &pio_rpi_pico_config_##idx, \ - PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); + DEVICE_INSTANCE_FROM_DT_INST(idx, &pio_rpi_pico_init, NULL, NULL, &pio_rpi_pico_config_##idx,\ + PRE_KERNEL_2, NULL); DT_INST_FOREACH_STATUS_OKAY(RPI_PICO_PIO_INIT) diff --git a/drivers/misc/timeaware_gpio/timeaware_gpio_intel.c b/drivers/misc/timeaware_gpio/timeaware_gpio_intel.c index ae0e519a4378b..0129ea70aeed6 100644 --- a/drivers/misc/timeaware_gpio/timeaware_gpio_intel.c +++ b/drivers/misc/timeaware_gpio/timeaware_gpio_intel.c @@ -220,12 +220,11 @@ static int tgpio_init(const struct device *dev) \ static struct tgpio_runtime tgpio_##n##_runtime; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &tgpio_init, \ NULL, \ &tgpio_##n##_runtime, \ - &tgpio_##n##_cfg, \ - POST_KERNEL, CONFIG_TIMEAWARE_GPIO_INIT_PRIORITY,\ - &api_funcs); \ + &tgpio_##n##_cfg, \ + POST_KERNEL, &api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(TGPIO_INTEL_DEV_CFG_DATA) diff --git a/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c b/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c index b7b046f3b9542..f501dce898e38 100644 --- a/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c +++ b/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c @@ -946,11 +946,10 @@ static const struct intel_adsp_tlb_api adsp_tlb_api_func = { .get_storage_size = adsp_mm_get_storage_size }; -DEVICE_DT_DEFINE(DT_INST(0, intel_adsp_mtl_tlb), +DEVICE_INSTANCE(DT_INST(0, intel_adsp_mtl_tlb), sys_mm_drv_mm_init, NULL, NULL, NULL, POST_KERNEL, - 0, &adsp_tlb_api_func); diff --git a/drivers/modem/hl7800.c b/drivers/modem/hl7800.c index a30d3cbd8c61c..569e268f02af6 100644 --- a/drivers/modem/hl7800.c +++ b/drivers/modem/hl7800.c @@ -6569,6 +6569,5 @@ static struct offloaded_if_api api_funcs = { .iface_api.init = offload_iface_init, }; -NET_DEVICE_DT_INST_OFFLOAD_DEFINE(0, hl7800_init, NULL, &iface_ctx, - &hl7800_cfg, CONFIG_MODEM_HL7800_INIT_PRIORITY, - &api_funcs, MDM_MTU); +NET_DEVICE_OFFLOAD_INSTANCE_FROM_DT_INST(0, hl7800_init, NULL, &iface_ctx, + &hl7800_cfg, &api_funcs, MDM_MTU); diff --git a/drivers/modem/quectel-bg9x.c b/drivers/modem/quectel-bg9x.c index a89257275f81f..105f037a69f30 100644 --- a/drivers/modem/quectel-bg9x.c +++ b/drivers/modem/quectel-bg9x.c @@ -1280,9 +1280,8 @@ static int modem_init(const struct device *dev) } /* Register the device with the Networking stack. */ -NET_DEVICE_DT_INST_OFFLOAD_DEFINE(0, modem_init, NULL, +NET_DEVICE_OFFLOAD_INSTANCE_FROM_DT_INST(0, modem_init, NULL, &mdata, NULL, - CONFIG_MODEM_QUECTEL_BG9X_INIT_PRIORITY, &api_funcs, MDM_MAX_DATA_LENGTH); /* Register NET sockets. */ diff --git a/drivers/modem/simcom-sim7080.c b/drivers/modem/simcom-sim7080.c index cc3955f96f63e..9c60709482754 100644 --- a/drivers/modem/simcom-sim7080.c +++ b/drivers/modem/simcom-sim7080.c @@ -2429,8 +2429,8 @@ static int modem_init(const struct device *dev) } /* Register device with the networking stack. */ -NET_DEVICE_DT_INST_OFFLOAD_DEFINE(0, modem_init, NULL, &mdata, NULL, - CONFIG_MODEM_SIMCOM_SIM7080_INIT_PRIORITY, &api_funcs, +NET_DEVICE_OFFLOAD_INSTANCE_FROM_DT_INST(0, modem_init, NULL, &mdata, NULL, + &api_funcs, MDM_MAX_DATA_LENGTH); NET_SOCKET_OFFLOAD_REGISTER(simcom_sim7080, CONFIG_NET_SOCKETS_OFFLOAD_PRIORITY, diff --git a/drivers/modem/ublox-sara-r4.c b/drivers/modem/ublox-sara-r4.c index 734ccac2eb98e..9293c3ac7972e 100644 --- a/drivers/modem/ublox-sara-r4.c +++ b/drivers/modem/ublox-sara-r4.c @@ -2238,8 +2238,7 @@ static int modem_init(const struct device *dev) return ret; } -NET_DEVICE_DT_INST_OFFLOAD_DEFINE(0, modem_init, NULL, +NET_DEVICE_OFFLOAD_INSTANCE_FROM_DT_INST(0, modem_init, NULL, &mdata, NULL, - CONFIG_MODEM_UBLOX_SARA_R4_INIT_PRIORITY, &api_funcs, MDM_MAX_DATA_LENGTH); diff --git a/drivers/modem/wncm14a2a.c b/drivers/modem/wncm14a2a.c index 12b9b4b341a85..b6d855121503c 100644 --- a/drivers/modem/wncm14a2a.c +++ b/drivers/modem/wncm14a2a.c @@ -1781,8 +1781,7 @@ static struct offloaded_if_api api_funcs = { .iface_api.init = offload_iface_init, }; -NET_DEVICE_DT_INST_OFFLOAD_DEFINE(0, wncm14a2a_init, NULL, +NET_DEVICE_OFFLOAD_INSTANCE_FROM_DT_INST(0, wncm14a2a_init, NULL, &ictx, &wncm14a2a_cfg, - CONFIG_MODEM_WNCM14A2A_INIT_PRIORITY, &api_funcs, MDM_MAX_DATA_LENGTH); diff --git a/drivers/mspi/mspi_ambiq_ap3.c b/drivers/mspi/mspi_ambiq_ap3.c index 04fbea5c679b4..9d6dca079edf7 100644 --- a/drivers/mspi/mspi_ambiq_ap3.c +++ b/drivers/mspi/mspi_ambiq_ap3.c @@ -1431,13 +1431,12 @@ static struct mspi_driver_api mspi_ambiq_driver_api = { LOG_INSTANCE_PTR_INIT(log, DT_DRV_INST(n), mspi##n) \ }; \ PM_DEVICE_DT_INST_DEFINE(n, mspi_ambiq_pm_action); \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ mspi_ambiq_init, \ PM_DEVICE_DT_INST_GET(n), \ &mspi_ambiq_data##n, \ &mspi_ambiq_config##n, \ POST_KERNEL, \ - CONFIG_MSPI_INIT_PRIORITY, \ &mspi_ambiq_driver_api); DT_INST_FOREACH_STATUS_OKAY(AMBIQ_MSPI_DEFINE) diff --git a/drivers/mspi/mspi_emul.c b/drivers/mspi/mspi_emul.c index 57b28bfc06f56..ad0d03d74aea4 100644 --- a/drivers/mspi/mspi_emul.c +++ b/drivers/mspi/mspi_emul.c @@ -897,13 +897,12 @@ static struct emul_mspi_driver_api emul_mspi_driver_api = { .ctx.callback = 0, \ .ctx.callback_ctx = 0, \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &mspi_emul_init, \ NULL, \ &mspi_emul_data_##n, \ &mspi_emul_cfg_##n, \ POST_KERNEL, \ - CONFIG_MSPI_INIT_PRIORITY, \ &emul_mspi_driver_api); DT_INST_FOREACH_STATUS_OKAY(MSPI_EMUL_INIT) diff --git a/drivers/net/CMakeLists.txt b/drivers/net/CMakeLists.txt index 456d27c02e952..1587a87735315 100644 --- a/drivers/net/CMakeLists.txt +++ b/drivers/net/CMakeLists.txt @@ -4,6 +4,7 @@ zephyr_library() zephyr_library_sources_ifdef(CONFIG_NET_LOOPBACK loopback.c) zephyr_library_sources_ifdef(CONFIG_NET_CANBUS canbus.c) +zephyr_add_device_init_ifdef(CONFIG_NET_CANBUS canbus_device.yaml) if(CONFIG_NET_NATIVE) zephyr_library_sources_ifdef(CONFIG_SLIP slip.c) diff --git a/drivers/net/canbus.c b/drivers/net/canbus.c index 41cbb58685299..1f24cc5897c90 100644 --- a/drivers/net/canbus.c +++ b/drivers/net/canbus.c @@ -158,6 +158,6 @@ static const struct net_canbus_config net_canbus_cfg = { .can_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus)) }; -NET_DEVICE_INIT(net_canbus, "NET_CANBUS", net_canbus_init, NULL, &net_canbus_ctx, &net_canbus_cfg, - CONFIG_NET_CANBUS_INIT_PRIORITY, &net_canbus_api, CANBUS_RAW_L2, +NET_DEVICE_INSTANCE(net_canbus, net_canbus_init, NULL, &net_canbus_ctx, &net_canbus_cfg, + &net_canbus_api, CANBUS_RAW_L2, NET_L2_GET_CTX_TYPE(CANBUS_RAW_L2), CAN_MTU); diff --git a/drivers/net/canbus_device.yaml b/drivers/net/canbus_device.yaml new file mode 100644 index 0000000000000..2b67109409782 --- /dev/null +++ b/drivers/net/canbus_device.yaml @@ -0,0 +1,5 @@ +device: + net_canbus: + init: + dependencies: + - zephyr,canbus diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 7a47ab577d8c7..5ace24fc8b3ba 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -169,8 +169,6 @@ static struct dummy_api loopback_api = { .send = loopback_send, }; -NET_DEVICE_INIT(loopback, "lo", - loopback_dev_init, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, +NET_DEVICE_INSTANCE(loopback, loopback_dev_init, NULL, NULL, NULL, &loopback_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), CONFIG_NET_LOOPBACK_MTU); diff --git a/drivers/net/nsos_sockets.c b/drivers/net/nsos_sockets.c index 6a1cc7637391a..8d69d4589e92e 100644 --- a/drivers/net/nsos_sockets.c +++ b/drivers/net/nsos_sockets.c @@ -1578,8 +1578,7 @@ static struct offloaded_if_api nsos_iface_offload_api = { .enable = nsos_iface_enable, }; -NET_DEVICE_OFFLOAD_INIT(nsos_socket, "nsos_socket", - nsos_socket_offload_init, +NET_DEVICE_OFFLOAD_INSTANCE(nsos_socket, nsos_socket_offload_init, NULL, NULL, NULL, - 0, &nsos_iface_offload_api, NET_ETH_MTU); + &nsos_iface_offload_api, NET_ETH_MTU); diff --git a/drivers/net/ppp.c b/drivers/net/ppp.c index 99d3eef881f97..8351a64409d1a 100644 --- a/drivers/net/ppp.c +++ b/drivers/net/ppp.c @@ -1151,7 +1151,7 @@ static const struct ppp_api ppp_if_api = { #endif }; -NET_DEVICE_INIT(ppp, CONFIG_NET_PPP_DRV_NAME, ppp_driver_init, +NET_DEVICE_INSTANCE(ppp, ppp_driver_init, NULL, &ppp_driver_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &ppp_if_api, + &ppp_if_api, PPP_L2, NET_L2_GET_CTX_TYPE(PPP_L2), PPP_MTU); diff --git a/drivers/net/slip.c b/drivers/net/slip.c index c9f9fd7bb62fc..f0facdb5e8a79 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c @@ -426,7 +426,6 @@ static const struct dummy_api slip_if_api = { #define _SLIP_L2_LAYER DUMMY_L2 #define _SLIP_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT(slip, CONFIG_SLIP_DRV_NAME, slip_init, NULL, - &slip_context_data, NULL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &slip_if_api, _SLIP_L2_LAYER, _SLIP_L2_CTX_TYPE, _SLIP_MTU); +NET_DEVICE_INSTANCE(slip, slip_init, NULL, + &slip_context_data, NULL, &slip_if_api, _SLIP_L2_LAYER, _SLIP_L2_CTX_TYPE, _SLIP_MTU); #endif diff --git a/drivers/pcie/endpoint/pcie_ep_iproc.c b/drivers/pcie/endpoint/pcie_ep_iproc.c index 92050051cf971..ef1f939604519 100644 --- a/drivers/pcie/endpoint/pcie_ep_iproc.c +++ b/drivers/pcie/endpoint/pcie_ep_iproc.c @@ -498,8 +498,7 @@ static const struct pcie_ep_driver_api iproc_pcie_ep_api = { #endif }; -DEVICE_DT_INST_DEFINE(0, &iproc_pcie_ep_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &iproc_pcie_ep_init, NULL, &iproc_pcie_ep_ctx_0, &iproc_pcie_ep_config_0, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &iproc_pcie_ep_api); + POST_KERNEL, &iproc_pcie_ep_api); diff --git a/drivers/pcie/host/pcie_ecam.c b/drivers/pcie/host/pcie_ecam.c index 15a52b3247dc2..c010a43a7ddb9 100644 --- a/drivers/pcie/host/pcie_ecam.c +++ b/drivers/pcie/host/pcie_ecam.c @@ -399,11 +399,10 @@ static const struct pcie_ctrl_driver_api pcie_ecam_api = { DT_FOREACH_RANGE(DT_DRV_INST(n), PCIE_RANGE_FORMAT) \ }, \ }; \ - DEVICE_DT_INST_DEFINE(n, &pcie_ecam_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &pcie_ecam_init, NULL, \ &pcie_ecam_data##n, \ &pcie_ecam_config##n, \ PRE_KERNEL_1, \ - CONFIG_PCIE_INIT_PRIORITY, \ &pcie_ecam_api); DT_INST_FOREACH_STATUS_OKAY(PCIE_ECAM_INIT) diff --git a/drivers/pcie/host/ptm.c b/drivers/pcie/host/ptm.c index b077ef86cb130..ca212a3618f84 100644 --- a/drivers/pcie/host/ptm.c +++ b/drivers/pcie/host/ptm.c @@ -62,9 +62,9 @@ static int pcie_ptm_root_init(const struct device *dev) static const struct pcie_ptm_root_config ptm_config_##index = { \ DEVICE_PCIE_INST_INIT(index, pcie), \ }; \ - DEVICE_DT_INST_DEFINE(index, &pcie_ptm_root_init, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(index, &pcie_ptm_root_init, NULL, NULL,\ &ptm_config_##index, PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(PCIE_PTM_ROOT_INIT) diff --git a/drivers/peci/peci_ite_it8xxx2.c b/drivers/peci/peci_ite_it8xxx2.c index 9cafeee2ed8b0..48f5ca6f432e9 100644 --- a/drivers/peci/peci_ite_it8xxx2.c +++ b/drivers/peci/peci_ite_it8xxx2.c @@ -340,10 +340,9 @@ static int peci_it8xxx2_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, &peci_it8xxx2_init, NULL, &peci_it8xxx2_data0, &peci_it8xxx2_config0, - POST_KERNEL, CONFIG_PECI_INIT_PRIORITY, - &peci_it8xxx2_driver_api); + POST_KERNEL, &peci_it8xxx2_driver_api); diff --git a/drivers/peci/peci_mchp_xec.c b/drivers/peci/peci_mchp_xec.c index e03181e0f6b9b..5cdd28c875c69 100644 --- a/drivers/peci/peci_mchp_xec.c +++ b/drivers/peci/peci_mchp_xec.c @@ -576,9 +576,8 @@ static const struct peci_xec_config peci_xec_config = { PM_DEVICE_DT_INST_DEFINE(0, peci_xec_pm_action); -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, &peci_xec_init, PM_DEVICE_DT_INST_GET(0), &peci_data, &peci_xec_config, - POST_KERNEL, CONFIG_PECI_INIT_PRIORITY, - &peci_xec_driver_api); + POST_KERNEL, &peci_xec_driver_api); diff --git a/drivers/peci/peci_npcx.c b/drivers/peci/peci_npcx.c index a8579cbc21031..7d5ddde94b1b3 100644 --- a/drivers/peci/peci_npcx.c +++ b/drivers/peci/peci_npcx.c @@ -283,8 +283,8 @@ static const struct peci_npcx_config peci_npcx_config0 = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0), }; -DEVICE_DT_INST_DEFINE(0, &peci_npcx_init, NULL, &peci_npcx_data0, &peci_npcx_config0, POST_KERNEL, - CONFIG_PECI_INIT_PRIORITY, &peci_npcx_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &peci_npcx_init, NULL, &peci_npcx_data0, &peci_npcx_config0, POST_KERNEL, + &peci_npcx_driver_api); BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, "only one 'nuvoton_npcx_peci' compatible node can be supported"); diff --git a/drivers/pinctrl/pinctrl_ite_it8xxx2.c b/drivers/pinctrl/pinctrl_ite_it8xxx2.c index 422f8c6c67ff9..9866d2d59951f 100644 --- a/drivers/pinctrl/pinctrl_ite_it8xxx2.c +++ b/drivers/pinctrl/pinctrl_ite_it8xxx2.c @@ -422,11 +422,10 @@ static int pinctrl_it8xxx2_init(const struct device *dev) } \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &pinctrl_it8xxx2_init, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &pinctrl_it8xxx2_init, \ NULL, \ NULL, \ &pinctrl_it8xxx2_cfg_##inst, \ PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ NULL); DT_INST_FOREACH_STATUS_OKAY(PINCTRL_ITE_INIT) diff --git a/drivers/pinctrl/pinctrl_nxp_port.c b/drivers/pinctrl/pinctrl_nxp_port.c index 4af6602703f43..32669ee0b0b0b 100644 --- a/drivers/pinctrl/pinctrl_nxp_port.c +++ b/drivers/pinctrl/pinctrl_nxp_port.c @@ -91,12 +91,11 @@ static int pinctrl_mcux_init(const struct device *dev) PINCTRL_MCUX_DT_INST_CLOCK_SUBSYS(n), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &pinctrl_mcux_init, \ NULL, \ NULL, &pinctrl_mcux_##n##_config, \ PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ NULL); DT_INST_FOREACH_STATUS_OKAY(PINCTRL_MCUX_INIT) diff --git a/drivers/pinctrl/pinctrl_rv32m1.c b/drivers/pinctrl/pinctrl_rv32m1.c index 7351cec9496f8..b5b4a59cea847 100644 --- a/drivers/pinctrl/pinctrl_rv32m1.c +++ b/drivers/pinctrl/pinctrl_rv32m1.c @@ -56,12 +56,11 @@ static int pinctrl_rv32m1_init(const struct device *dev) .clock_ip_name = INST_DT_CLOCK_IP_NAME(n), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &pinctrl_rv32m1_init, \ NULL, \ NULL, &pinctrl_rv32m1_##n##_config, \ PRE_KERNEL_1, \ - CONFIG_PINCTRL_RV32M1_INIT_PRIORITY, \ NULL); DT_INST_FOREACH_STATUS_OKAY(PINCTRL_RV32M1_INIT) diff --git a/drivers/pinctrl/pinctrl_ti_k3.c b/drivers/pinctrl/pinctrl_ti_k3.c index e4e4f6289ab9b..1aebe9ad95b4f 100644 --- a/drivers/pinctrl/pinctrl_ti_k3.c +++ b/drivers/pinctrl/pinctrl_ti_k3.c @@ -40,11 +40,10 @@ static int pinctrl_ti_k3_init(const struct device *dev) return 0; } -DEVICE_DT_DEFINE(PINCTRL_NODE, +DEVICE_INSTANCE(PINCTRL_NODE, pinctrl_ti_k3_init, NULL, &pinctrl_ti_k3_dev, &pinctrl_ti_k3_cfg, PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); diff --git a/drivers/pm_cpu_ops/pm_cpu_ops_psci.c b/drivers/pm_cpu_ops/pm_cpu_ops_psci.c index 5b9df7858a67d..9a4c80befdc28 100644 --- a/drivers/pm_cpu_ops/pm_cpu_ops_psci.c +++ b/drivers/pm_cpu_ops/pm_cpu_ops_psci.c @@ -218,13 +218,12 @@ static int psci_init(const struct device *dev) static const struct psci_config_t psci_config_##inst##ver = { \ .method = DT_PROP(DT_DRV_INST(inst), method) \ }; \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &psci_init, \ NULL, \ &psci_data, \ - &psci_config_##inst##ver, \ + &psci_config_##inst##ver, \ PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ NULL); #define PSCI_0_2_INIT(n) PSCI_DEFINE(n, PSCI_0_2) diff --git a/drivers/power_domain/power_domain_gpio.c b/drivers/power_domain/power_domain_gpio.c index c5517d42f1163..83acb51369f39 100644 --- a/drivers/power_domain/power_domain_gpio.c +++ b/drivers/power_domain/power_domain_gpio.c @@ -133,9 +133,8 @@ static int pd_gpio_init(const struct device *dev) }; \ static struct pd_gpio_data pd_gpio_##id##_data; \ PM_DEVICE_DT_INST_DEFINE(id, pd_gpio_pm_action); \ - DEVICE_DT_INST_DEFINE(id, pd_gpio_init, PM_DEVICE_DT_INST_GET(id), \ + DEVICE_INSTANCE_FROM_DT_INST(id, pd_gpio_init, PM_DEVICE_DT_INST_GET(id),\ &pd_gpio_##id##_data, &pd_gpio_##id##_cfg, \ - POST_KERNEL, CONFIG_POWER_DOMAIN_GPIO_INIT_PRIORITY, \ - NULL); + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(POWER_DOMAIN_DEVICE) diff --git a/drivers/power_domain/power_domain_gpio_monitor.c b/drivers/power_domain/power_domain_gpio_monitor.c index a0a5af8aa7fd5..14942eb341a43 100644 --- a/drivers/power_domain/power_domain_gpio_monitor.c +++ b/drivers/power_domain/power_domain_gpio_monitor.c @@ -142,9 +142,9 @@ static int pd_gpio_monitor_init(const struct device *dev) }; \ static struct pd_gpio_monitor_data pd_gpio_monitor_data_##inst; \ PM_DEVICE_DT_INST_DEFINE(inst, pd_gpio_monitor_pm_action); \ - DEVICE_DT_INST_DEFINE(inst, pd_gpio_monitor_init, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, pd_gpio_monitor_init, \ PM_DEVICE_DT_INST_GET(inst), &pd_gpio_monitor_data_##inst, \ &pd_gpio_monitor_config_##inst, POST_KERNEL, \ - CONFIG_POWER_DOMAIN_GPIO_MONITOR_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(POWER_DOMAIN_DEVICE) diff --git a/drivers/power_domain/power_domain_intel_adsp.c b/drivers/power_domain/power_domain_intel_adsp.c index f9d78a142cf50..a180205966bb6 100644 --- a/drivers/power_domain/power_domain_intel_adsp.c +++ b/drivers/power_domain/power_domain_intel_adsp.c @@ -99,8 +99,8 @@ static int pd_intel_adsp_init(const struct device *dev) .CPA_bit = DT_INST_PROP(id, bit_position), \ }; \ PM_DEVICE_DT_INST_DEFINE(id, pd_intel_adsp_pm_action); \ - DEVICE_DT_INST_DEFINE(id, pd_intel_adsp_init, PM_DEVICE_DT_INST_GET(id), \ + DEVICE_INSTANCE_FROM_DT_INST(id, pd_intel_adsp_init, PM_DEVICE_DT_INST_GET(id), \ &pd_pg_reg##id, NULL, POST_KERNEL, \ - CONFIG_POWER_DOMAIN_INTEL_ADSP_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(POWER_DOMAIN_DEVICE) diff --git a/drivers/power_domain/power_domain_nxp_scu.c b/drivers/power_domain/power_domain_nxp_scu.c index 2ed162359fd26..812981a1065ec 100644 --- a/drivers/power_domain/power_domain_nxp_scu.c +++ b/drivers/power_domain/power_domain_nxp_scu.c @@ -80,9 +80,8 @@ static struct scu_pd_data scu_pd_data_##inst = { \ \ PM_DEVICE_DT_INST_DEFINE(inst, scu_pd_pm_action); \ \ -DEVICE_DT_INST_DEFINE(inst, scu_pd_init, PM_DEVICE_DT_INST_GET(inst), \ +DEVICE_INSTANCE_FROM_DT_INST(inst, scu_pd_init, PM_DEVICE_DT_INST_GET(inst),\ &scu_pd_data_##inst, NULL, PRE_KERNEL_1, \ - CONFIG_POWER_DOMAIN_NXP_SCU_INIT_PRIORITY, \ NULL); DT_INST_FOREACH_STATUS_OKAY(SCU_PD_DEVICE_DEFINE); diff --git a/drivers/ps2/ps2_mchp_xec.c b/drivers/ps2/ps2_mchp_xec.c index 0a6677869127b..a49c2a1db7cbf 100644 --- a/drivers/ps2/ps2_mchp_xec.c +++ b/drivers/ps2/ps2_mchp_xec.c @@ -414,10 +414,9 @@ static int ps2_xec_init(const struct device *dev) \ PM_DEVICE_DT_INST_DEFINE(i, ps2_xec_pm_action); \ \ - DEVICE_DT_INST_DEFINE(i, &ps2_xec_init, \ + DEVICE_INSTANCE_FROM_DT_INST(i, &ps2_xec_init, \ PM_DEVICE_DT_INST_GET(i), \ &ps2_xec_port_data_##i, &ps2_xec_config_##i, \ - POST_KERNEL, CONFIG_PS2_INIT_PRIORITY, \ - &ps2_xec_driver_api); + POST_KERNEL, &ps2_xec_driver_api); DT_INST_FOREACH_STATUS_OKAY(PS2_XEC_DEVICE) diff --git a/drivers/ps2/ps2_npcx_channel.c b/drivers/ps2/ps2_npcx_channel.c index b718860139982..a0ca190699baa 100644 --- a/drivers/ps2/ps2_npcx_channel.c +++ b/drivers/ps2/ps2_npcx_channel.c @@ -115,9 +115,8 @@ static const struct ps2_driver_api ps2_channel_npcx_driver_api = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, ps2_npcx_channel_init, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, ps2_npcx_channel_init, NULL, NULL, \ &ps2_npcx_ch_cfg_##inst, POST_KERNEL, \ - CONFIG_PS2_CHANNEL_INIT_PRIORITY, \ &ps2_channel_npcx_driver_api); DT_INST_FOREACH_STATUS_OKAY(NPCX_PS2_CHANNEL_INIT) diff --git a/drivers/ps2/ps2_npcx_controller.c b/drivers/ps2/ps2_npcx_controller.c index e121ff5e3688f..6905040ce5e02 100644 --- a/drivers/ps2/ps2_npcx_controller.c +++ b/drivers/ps2/ps2_npcx_controller.c @@ -322,9 +322,9 @@ static const struct ps2_npcx_ctrl_config ps2_npcx_ctrl_config_0 = { .clk_cfg = NPCX_DT_CLK_CFG_ITEM(0), }; -DEVICE_DT_INST_DEFINE(0, &ps2_npcx_ctrl_init, NULL, &ps2_npcx_ctrl_data_0, +DEVICE_INSTANCE_FROM_DT_INST(0, &ps2_npcx_ctrl_init, NULL, &ps2_npcx_ctrl_data_0, &ps2_npcx_ctrl_config_0, POST_KERNEL, - CONFIG_PS2_INIT_PRIORITY, NULL); + NULL); static int ps2_npcx_ctrl_init(const struct device *dev) { diff --git a/drivers/ptp_clock/ptp_clock_nxp_enet.c b/drivers/ptp_clock/ptp_clock_nxp_enet.c index 96bbdca616e5c..fc7750b30bdb0 100644 --- a/drivers/ptp_clock/ptp_clock_nxp_enet.c +++ b/drivers/ptp_clock/ptp_clock_nxp_enet.c @@ -259,10 +259,9 @@ static const struct ptp_clock_driver_api ptp_clock_nxp_enet_api = { \ static struct ptp_clock_nxp_enet_data ptp_clock_nxp_enet_##n##_data; \ \ - DEVICE_DT_INST_DEFINE(n, &ptp_clock_nxp_enet_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &ptp_clock_nxp_enet_init, NULL, \ &ptp_clock_nxp_enet_##n##_data, \ &ptp_clock_nxp_enet_##n##_config, \ - POST_KERNEL, CONFIG_PTP_CLOCK_INIT_PRIORITY, \ - &ptp_clock_nxp_enet_api); + POST_KERNEL, &ptp_clock_nxp_enet_api); DT_INST_FOREACH_STATUS_OKAY(PTP_CLOCK_NXP_ENET_INIT) diff --git a/drivers/pwm/pwm_b91.c b/drivers/pwm/pwm_b91.c index c74587db03275..7a0018b999140 100644 --- a/drivers/pwm/pwm_b91.c +++ b/drivers/pwm/pwm_b91.c @@ -132,9 +132,8 @@ static const struct pwm_driver_api pwm_b91_driver_api = { (DT_INST_PROP(n, clk32k_ch5_enable) << 5U)), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, pwm_b91_init, \ - NULL, NULL, &config##n, \ - POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ - &pwm_b91_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, pwm_b91_init, \ + NULL, NULL, &config##n, \ + POST_KERNEL, &pwm_b91_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_B91_INIT) diff --git a/drivers/pwm/pwm_cc13xx_cc26xx_timer.c b/drivers/pwm/pwm_cc13xx_cc26xx_timer.c index 947457b63c753..be774ad1a1926 100644 --- a/drivers/pwm/pwm_cc13xx_cc26xx_timer.c +++ b/drivers/pwm/pwm_cc13xx_cc26xx_timer.c @@ -241,8 +241,8 @@ static int init_pwm(const struct device *dev) \ static struct pwm_cc13xx_cc26xx_data pwm_cc13xx_cc26xx_##idx##_data; \ \ - DEVICE_DT_INST_DEFINE(idx, init_pwm, NULL, &pwm_cc13xx_cc26xx_##idx##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, init_pwm, NULL, &pwm_cc13xx_cc26xx_##idx##_data, \ &pwm_cc13xx_cc26xx_##idx##_config, POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, &pwm_driver_api) + &pwm_driver_api) DT_INST_FOREACH_STATUS_OKAY(PWM_DEVICE_INIT); diff --git a/drivers/pwm/pwm_ene_kb1200.c b/drivers/pwm/pwm_ene_kb1200.c index a54afa878b08e..50a712ee1de0f 100644 --- a/drivers/pwm/pwm_ene_kb1200.c +++ b/drivers/pwm/pwm_ene_kb1200.c @@ -116,8 +116,7 @@ static int pwm_kb1200_init(const struct device *dev) .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ }; \ static struct pwm_kb1200_data pwm_kb1200_data_##inst; \ - DEVICE_DT_INST_DEFINE(inst, &pwm_kb1200_init, NULL, &pwm_kb1200_data_##inst, \ - &pwm_kb1200_cfg_##inst, PRE_KERNEL_1, CONFIG_PWM_INIT_PRIORITY, \ - &pwm_kb1200_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, &pwm_kb1200_init, NULL, &pwm_kb1200_data_##inst, \ + &pwm_kb1200_cfg_##inst, PRE_KERNEL_1, &pwm_kb1200_driver_api); DT_INST_FOREACH_STATUS_OKAY(KB1200_PWM_INIT) diff --git a/drivers/pwm/pwm_gd32.c b/drivers/pwm/pwm_gd32.c index 81c912514a157..3c7ff21b6d8ef 100644 --- a/drivers/pwm/pwm_gd32.c +++ b/drivers/pwm/pwm_gd32.c @@ -202,9 +202,8 @@ static int pwm_gd32_init(const struct device *dev) .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(i), \ }; \ \ - DEVICE_DT_INST_DEFINE(i, &pwm_gd32_init, NULL, &pwm_gd32_data_##i, \ - &pwm_gd32_config_##i, POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(i, &pwm_gd32_init, NULL, &pwm_gd32_data_##i,\ + &pwm_gd32_config_##i, POST_KERNEL, \ &pwm_gd32_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_GD32_DEFINE) diff --git a/drivers/pwm/pwm_gecko.c b/drivers/pwm/pwm_gecko.c index 55c21a8681b88..6da3e97a5ab86 100644 --- a/drivers/pwm/pwm_gecko.c +++ b/drivers/pwm/pwm_gecko.c @@ -110,9 +110,8 @@ static int pwm_gecko_init(const struct device *dev) .pin = DT_INST_PROP_BY_IDX(index, pin_location, 2), \ }; \ \ - DEVICE_DT_INST_DEFINE(index, &pwm_gecko_init, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(index, &pwm_gecko_init, NULL, NULL, \ &pwm_gecko_config_##index, POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, \ &pwm_gecko_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_GECKO_INIT) diff --git a/drivers/pwm/pwm_ifx_cat1.c b/drivers/pwm/pwm_ifx_cat1.c index c6aa8ae57b0e9..bc6f81c500d6b 100644 --- a/drivers/pwm/pwm_ifx_cat1.c +++ b/drivers/pwm/pwm_ifx_cat1.c @@ -170,8 +170,7 @@ static const struct pwm_driver_api ifx_cat1_pwm_api = { .divider_val = DT_INST_PROP(n, divider_val), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, ifx_cat1_pwm_init, NULL, &pwm_cat1_data_##n, \ - &pwm_cat1_config_##n, POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ - &ifx_cat1_pwm_api); + DEVICE_INSTANCE_FROM_DT_INST(n, ifx_cat1_pwm_init, NULL, &pwm_cat1_data_##n, \ + &pwm_cat1_config_##n, POST_KERNEL, &ifx_cat1_pwm_api); DT_INST_FOREACH_STATUS_OKAY(INFINEON_CAT1_PWM_INIT) diff --git a/drivers/pwm/pwm_imx.c b/drivers/pwm/pwm_imx.c index 28886a0b052a0..9c50a1c656f14 100644 --- a/drivers/pwm/pwm_imx.c +++ b/drivers/pwm/pwm_imx.c @@ -167,10 +167,9 @@ static const struct pwm_driver_api imx_pwm_driver_api = { \ static struct imx_pwm_data imx_pwm_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, &imx_pwm_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &imx_pwm_init, NULL, \ &imx_pwm_data_##n, \ &imx_pwm_config_##n, POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, \ &imx_pwm_driver_api); #if DT_HAS_COMPAT_STATUS_OKAY(fsl_imx27_pwm) diff --git a/drivers/pwm/pwm_intel_blinky.c b/drivers/pwm/pwm_intel_blinky.c index cf6df303a7411..e72331c956f64 100644 --- a/drivers/pwm/pwm_intel_blinky.c +++ b/drivers/pwm/pwm_intel_blinky.c @@ -121,9 +121,8 @@ static int bk_intel_init(const struct device *dev) }; \ \ static struct bk_intel_runtime bk_rt_##n; \ - DEVICE_DT_INST_DEFINE(n, &bk_intel_init, NULL, \ - &bk_rt_##n, &bk_cfg_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &api_funcs); \ + DEVICE_INSTANCE_FROM_DT_INST(n, &bk_intel_init, NULL, \ + &bk_rt_##n, &bk_cfg_##n, \ + POST_KERNEL, &api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(BK_INTEL_DEV_CFG) diff --git a/drivers/pwm/pwm_ite_it8xxx2.c b/drivers/pwm/pwm_ite_it8xxx2.c index 1e5e47f33507f..16685d819f9bf 100644 --- a/drivers/pwm/pwm_ite_it8xxx2.c +++ b/drivers/pwm/pwm_ite_it8xxx2.c @@ -297,13 +297,12 @@ static const struct pwm_driver_api pwm_it8xxx2_api = { \ static struct pwm_it8xxx2_data pwm_it8xxx2_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &pwm_it8xxx2_init, \ NULL, \ &pwm_it8xxx2_data_##inst, \ &pwm_it8xxx2_cfg_##inst, \ PRE_KERNEL_1, \ - CONFIG_PWM_INIT_PRIORITY, \ &pwm_it8xxx2_api); DT_INST_FOREACH_STATUS_OKAY(PWM_IT8XXX2_INIT) diff --git a/drivers/pwm/pwm_led_esp32.c b/drivers/pwm/pwm_led_esp32.c index ab787bb52ef2f..547a26381d544 100644 --- a/drivers/pwm/pwm_led_esp32.c +++ b/drivers/pwm/pwm_led_esp32.c @@ -391,9 +391,8 @@ static struct pwm_ledc_esp32_data pwm_ledc_esp32_data = { .cmd_sem = Z_SEM_INITIALIZER(pwm_ledc_esp32_data.cmd_sem, 1, 1), }; -DEVICE_DT_INST_DEFINE(0, &pwm_led_esp32_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &pwm_led_esp32_init, NULL, &pwm_ledc_esp32_data, &pwm_ledc_esp32_config, POST_KERNEL, - CONFIG_PWM_INIT_PRIORITY, &pwm_led_esp32_api); diff --git a/drivers/pwm/pwm_litex.c b/drivers/pwm/pwm_litex.c index 9f38a1792c6fa..8dde08c258e73 100644 --- a/drivers/pwm/pwm_litex.c +++ b/drivers/pwm/pwm_litex.c @@ -75,13 +75,12 @@ static const struct pwm_driver_api pwm_litex_driver_api = { .reg_period = DT_INST_REG_ADDR_BY_NAME(n, period), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ pwm_litex_init, \ NULL, \ NULL, \ &pwm_litex_cfg_##n, \ POST_KERNEL, \ - CONFIG_PWM_LITEX_INIT_PRIORITY, \ &pwm_litex_driver_api \ ); diff --git a/drivers/pwm/pwm_max31790.c b/drivers/pwm/pwm_max31790.c index a655c8b10b734..fa48012af496c 100644 --- a/drivers/pwm/pwm_max31790.c +++ b/drivers/pwm/pwm_max31790.c @@ -348,8 +348,8 @@ static int max31790_pwm_init(const struct device *dev) \ static struct max31790_pwm_data max31790_pwm_##inst##_data; \ \ - DEVICE_DT_INST_DEFINE(inst, max31790_pwm_init, NULL, &max31790_pwm_##inst##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, max31790_pwm_init, NULL, &max31790_pwm_##inst##_data, \ &max31790_pwm_##inst##_config, POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, &max31790_pwm_api); + &max31790_pwm_api); DT_INST_FOREACH_STATUS_OKAY(MAX31790_PWM_INIT); diff --git a/drivers/pwm/pwm_max32.c b/drivers/pwm/pwm_max32.c index 5228b4a89de61..33025e9b4482a 100644 --- a/drivers/pwm/pwm_max32.c +++ b/drivers/pwm/pwm_max32.c @@ -135,8 +135,7 @@ static int pwm_max32_init(const struct device *dev) .perclk.clk_src = DT_PROP(DT_INST_PARENT(_num), clock_source), \ .prescaler = DT_PROP(DT_INST_PARENT(_num), prescaler), \ }; \ - DEVICE_DT_INST_DEFINE(_num, &pwm_max32_init, NULL, &max32_pwm_data_##_num, \ - &max32_pwm_config_##_num, POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ - &pwm_max32_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(_num, &pwm_max32_init, NULL, &max32_pwm_data_##_num, \ + &max32_pwm_config_##_num, POST_KERNEL, &pwm_max32_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_MAX32_DEFINE) diff --git a/drivers/pwm/pwm_mc_esp32.c b/drivers/pwm/pwm_mc_esp32.c index d0c470528a0c2..bf235c3b22c03 100644 --- a/drivers/pwm/pwm_mc_esp32.c +++ b/drivers/pwm/pwm_mc_esp32.c @@ -575,8 +575,7 @@ static const struct pwm_driver_api mcpwm_esp32_api = { .prescale_timer2 = DT_INST_PROP_OR(idx, prescale_timer2, 0), \ CAPTURE_INIT(idx)}; \ \ - DEVICE_DT_INST_DEFINE(idx, &mcpwm_esp32_init, NULL, &mcpwm_esp32_data_##idx, \ - &mcpwm_esp32_config_##idx, POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ - &mcpwm_esp32_api); + DEVICE_INSTANCE_FROM_DT_INST(idx, &mcpwm_esp32_init, NULL, &mcpwm_esp32_data_##idx, \ + &mcpwm_esp32_config_##idx, POST_KERNEL, &mcpwm_esp32_api); DT_INST_FOREACH_STATUS_OKAY(ESP32_MCPWM_INIT) diff --git a/drivers/pwm/pwm_mchp_xec.c b/drivers/pwm/pwm_mchp_xec.c index bd326680d3dbd..378408f13c017 100644 --- a/drivers/pwm/pwm_mchp_xec.c +++ b/drivers/pwm/pwm_mchp_xec.c @@ -454,11 +454,10 @@ static int pwm_xec_init(const struct device *dev) \ PM_DEVICE_DT_INST_DEFINE(index, pwm_xec_pm_action); \ \ - DEVICE_DT_INST_DEFINE(index, &pwm_xec_init, \ + DEVICE_INSTANCE_FROM_DT_INST(index, &pwm_xec_init, \ PM_DEVICE_DT_INST_GET(index), \ &pwm_xec_data_##index, \ &pwm_xec_config_##index, POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, \ &pwm_xec_driver_api); DT_INST_FOREACH_STATUS_OKAY(XEC_PWM_DEVICE_INIT) diff --git a/drivers/pwm/pwm_mchp_xec_bbled.c b/drivers/pwm/pwm_mchp_xec_bbled.c index 52177ee3ee2e6..7f60aeadc636b 100644 --- a/drivers/pwm/pwm_mchp_xec_bbled.c +++ b/drivers/pwm/pwm_mchp_xec_bbled.c @@ -373,11 +373,10 @@ static int pwm_bbled_xec_init(const struct device *dev) \ PM_DEVICE_DT_INST_DEFINE(index, pwm_bbled_xec_pm_action); \ \ - DEVICE_DT_INST_DEFINE(index, &pwm_bbled_xec_init, \ + DEVICE_INSTANCE_FROM_DT_INST(index, &pwm_bbled_xec_init, \ PM_DEVICE_DT_INST_GET(index), \ &bbled_xec_data_##index, \ - &pwm_bbled_xec_config_##index, POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, \ + &pwm_bbled_xec_config_##index, POST_KERNEL,\ &pwm_bbled_xec_driver_api); DT_INST_FOREACH_STATUS_OKAY(XEC_PWM_BBLED_DEVICE_INIT) diff --git a/drivers/pwm/pwm_mcux.c b/drivers/pwm/pwm_mcux.c index 617ac3e4b7f7c..bc607ded75db9 100644 --- a/drivers/pwm/pwm_mcux.c +++ b/drivers/pwm/pwm_mcux.c @@ -261,12 +261,11 @@ static const struct pwm_driver_api pwm_mcux_driver_api = { .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ pwm_mcux_init, \ NULL, \ &pwm_mcux_data_ ## n, \ &pwm_mcux_config_ ## n, \ - POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ - &pwm_mcux_driver_api); + POST_KERNEL, &pwm_mcux_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_DEVICE_INIT_MCUX) diff --git a/drivers/pwm/pwm_mcux_ctimer.c b/drivers/pwm/pwm_mcux_ctimer.c index 63d9459747c56..0f82cafc97d2f 100644 --- a/drivers/pwm/pwm_mcux_ctimer.c +++ b/drivers/pwm/pwm_mcux_ctimer.c @@ -269,8 +269,8 @@ static const struct pwm_driver_api pwm_mcux_ctimer_driver_api = { .clock_id = (clock_control_subsys_t)(DT_INST_CLOCKS_CELL(n, name)), \ PWM_MCUX_CTIMER_PINCTRL_INIT(n)}; \ \ - DEVICE_DT_INST_DEFINE(n, mcux_ctimer_pwm_init, NULL, &pwm_mcux_ctimer_data_##n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, mcux_ctimer_pwm_init, NULL, &pwm_mcux_ctimer_data_##n, \ &pwm_mcux_ctimer_config_##n, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &pwm_mcux_ctimer_driver_api); + &pwm_mcux_ctimer_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_MCUX_CTIMER_DEVICE_INIT_MCUX) diff --git a/drivers/pwm/pwm_mcux_ftm.c b/drivers/pwm/pwm_mcux_ftm.c index 4774fad4f8094..1155d1e199ec5 100644 --- a/drivers/pwm/pwm_mcux_ftm.c +++ b/drivers/pwm/pwm_mcux_ftm.c @@ -591,11 +591,10 @@ static const struct mcux_ftm_config mcux_ftm_config_##n = { \ PINCTRL_DT_INST_DEFINE(n); \ static struct mcux_ftm_data mcux_ftm_data_##n; \ static const struct mcux_ftm_config mcux_ftm_config_##n; \ - DEVICE_DT_INST_DEFINE(n, &mcux_ftm_init, \ - NULL, &mcux_ftm_data_##n, \ - &mcux_ftm_config_##n, \ - POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ - &mcux_ftm_driver_api); \ + DEVICE_INSTANCE_FROM_DT_INST(n, &mcux_ftm_init, \ + NULL, &mcux_ftm_data_##n, \ + &mcux_ftm_config_##n, \ + POST_KERNEL, &mcux_ftm_driver_api); \ FTM_CONFIG_FUNC(n) \ FTM_INIT_CFG(n); diff --git a/drivers/pwm/pwm_mcux_pwt.c b/drivers/pwm/pwm_mcux_pwt.c index 0413e256b1289..79ae1aabd13a5 100644 --- a/drivers/pwm/pwm_mcux_pwt.c +++ b/drivers/pwm/pwm_mcux_pwt.c @@ -354,11 +354,10 @@ static const struct pwm_driver_api mcux_pwt_driver_api = { \ static struct mcux_pwt_data mcux_pwt_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, &mcux_pwt_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &mcux_pwt_init, \ NULL, &mcux_pwt_data_##n, \ &mcux_pwt_config_##n, \ POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, \ &mcux_pwt_driver_api); \ \ static void mcux_pwt_config_func_##n(const struct device *dev) \ diff --git a/drivers/pwm/pwm_mcux_qtmr.c b/drivers/pwm/pwm_mcux_qtmr.c index b78f43b0436b1..ad8b890cbaae6 100644 --- a/drivers/pwm/pwm_mcux_qtmr.c +++ b/drivers/pwm/pwm_mcux_qtmr.c @@ -166,8 +166,7 @@ static const struct pwm_driver_api pwm_mcux_qtmr_driver_api = { .clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, mcux_qtmr_pwm_init, NULL, &pwm_mcux_qtmr_data_##n, \ - &pwm_mcux_qtmr_config_##n, POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ - &pwm_mcux_qtmr_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, mcux_qtmr_pwm_init, NULL, &pwm_mcux_qtmr_data_##n, \ + &pwm_mcux_qtmr_config_##n, POST_KERNEL, &pwm_mcux_qtmr_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_MCUX_QTMR_DEVICE_INIT) diff --git a/drivers/pwm/pwm_mcux_sctimer.c b/drivers/pwm/pwm_mcux_sctimer.c index fcd3272cfdc6a..2bf984dee542f 100644 --- a/drivers/pwm/pwm_mcux_sctimer.c +++ b/drivers/pwm/pwm_mcux_sctimer.c @@ -260,12 +260,11 @@ static const struct pwm_driver_api pwm_mcux_sctimer_driver_api = { .clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name),\ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ mcux_sctimer_pwm_init, \ NULL, \ &pwm_mcux_sctimer_data_##n, \ &pwm_mcux_sctimer_config_##n, \ - POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ - &pwm_mcux_sctimer_driver_api); + POST_KERNEL, &pwm_mcux_sctimer_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_MCUX_SCTIMER_DEVICE_INIT_MCUX) diff --git a/drivers/pwm/pwm_mcux_tpm.c b/drivers/pwm/pwm_mcux_tpm.c index d90686ef675fc..66d1a31259168 100644 --- a/drivers/pwm/pwm_mcux_tpm.c +++ b/drivers/pwm/pwm_mcux_tpm.c @@ -211,10 +211,9 @@ static const struct pwm_driver_api mcux_tpm_driver_api = { .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ }; \ static struct mcux_tpm_data mcux_tpm_data_##n; \ - DEVICE_DT_INST_DEFINE(n, &mcux_tpm_init, NULL, \ - &mcux_tpm_data_##n, \ - &mcux_tpm_config_##n, \ - POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ - &mcux_tpm_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &mcux_tpm_init, NULL,\ + &mcux_tpm_data_##n, \ + &mcux_tpm_config_##n, \ + POST_KERNEL, &mcux_tpm_driver_api); DT_INST_FOREACH_STATUS_OKAY(TPM_DEVICE) diff --git a/drivers/pwm/pwm_npcx.c b/drivers/pwm/pwm_npcx.c index f4bdb039c6993..08a64d36978d4 100644 --- a/drivers/pwm/pwm_npcx.c +++ b/drivers/pwm/pwm_npcx.c @@ -228,10 +228,9 @@ static int pwm_npcx_init(const struct device *dev) \ static struct pwm_npcx_data pwm_npcx_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, \ - &pwm_npcx_init, NULL, \ - &pwm_npcx_data_##inst, &pwm_npcx_cfg_##inst, \ - PRE_KERNEL_1, CONFIG_PWM_INIT_PRIORITY, \ - &pwm_npcx_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, \ + &pwm_npcx_init, NULL, \ + &pwm_npcx_data_##inst, &pwm_npcx_cfg_##inst, \ + PRE_KERNEL_1, &pwm_npcx_driver_api); DT_INST_FOREACH_STATUS_OKAY(NPCX_PWM_INIT) diff --git a/drivers/pwm/pwm_nrf_sw.c b/drivers/pwm/pwm_nrf_sw.c index 2b9a22a38f081..e3d062e3db4ce 100644 --- a/drivers/pwm/pwm_nrf_sw.c +++ b/drivers/pwm/pwm_nrf_sw.c @@ -425,11 +425,10 @@ static const struct pwm_config pwm_nrf_sw_0_config = { static struct pwm_data pwm_nrf_sw_0_data; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, pwm_nrf_sw_init, NULL, &pwm_nrf_sw_0_data, &pwm_nrf_sw_0_config, POST_KERNEL, - CONFIG_PWM_INIT_PRIORITY, &pwm_nrf_sw_drv_api_funcs); diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index 420a9078c59ea..b0c792729a462 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -370,12 +370,11 @@ static int pwm_nrfx_init(const struct device *dev) return pwm_nrfx_init(dev); \ }; \ PM_DEVICE_DT_DEFINE(PWM(idx), pwm_nrfx_pm_action); \ - DEVICE_DT_DEFINE(PWM(idx), \ - pwm_nrfx_init##idx, PM_DEVICE_DT_GET(PWM(idx)), \ - &pwm_nrfx_##idx##_data, \ - &pwm_nrfx_##idx##_config, \ - POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ - &pwm_nrfx_drv_api_funcs) + DEVICE_INSTANCE(PWM(idx), \ + pwm_nrfx_init##idx, PM_DEVICE_DT_GET(PWM(idx)), \ + &pwm_nrfx_##idx##_data, \ + &pwm_nrfx_##idx##_config, \ + POST_KERNEL, &pwm_nrfx_drv_api_funcs) #define COND_PWM_NRFX_DEVICE(unused, prefix, i, _) \ IF_ENABLED(CONFIG_HAS_HW_NRF_PWM##prefix##i, (PWM_NRFX_DEVICE(prefix##i);)) diff --git a/drivers/pwm/pwm_numaker.c b/drivers/pwm/pwm_numaker.c index e67c7a0e05bf5..f593323aef524 100644 --- a/drivers/pwm/pwm_numaker.c +++ b/drivers/pwm/pwm_numaker.c @@ -571,8 +571,8 @@ static int pwm_numaker_init(const struct device *dev) \ static struct pwm_numaker_data pwm_numaker_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, &pwm_numaker_init, NULL, &pwm_numaker_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &pwm_numaker_init, NULL, &pwm_numaker_data_##inst, \ &pwm_numaker_cfg_##inst, PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &pwm_numaker_driver_api); + &pwm_numaker_driver_api); DT_INST_FOREACH_STATUS_OKAY(NUMAKER_PWM_INIT) diff --git a/drivers/pwm/pwm_nxp_flexio.c b/drivers/pwm/pwm_nxp_flexio.c index 4dbafd8250f9e..53bd0b71a87d9 100644 --- a/drivers/pwm/pwm_nxp_flexio.c +++ b/drivers/pwm/pwm_nxp_flexio.c @@ -328,12 +328,11 @@ static const struct pwm_driver_api pwm_nxp_flexio_driver_api = { }; \ \ static struct pwm_nxp_flexio_data pwm_nxp_flexio_data_##n; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &mcux_flexio_pwm_init, \ NULL, \ &pwm_nxp_flexio_data_##n, \ &pwm_nxp_flexio_config_##n, \ - POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ - &pwm_nxp_flexio_driver_api); + POST_KERNEL, &pwm_nxp_flexio_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_NXP_FLEXIO_PWM_INIT) diff --git a/drivers/pwm/pwm_nxp_s32_emios.c b/drivers/pwm/pwm_nxp_s32_emios.c index e5a0513fb2ffa..8875f30b4ad98 100644 --- a/drivers/pwm/pwm_nxp_s32_emios.c +++ b/drivers/pwm/pwm_nxp_s32_emios.c @@ -843,13 +843,12 @@ static const struct pwm_driver_api pwm_nxp_s32_driver_api = { EMIOS_PWM_PULSE_CAPTURE_GET_CONFIG(n) \ }; \ static struct pwm_nxp_s32_data pwm_nxp_s32_data_##n; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &pwm_nxp_s32_init, \ NULL, \ &pwm_nxp_s32_data_##n, \ &pwm_nxp_s32_config_##n, \ POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, \ &pwm_nxp_s32_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_NXP_S32_INIT_DEVICE) diff --git a/drivers/pwm/pwm_pca9685.c b/drivers/pwm/pwm_pca9685.c index f08bdd4cf9b04..e67ce47883aa8 100644 --- a/drivers/pwm/pwm_pca9685.c +++ b/drivers/pwm/pwm_pca9685.c @@ -280,10 +280,9 @@ static int pca9685_init(const struct device *dev) \ static struct pca9685_data pca9685_##inst##_data; \ \ - DEVICE_DT_INST_DEFINE(inst, pca9685_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, pca9685_init, NULL, \ &pca9685_##inst##_data, \ &pca9685_##inst##_config, POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, \ &pca9685_api); DT_INST_FOREACH_STATUS_OKAY(PCA9685_INIT); diff --git a/drivers/pwm/pwm_rcar.c b/drivers/pwm/pwm_rcar.c index 051d02503ccd0..1ed250770660f 100644 --- a/drivers/pwm/pwm_rcar.c +++ b/drivers/pwm/pwm_rcar.c @@ -261,8 +261,7 @@ static const struct pwm_driver_api pwm_rcar_driver_api = { .core_clk.domain = DT_INST_CLOCKS_CELL_BY_IDX(n, 1, domain), \ }; \ static struct pwm_rcar_data pwm_rcar_data_##n; \ - DEVICE_DT_INST_DEFINE(n, pwm_rcar_init, NULL, &pwm_rcar_data_##n, &pwm_rcar_cfg_##n, \ - POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ - &pwm_rcar_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, pwm_rcar_init, NULL, &pwm_rcar_data_##n, &pwm_rcar_cfg_##n,\ + POST_KERNEL, &pwm_rcar_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_DEVICE_RCAR_INIT) diff --git a/drivers/pwm/pwm_renesas_ra8.c b/drivers/pwm/pwm_renesas_ra8.c index cb41ae82a1eae..afa9ba945d980 100644 --- a/drivers/pwm/pwm_renesas_ra8.c +++ b/drivers/pwm/pwm_renesas_ra8.c @@ -563,8 +563,7 @@ static int pwm_ra8_init(const struct device *dev) } \ return 0; \ } \ - DEVICE_DT_INST_DEFINE(index, pwm_ra8_init_##index, NULL, &pwm_ra8_data_##index, \ - &pwm_ra8_config_##index, POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ - &pwm_ra8_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(index, pwm_ra8_init_##index, NULL, &pwm_ra8_data_##index, \ + &pwm_ra8_config_##index, POST_KERNEL, &pwm_ra8_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_RA8_INIT); diff --git a/drivers/pwm/pwm_rpi_pico.c b/drivers/pwm/pwm_rpi_pico.c index a6b9489b4e45f..7c5e6e847647b 100644 --- a/drivers/pwm/pwm_rpi_pico.c +++ b/drivers/pwm/pwm_rpi_pico.c @@ -220,7 +220,7 @@ static int pwm_rpi_init(const struct device *dev) .clk_id = (clock_control_subsys_t)DT_INST_PHA_BY_IDX(idx, clocks, 0, clk_id), \ }; \ \ - DEVICE_DT_INST_DEFINE(idx, pwm_rpi_init, NULL, NULL, &pwm_rpi_config_##idx, POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, &pwm_rpi_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(idx, pwm_rpi_init, NULL, NULL, &pwm_rpi_config_##idx, POST_KERNEL,\ + &pwm_rpi_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_RPI_INIT); diff --git a/drivers/pwm/pwm_rv32m1_tpm.c b/drivers/pwm/pwm_rv32m1_tpm.c index 3d2f5a5465335..0b928fbdb7459 100644 --- a/drivers/pwm/pwm_rv32m1_tpm.c +++ b/drivers/pwm/pwm_rv32m1_tpm.c @@ -199,10 +199,9 @@ static const struct pwm_driver_api rv32m1_tpm_driver_api = { .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ }; \ static struct rv32m1_tpm_data rv32m1_tpm_data_##n; \ - DEVICE_DT_INST_DEFINE(n, &rv32m1_tpm_init, NULL, \ - &rv32m1_tpm_data_##n, \ - &rv32m1_tpm_config_##n, \ - POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ - &rv32m1_tpm_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &rv32m1_tpm_init, NULL,\ + &rv32m1_tpm_data_##n, \ + &rv32m1_tpm_config_##n, \ + POST_KERNEL, &rv32m1_tpm_driver_api); DT_INST_FOREACH_STATUS_OKAY(TPM_DEVICE) diff --git a/drivers/pwm/pwm_sam.c b/drivers/pwm/pwm_sam.c index 672b2cdb8d05b..8c806e8924687 100644 --- a/drivers/pwm/pwm_sam.c +++ b/drivers/pwm/pwm_sam.c @@ -133,11 +133,10 @@ static const struct pwm_driver_api sam_pwm_driver_api = { .divider = DT_INST_PROP(inst, divider), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &sam_pwm_init, NULL, \ NULL, &sam_pwm_config_##inst, \ POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, \ &sam_pwm_driver_api); DT_INST_FOREACH_STATUS_OKAY(SAM_INST_INIT) diff --git a/drivers/pwm/pwm_sam0_tcc.c b/drivers/pwm/pwm_sam0_tcc.c index 3a12c81b76c9a..35457bddef9cb 100644 --- a/drivers/pwm/pwm_sam0_tcc.c +++ b/drivers/pwm/pwm_sam0_tcc.c @@ -165,9 +165,8 @@ static const struct pwm_driver_api pwm_sam0_driver_api = { PWM_SAM0_INIT_CLOCKS(inst), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &pwm_sam0_init, NULL, \ - NULL, &pwm_sam0_config_##inst, \ - POST_KERNEL, CONFIG_PWM_INIT_PRIORITY, \ - &pwm_sam0_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, &pwm_sam0_init, NULL, \ + NULL, &pwm_sam0_config_##inst, \ + POST_KERNEL, &pwm_sam0_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_SAM0_INIT) diff --git a/drivers/pwm/pwm_sifive.c b/drivers/pwm/pwm_sifive.c index b11f10b2d0bd8..19bb8441bf3da 100644 --- a/drivers/pwm/pwm_sifive.c +++ b/drivers/pwm/pwm_sifive.c @@ -222,13 +222,12 @@ static const struct pwm_driver_api pwm_sifive_api = { .cmpwidth = DT_INST_PROP(n, sifive_compare_width), \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ }; \ - DEVICE_DT_INST_DEFINE(n, \ - pwm_sifive_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ + pwm_sifive_init,\ NULL, \ - &pwm_sifive_data_##n, \ - &pwm_sifive_cfg_##n, \ - POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, \ + &pwm_sifive_data_##n,\ + &pwm_sifive_cfg_##n,\ + POST_KERNEL,\ &pwm_sifive_api); DT_INST_FOREACH_STATUS_OKAY(PWM_SIFIVE_INIT) diff --git a/drivers/pwm/pwm_stm32.c b/drivers/pwm/pwm_stm32.c index d120ec33b5b1f..38ceef3a43bce 100644 --- a/drivers/pwm/pwm_stm32.c +++ b/drivers/pwm/pwm_stm32.c @@ -899,10 +899,9 @@ static void pwm_stm32_irq_config_func_##index(const struct device *dev) \ CAPTURE_INIT(index) \ }; \ \ - DEVICE_DT_INST_DEFINE(index, &pwm_stm32_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(index, &pwm_stm32_init, NULL, \ &pwm_stm32_data_##index, \ &pwm_stm32_config_##index, POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, \ &pwm_stm32_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_DEVICE_INIT) diff --git a/drivers/pwm/pwm_test.c b/drivers/pwm/pwm_test.c index 4961e90f3fe22..3252f8d1e9296 100644 --- a/drivers/pwm/pwm_test.c +++ b/drivers/pwm/pwm_test.c @@ -59,7 +59,7 @@ static const struct pwm_driver_api vnd_pwm_api = { }; #define VND_PWM_INIT(n) \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, &vnd_pwm_api); + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, NULL, NULL, POST_KERNEL, \ + &vnd_pwm_api); DT_INST_FOREACH_STATUS_OKAY(VND_PWM_INIT) diff --git a/drivers/pwm/pwm_xlnx_axi_timer.c b/drivers/pwm/pwm_xlnx_axi_timer.c index 6e5c594a0af94..0867d82cd01ea 100644 --- a/drivers/pwm/pwm_xlnx_axi_timer.c +++ b/drivers/pwm/pwm_xlnx_axi_timer.c @@ -195,10 +195,9 @@ static const struct pwm_driver_api xlnx_axi_timer_driver_api = { GENMASK(DT_INST_PROP(n, xlnx_count_width) - 1, 0), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, NULL, \ &xlnx_axi_timer_config_##n, \ POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, \ &xlnx_axi_timer_driver_api) DT_INST_FOREACH_STATUS_OKAY(XLNX_AXI_TIMER_INIT); diff --git a/drivers/pwm/pwm_xmc4xxx_ccu4.c b/drivers/pwm/pwm_xmc4xxx_ccu4.c index 9800003df3962..ca3ba93d4429d 100644 --- a/drivers/pwm/pwm_xmc4xxx_ccu4.c +++ b/drivers/pwm/pwm_xmc4xxx_ccu4.c @@ -106,7 +106,7 @@ static const struct pwm_xmc4xxx_ccu4_config config##n = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ .slice_prescaler = DT_INST_PROP(n, slice_prescaler)}; \ \ -DEVICE_DT_INST_DEFINE(n, pwm_xmc4xxx_ccu4_init, NULL, NULL, &config##n, POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, &pwm_xmc4xxx_ccu4_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(n, pwm_xmc4xxx_ccu4_init, NULL, NULL, &config##n, POST_KERNEL,\ + &pwm_xmc4xxx_ccu4_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_XMC4XXX_CCU4_INIT) diff --git a/drivers/pwm/pwm_xmc4xxx_ccu8.c b/drivers/pwm/pwm_xmc4xxx_ccu8.c index e6d68cb115b43..6eb40621c341f 100644 --- a/drivers/pwm/pwm_xmc4xxx_ccu8.c +++ b/drivers/pwm/pwm_xmc4xxx_ccu8.c @@ -165,7 +165,7 @@ static const struct pwm_xmc4xxx_ccu8_config config##n = { .deadtime_low_ns = DT_INST_PROP(n, channel_deadtime_low), \ }; \ \ -DEVICE_DT_INST_DEFINE(n, pwm_xmc4xxx_ccu8_init, NULL, NULL, &config##n, POST_KERNEL, \ - CONFIG_PWM_INIT_PRIORITY, &pwm_xmc4xxx_ccu8_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(n, pwm_xmc4xxx_ccu8_init, NULL, NULL, &config##n, POST_KERNEL,\ + &pwm_xmc4xxx_ccu8_driver_api); DT_INST_FOREACH_STATUS_OKAY(PWM_XMC4XXX_CCU8_INIT) diff --git a/drivers/regulator/regulator_adp5360.c b/drivers/regulator/regulator_adp5360.c index c417b6e598584..36c611d95d5bc 100644 --- a/drivers/regulator/regulator_adp5360.c +++ b/drivers/regulator/regulator_adp5360.c @@ -293,8 +293,8 @@ static const struct regulator_driver_api api = { .dis_en = DT_PROP(node_id, adi_enable_output_discharge), \ }; \ \ - DEVICE_DT_DEFINE(node_id, regulator_adp5360_init, NULL, &data_##id, &config_##id, \ - POST_KERNEL, CONFIG_REGULATOR_ADP5360_INIT_PRIORITY, &api); + DEVICE_INSTANCE(node_id, regulator_adp5360_init, NULL, &data_##id, &config_##id, \ + POST_KERNEL, &api); #define REGULATOR_ADP5360_DEFINE_COND(inst, child) \ COND_CODE_1(DT_NODE_EXISTS(DT_INST_CHILD(inst, child)), \ diff --git a/drivers/regulator/regulator_axp192.c b/drivers/regulator/regulator_axp192.c index 47ac2c11ecca8..a54d6c714ac92 100644 --- a/drivers/regulator/regulator_axp192.c +++ b/drivers/regulator/regulator_axp192.c @@ -375,8 +375,8 @@ static int regulator_axp192_init(const struct device *dev) .mfd = DEVICE_DT_GET(DT_GPARENT(node_id)), \ .i2c = I2C_DT_SPEC_GET(DT_GPARENT(node_id)), \ LOG_INSTANCE_PTR_INIT(log, name, node_id)}; \ - DEVICE_DT_DEFINE(node_id, regulator_axp192_init, NULL, &data_##id, &config_##id, \ - POST_KERNEL, CONFIG_REGULATOR_AXP192_INIT_PRIORITY, &api); + DEVICE_INSTANCE(node_id, regulator_axp192_init, NULL, &data_##id, &config_##id, \ + POST_KERNEL, &api); #define REGULATOR_AXP192_DEFINE_COND(inst, child) \ COND_CODE_1(DT_NODE_EXISTS(DT_INST_CHILD(inst, child)), \ diff --git a/drivers/regulator/regulator_cp9314.c b/drivers/regulator/regulator_cp9314.c index 83706ff20419d..faee17a5dc053 100644 --- a/drivers/regulator/regulator_cp9314.c +++ b/drivers/regulator/regulator_cp9314.c @@ -705,7 +705,7 @@ static const struct regulator_driver_api api = { .hw_i2c_lock = DT_INST_PROP(inst, cirrus_hw_i2c_lock), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, regulator_cp9314_init, NULL, &data_##inst, &config_##inst, \ - POST_KERNEL, CONFIG_REGULATOR_CP9314_INIT_PRIORITY, &api); + DEVICE_INSTANCE_FROM_DT_INST(inst, regulator_cp9314_init, NULL, &data_##inst, &config_##inst,\ + POST_KERNEL, &api); DT_INST_FOREACH_STATUS_OKAY(REGULATOR_CP9314_DEFINE) diff --git a/drivers/regulator/regulator_da1469x.c b/drivers/regulator/regulator_da1469x.c index 2273fe363bdef..c93988f301518 100644 --- a/drivers/regulator/regulator_da1469x.c +++ b/drivers/regulator/regulator_da1469x.c @@ -464,11 +464,10 @@ static int regulator_da1469x_pm_action(const struct device *dev, .rail = rail_id, \ }; \ PM_DEVICE_DT_DEFINE(node, regulator_da1469x_pm_action); \ - DEVICE_DT_DEFINE(node, regulator_da1469x_init, \ + DEVICE_INSTANCE(node, regulator_da1469x_init, \ PM_DEVICE_DT_GET(node), \ &data_##id, \ &config_##id, PRE_KERNEL_1, \ - CONFIG_REGULATOR_DA1469X_INIT_PRIORITY, \ ®ulator_da1469x_api); #define REGULATOR_DA1469X_DEFINE_COND(inst, child, source) \ diff --git a/drivers/regulator/regulator_fake.c b/drivers/regulator/regulator_fake.c index c2c71593c6152..7cab61c485098 100644 --- a/drivers/regulator/regulator_fake.c +++ b/drivers/regulator/regulator_fake.c @@ -96,14 +96,12 @@ static struct regulator_parent_driver_api parent_api = { .is_enabled = DT_PROP(node_id, fake_is_enabled_in_hardware), \ }; \ \ - DEVICE_DT_DEFINE(node_id, regulator_fake_init, NULL, \ + DEVICE_INSTANCE(node_id, regulator_fake_init, NULL, \ &FAKE_DATA_NAME(node_id), &FAKE_CONF_NAME(node_id), \ - POST_KERNEL, CONFIG_REGULATOR_FAKE_INIT_PRIORITY, \ - &api); + POST_KERNEL, &api); #define REGULATOR_FAKE_DEFINE_ALL(inst) \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, NULL, POST_KERNEL, \ - CONFIG_REGULATOR_FAKE_COMMON_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, NULL, NULL, POST_KERNEL,\ &parent_api); \ \ DT_INST_FOREACH_CHILD(inst, REGULATOR_FAKE_DEFINE) diff --git a/drivers/regulator/regulator_fixed.c b/drivers/regulator/regulator_fixed.c index 5e7151f4941bf..0b9fddd56fc41 100644 --- a/drivers/regulator/regulator_fixed.c +++ b/drivers/regulator/regulator_fixed.c @@ -114,9 +114,8 @@ static int regulator_fixed_init(const struct device *dev) .enable = GPIO_DT_SPEC_INST_GET_OR(inst, enable_gpios, {0}), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, regulator_fixed_init, NULL, &data##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, regulator_fixed_init, NULL, &data##inst,\ &config##inst, POST_KERNEL, \ - CONFIG_REGULATOR_FIXED_INIT_PRIORITY, \ ®ulator_fixed_api); DT_INST_FOREACH_STATUS_OKAY(REGULATOR_FIXED_DEFINE) diff --git a/drivers/regulator/regulator_gpio.c b/drivers/regulator/regulator_gpio.c index d888a5fd6dcc4..8362cde913587 100644 --- a/drivers/regulator/regulator_gpio.c +++ b/drivers/regulator/regulator_gpio.c @@ -222,8 +222,7 @@ static int regulator_gpio_init(const struct device *dev) .states = ((const int[])DT_INST_PROP(inst, states)), \ .states_cnt = DT_INST_PROP_LEN(inst, states) / 2, \ }; \ - DEVICE_DT_INST_DEFINE(inst, regulator_gpio_init, NULL, &data##inst, &config##inst, \ - POST_KERNEL, CONFIG_REGULATOR_GPIO_INIT_PRIORITY, \ - ®ulator_gpio_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, regulator_gpio_init, NULL, &data##inst, &config##inst, \ + POST_KERNEL, ®ulator_gpio_api); DT_INST_FOREACH_STATUS_OKAY(REGULATOR_GPIO_DEFINE) diff --git a/drivers/regulator/regulator_max20335.c b/drivers/regulator/regulator_max20335.c index 328e5179156ea..6c3ceeb2c2ef7 100644 --- a/drivers/regulator/regulator_max20335.c +++ b/drivers/regulator/regulator_max20335.c @@ -347,11 +347,10 @@ static const struct regulator_driver_api api = { }; \ \ static struct regulator_max20335_data regulator_max20335_data_##id; \ - DEVICE_DT_DEFINE(node_id, regulator_max20335_init, NULL, \ + DEVICE_INSTANCE(node_id, regulator_max20335_init, NULL, \ ®ulator_max20335_data_##id, \ ®ulator_max20335_config_##id, \ POST_KERNEL, \ - CONFIG_REGULATOR_MAXIM_MAX20335_INIT_PRIORITY, \ &api); #define REGULATOR_MAX20335_DEFINE_COND(inst, child, source) \ @@ -365,9 +364,8 @@ static const struct regulator_driver_api api = { .bus = I2C_DT_SPEC_GET(DT_INST_PARENT(inst)), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, regulator_max20335_common_init, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, regulator_max20335_common_init, \ NULL, NULL, &common_config_##inst, POST_KERNEL, \ - CONFIG_REGULATOR_MAXIM_MAX20335_COMMON_INIT_PRIORITY, \ &parent_api); \ \ REGULATOR_MAX20335_DEFINE_COND(inst, buck1, MAX20335_PMIC_SOURCE_BUCK1) \ diff --git a/drivers/regulator/regulator_mpm54304.c b/drivers/regulator/regulator_mpm54304.c index a89ddc0ebe1c4..7e33a7acd0e26 100644 --- a/drivers/regulator/regulator_mpm54304.c +++ b/drivers/regulator/regulator_mpm54304.c @@ -77,9 +77,9 @@ static const struct regulator_driver_api mpm54304_api = { }; \ \ static struct regulator_mpm54304_data regulator_mpm54304_data_##id; \ - DEVICE_DT_DEFINE(node_id, regulator_mpm54304_init, NULL, ®ulator_mpm54304_data_##id, \ + DEVICE_INSTANCE(node_id, regulator_mpm54304_init, NULL, ®ulator_mpm54304_data_##id, \ ®ulator_mpm54304_config_##id, POST_KERNEL, \ - CONFIG_REGULATOR_MPM54304_INIT_PRIORITY, &mpm54304_api); + &mpm54304_api); #define REGULATOR_MPM54304_DEFINE_COND(inst, child, child_name) \ IF_ENABLED( \ diff --git a/drivers/regulator/regulator_npm1100.c b/drivers/regulator/regulator_npm1100.c index 924e3a596d1a0..a2b6081e02e13 100644 --- a/drivers/regulator/regulator_npm1100.c +++ b/drivers/regulator/regulator_npm1100.c @@ -114,9 +114,9 @@ static const __unused struct regulator_driver_api api = { .mode = GPIO_DT_SPEC_GET_OR(node_id, nordic_mode_gpios, {}), \ }; \ \ - DEVICE_DT_DEFINE(node_id, regulator_npm1100_init, NULL, &data_##id, \ + DEVICE_INSTANCE(node_id, regulator_npm1100_init, NULL, &data_##id, \ &config_##id, POST_KERNEL, \ - CONFIG_REGULATOR_NPM1100_INIT_PRIORITY, &api); + &api); #define REGULATOR_NPM1100_DEFINE_BUCK_COND(inst) \ COND_CODE_1(DT_NODE_EXISTS(DT_INST_CHILD(inst, buck)), \ @@ -129,9 +129,9 @@ static const __unused struct regulator_driver_api api = { .iset = GPIO_DT_SPEC_INST_GET_OR(inst, nordic_iset_gpios, {}), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, regulator_npm1100_common_init, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, regulator_npm1100_common_init, NULL, NULL,\ &config_##inst, POST_KERNEL, \ - CONFIG_REGULATOR_NPM1100_INIT_PRIORITY, NULL); \ + NULL); \ \ REGULATOR_NPM1100_DEFINE_BUCK_COND(inst) diff --git a/drivers/regulator/regulator_npm1300.c b/drivers/regulator/regulator_npm1300.c index da0a3aedb6417..b1edef3306068 100644 --- a/drivers/regulator/regulator_npm1300.c +++ b/drivers/regulator/regulator_npm1300.c @@ -655,8 +655,8 @@ static const struct regulator_driver_api api = {.enable = regulator_npm1300_enab .retention_gpios = GPIO_DT_SPEC_GET_OR(node_id, retention_gpios, {0}), \ .pwm_gpios = GPIO_DT_SPEC_GET_OR(node_id, pwm_gpios, {0})}; \ \ - DEVICE_DT_DEFINE(node_id, regulator_npm1300_init, NULL, &data_##id, &config_##id, \ - POST_KERNEL, CONFIG_REGULATOR_NPM1300_INIT_PRIORITY, &api); + DEVICE_INSTANCE(node_id, regulator_npm1300_init, NULL, &data_##id, &config_##id, \ + POST_KERNEL, &api); #define REGULATOR_NPM1300_DEFINE_COND(inst, child, source) \ COND_CODE_1(DT_NODE_EXISTS(DT_INST_CHILD(inst, child)), \ @@ -672,9 +672,8 @@ static const struct regulator_driver_api api = {.enable = regulator_npm1300_enab GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 3, {0}), \ GPIO_DT_SPEC_INST_GET_BY_IDX_OR(inst, dvs_gpios, 4, {0})}}; \ \ - DEVICE_DT_INST_DEFINE(inst, regulator_npm1300_common_init, NULL, NULL, &config_##inst, \ - POST_KERNEL, CONFIG_REGULATOR_NPM1300_COMMON_INIT_PRIORITY, \ - &parent_api); \ + DEVICE_INSTANCE_FROM_DT_INST(inst, regulator_npm1300_common_init, NULL, NULL, &config_##inst,\ + POST_KERNEL, &parent_api); \ \ REGULATOR_NPM1300_DEFINE_COND(inst, buck1, NPM1300_SOURCE_BUCK1) \ REGULATOR_NPM1300_DEFINE_COND(inst, buck2, NPM1300_SOURCE_BUCK2) \ diff --git a/drivers/regulator/regulator_npm6001.c b/drivers/regulator/regulator_npm6001.c index 2ade708271adc..a7fc3217101ae 100644 --- a/drivers/regulator/regulator_npm6001.c +++ b/drivers/regulator/regulator_npm6001.c @@ -590,8 +590,8 @@ static const struct regulator_driver_api api = { .source = _source, \ }; \ \ - DEVICE_DT_DEFINE(node_id, regulator_npm6001_init, NULL, &data_##id, &config_##id, \ - POST_KERNEL, CONFIG_REGULATOR_NPM6001_INIT_PRIORITY, &api); + DEVICE_INSTANCE(node_id, regulator_npm6001_init, NULL, &data_##id, &config_##id, \ + POST_KERNEL, &api); #define REGULATOR_NPM6001_DEFINE_COND(inst, child, source) \ COND_CODE_1(DT_NODE_EXISTS(DT_INST_CHILD(inst, child)), \ diff --git a/drivers/regulator/regulator_nxp_vref.c b/drivers/regulator/regulator_nxp_vref.c index dee12f6f679c3..53c1fc87eaeb4 100644 --- a/drivers/regulator/regulator_nxp_vref.c +++ b/drivers/regulator/regulator_nxp_vref.c @@ -219,8 +219,8 @@ static int regulator_nxp_vref_init(const struct device *dev) nxp_current_compensation_en), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, regulator_nxp_vref_init, NULL, &data_##inst,\ + DEVICE_INSTANCE_FROM_DT_INST(inst, regulator_nxp_vref_init, NULL, &data_##inst,\ &config_##inst, POST_KERNEL, \ - CONFIG_REGULATOR_NXP_VREF_INIT_PRIORITY, &api); \ + &api); \ DT_INST_FOREACH_STATUS_OKAY(REGULATOR_NXP_VREF_DEFINE) diff --git a/drivers/regulator/regulator_pca9420.c b/drivers/regulator/regulator_pca9420.c index 705d4f3a8e92b..82bba59d63b1a 100644 --- a/drivers/regulator/regulator_pca9420.c +++ b/drivers/regulator/regulator_pca9420.c @@ -522,9 +522,9 @@ static int regulator_pca9420_common_init(const struct device *dev) .parent = _parent, \ }; \ \ - DEVICE_DT_DEFINE(node_id, regulator_pca9420_init, NULL, &data_##id, \ + DEVICE_INSTANCE(node_id, regulator_pca9420_init, NULL, &data_##id, \ &config_##id, POST_KERNEL, \ - CONFIG_REGULATOR_PCA9420_INIT_PRIORITY, &api); + &api); #define REGULATOR_PCA9420_DEFINE_COND(inst, child, parent) \ COND_CODE_1(DT_NODE_EXISTS(DT_INST_CHILD(inst, child)), \ @@ -544,10 +544,9 @@ static int regulator_pca9420_common_init(const struct device *dev) \ static struct regulator_pca9420_common_data data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, regulator_pca9420_common_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, regulator_pca9420_common_init, NULL,\ &data_##inst, \ &config_##inst, POST_KERNEL, \ - CONFIG_REGULATOR_PCA9420_COMMON_INIT_PRIORITY, \ &parent_api); \ \ REGULATOR_PCA9420_DEFINE_COND(inst, buck1, DEVICE_DT_INST_GET(inst)) \ diff --git a/drivers/regulator/regulator_rpi_pico.c b/drivers/regulator/regulator_rpi_pico.c index f2c0af1559e49..439815ed1b749 100644 --- a/drivers/regulator/regulator_rpi_pico.c +++ b/drivers/regulator/regulator_rpi_pico.c @@ -152,7 +152,7 @@ static const struct regulator_driver_api api = { .brown_out_threshold = DT_INST_ENUM_IDX(inst, raspberrypi_brown_out_threshold), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, regulator_rpi_pico_init, NULL, &data_##inst, &config_##inst, \ - POST_KERNEL, CONFIG_REGULATOR_RPI_PICO_INIT_PRIORITY, &api); + DEVICE_INSTANCE_FROM_DT_INST(inst, regulator_rpi_pico_init, NULL, &data_##inst, &config_##inst,\ + POST_KERNEL, &api); DT_INST_FOREACH_STATUS_OKAY(REGULATOR_RPI_PICO_DEFINE_ALL) diff --git a/drivers/reset/reset_ast10x0.c b/drivers/reset/reset_ast10x0.c index dc03a27ff0b85..c7f25810e7ef2 100644 --- a/drivers/reset/reset_ast10x0.c +++ b/drivers/reset/reset_ast10x0.c @@ -102,8 +102,7 @@ static const struct reset_driver_api aspeed_reset_api = { static const struct reset_aspeed_config reset_aspeed_cfg_##n = { \ .syscon = DEVICE_DT_GET(DT_NODELABEL(syscon)), \ }; \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, &reset_aspeed_cfg_##n, \ - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &aspeed_reset_api); + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, NULL, &reset_aspeed_cfg_##n, \ + PRE_KERNEL_1, &aspeed_reset_api); DT_INST_FOREACH_STATUS_OKAY(ASPEED_RESET_INIT) diff --git a/drivers/reset/reset_gd32.c b/drivers/reset/reset_gd32.c index 8072e468ca180..c44e5f3a0b664 100644 --- a/drivers/reset/reset_gd32.c +++ b/drivers/reset/reset_gd32.c @@ -70,5 +70,5 @@ static const struct reset_gd32_config config = { .base = DT_REG_ADDR(DT_INST_PARENT(0)), }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, &config, PRE_KERNEL_1, - CONFIG_RESET_INIT_PRIORITY, &reset_gd32_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, &config, PRE_KERNEL_1, + &reset_gd32_driver_api); diff --git a/drivers/reset/reset_intel_socfpga.c b/drivers/reset/reset_intel_socfpga.c index c63805d447fe6..d827de19adb3a 100644 --- a/drivers/reset/reset_intel_socfpga.c +++ b/drivers/reset/reset_intel_socfpga.c @@ -103,13 +103,12 @@ static const struct reset_driver_api reset_intel_soc_driver_api = { .active_low = DT_INST_PROP(_inst, active_low), \ }; \ \ - DEVICE_DT_INST_DEFINE(_inst, \ + DEVICE_INSTANCE_FROM_DT_INST(_inst, \ reset_intel_soc_init, \ NULL, \ &reset_intel_soc_data_##_inst, \ &reset_intel_config_##_inst, \ PRE_KERNEL_1, \ - CONFIG_RESET_INIT_PRIORITY, \ &reset_intel_soc_driver_api); DT_INST_FOREACH_STATUS_OKAY(INTEL_SOC_RESET_INIT); diff --git a/drivers/reset/reset_lpc_syscon.c b/drivers/reset/reset_lpc_syscon.c index 9effda6651898..1a6342d1c27d7 100644 --- a/drivers/reset/reset_lpc_syscon.c +++ b/drivers/reset/reset_lpc_syscon.c @@ -59,7 +59,7 @@ static const struct reset_driver_api reset_nxp_syscon_driver_api = { .line_toggle = reset_nxp_syscon_line_toggle, }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, (void *)(DT_REG_ADDR(DT_INST_PARENT(0)) + 0x100), - PRE_KERNEL_1, CONFIG_RESET_INIT_PRIORITY, + PRE_KERNEL_1, &reset_nxp_syscon_driver_api); diff --git a/drivers/reset/reset_npcx.c b/drivers/reset/reset_npcx.c index af9cac37f06c4..7e770743b6bbf 100644 --- a/drivers/reset/reset_npcx.c +++ b/drivers/reset/reset_npcx.c @@ -74,5 +74,5 @@ static const struct reset_npcx_dev_config reset_npcx_config = { .reg_base = (struct swrst_reg *)DT_INST_REG_ADDR(0), }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, &reset_npcx_config, PRE_KERNEL_1, - CONFIG_RESET_INIT_PRIORITY, &reset_npcx_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, &reset_npcx_config, PRE_KERNEL_1, + &reset_npcx_driver_api); diff --git a/drivers/reset/reset_numaker.c b/drivers/reset/reset_numaker.c index f1e875c78d030..0b36cbf2ddd41 100644 --- a/drivers/reset/reset_numaker.c +++ b/drivers/reset/reset_numaker.c @@ -70,5 +70,5 @@ static const struct reset_numaker_config config = { .base = (uint32_t)DT_INST_REG_ADDR(0), }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, &config, PRE_KERNEL_1, - CONFIG_RESET_INIT_PRIORITY, &reset_numaker_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, &config, PRE_KERNEL_1, + &reset_numaker_driver_api); diff --git a/drivers/reset/reset_nxp_rstctl.c b/drivers/reset/reset_nxp_rstctl.c index 22d7cfa065088..5882347de64da 100644 --- a/drivers/reset/reset_nxp_rstctl.c +++ b/drivers/reset/reset_nxp_rstctl.c @@ -72,9 +72,8 @@ static const struct reset_driver_api reset_nxp_rstctl_driver_api = { }; #define NXP_RSTCTL_INIT(n) \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, NULL, \ (void *)DT_INST_REG_ADDR(n), \ - PRE_KERNEL_1, CONFIG_RESET_INIT_PRIORITY, \ - &reset_nxp_rstctl_driver_api); + PRE_KERNEL_1, &reset_nxp_rstctl_driver_api); DT_INST_FOREACH_STATUS_OKAY(NXP_RSTCTL_INIT) diff --git a/drivers/reset/reset_rpi_pico.c b/drivers/reset/reset_rpi_pico.c index 04cf084d2b1a1..82fae0c9c98d3 100644 --- a/drivers/reset/reset_rpi_pico.c +++ b/drivers/reset/reset_rpi_pico.c @@ -153,10 +153,9 @@ static const struct reset_driver_api reset_rpi_driver_api = { .base_address = DT_INST_REG_ADDR(idx), \ }; \ \ - DEVICE_DT_INST_DEFINE(idx, reset_rpi_init, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, reset_rpi_init, \ NULL, NULL, \ &reset_rpi_config_##idx, PRE_KERNEL_1, \ - CONFIG_RESET_INIT_PRIORITY, \ &reset_rpi_driver_api); DT_INST_FOREACH_STATUS_OKAY(RPI_RESET_INIT); diff --git a/drivers/reset/reset_stm32.c b/drivers/reset/reset_stm32.c index 50a48b3334ca4..2cd0d973ca6a5 100644 --- a/drivers/reset/reset_stm32.c +++ b/drivers/reset/reset_stm32.c @@ -74,5 +74,5 @@ static const struct reset_stm32_config reset_stm32_config = { .base = DT_REG_ADDR(DT_INST_PARENT(0)), }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, &reset_stm32_config, PRE_KERNEL_1, - CONFIG_RESET_INIT_PRIORITY, &reset_stm32_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, &reset_stm32_config, PRE_KERNEL_1, + &reset_stm32_driver_api); diff --git a/drivers/retained_mem/retained_mem_zephyr_reg.c b/drivers/retained_mem/retained_mem_zephyr_reg.c index a302e175a6eaf..bdb940fcdf9e9 100644 --- a/drivers/retained_mem/retained_mem_zephyr_reg.c +++ b/drivers/retained_mem/retained_mem_zephyr_reg.c @@ -123,13 +123,12 @@ static const struct retained_mem_driver_api zephyr_retained_mem_reg_api = { .address = (uint8_t *)DT_INST_REG_ADDR(inst), \ .size = DT_INST_REG_SIZE(inst), \ }; \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &zephyr_retained_mem_reg_init, \ NULL, \ &zephyr_retained_mem_reg_data_##inst, \ &zephyr_retained_mem_reg_config_##inst, \ POST_KERNEL, \ - CONFIG_RETAINED_MEM_INIT_PRIORITY, \ &zephyr_retained_mem_reg_api); DT_INST_FOREACH_STATUS_OKAY(ZEPHYR_RETAINED_MEM_REG_DEVICE) diff --git a/drivers/rtc/rtc_am1805.c b/drivers/rtc/rtc_am1805.c index b6282d0f8ae56..dbb10c04df7cb 100644 --- a/drivers/rtc/rtc_am1805.c +++ b/drivers/rtc/rtc_am1805.c @@ -592,8 +592,7 @@ static const struct am1805_config am1805_config_##inst = { \ \ static struct am1805_data am1805_data_##inst; \ \ -DEVICE_DT_INST_DEFINE(inst, &am1805_init, NULL, &am1805_data_##inst, \ - &am1805_config_##inst, POST_KERNEL, CONFIG_RTC_INIT_PRIORITY, \ - &am1805_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(inst, &am1805_init, NULL, &am1805_data_##inst, \ + &am1805_config_##inst, POST_KERNEL, &am1805_driver_api); DT_INST_FOREACH_STATUS_OKAY(AM1805_INIT) diff --git a/drivers/rtc/rtc_ambiq.c b/drivers/rtc/rtc_ambiq.c index 9a761742428db..8f2ff6c339b37 100644 --- a/drivers/rtc/rtc_ambiq.c +++ b/drivers/rtc/rtc_ambiq.c @@ -373,8 +373,8 @@ static const struct ambiq_rtc_config ambiq_rtc_config_##inst = { \ \ static struct ambiq_rtc_data ambiq_rtc_data##inst; \ \ -DEVICE_DT_INST_DEFINE(inst, &ambiq_rtc_init, NULL, &ambiq_rtc_data##inst, \ - &ambiq_rtc_config_##inst, POST_KERNEL, \ - CONFIG_RTC_INIT_PRIORITY, &ambiq_rtc_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(inst, &ambiq_rtc_init, NULL, &ambiq_rtc_data##inst,\ + &ambiq_rtc_config_##inst, POST_KERNEL, \ + &ambiq_rtc_driver_api); DT_INST_FOREACH_STATUS_OKAY(AMBIQ_RTC_INIT) diff --git a/drivers/rtc/rtc_ds1307.c b/drivers/rtc/rtc_ds1307.c index 8b90285a3166f..0cd98d3272809 100644 --- a/drivers/rtc/rtc_ds1307.c +++ b/drivers/rtc/rtc_ds1307.c @@ -163,8 +163,7 @@ static int ds1307_init(const struct device *dev) static const struct ds1307_config ds1307_config_##inst = { \ .i2c_bus = I2C_DT_SPEC_INST_GET(inst), \ }; \ - DEVICE_DT_INST_DEFINE(inst, &ds1307_init, NULL, &ds1307_data_##inst, \ - &ds1307_config_##inst, POST_KERNEL, CONFIG_RTC_INIT_PRIORITY, \ - &ds1307_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, &ds1307_init, NULL, &ds1307_data_##inst, \ + &ds1307_config_##inst, POST_KERNEL, &ds1307_driver_api); DT_INST_FOREACH_STATUS_OKAY(DS1307_DEFINE) diff --git a/drivers/rtc/rtc_emul.c b/drivers/rtc/rtc_emul.c index eb40b9399a443..e48243c68433f 100644 --- a/drivers/rtc/rtc_emul.c +++ b/drivers/rtc/rtc_emul.c @@ -473,7 +473,7 @@ int rtc_emul_init(const struct device *dev) #define RTC_EMUL_DEVICE(id) \ RTC_EMUL_DEVICE_DATA(id) \ \ - DEVICE_DT_INST_DEFINE(id, rtc_emul_init, NULL, &rtc_emul_data_##id, NULL, POST_KERNEL, \ - CONFIG_RTC_INIT_PRIORITY, &rtc_emul_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(id, rtc_emul_init, NULL, &rtc_emul_data_##id, NULL, POST_KERNEL,\ + &rtc_emul_driver_api); DT_INST_FOREACH_STATUS_OKAY(RTC_EMUL_DEVICE); diff --git a/drivers/rtc/rtc_fake.c b/drivers/rtc/rtc_fake.c index 76de2d7d60d7f..949265306be1e 100644 --- a/drivers/rtc/rtc_fake.c +++ b/drivers/rtc/rtc_fake.c @@ -90,7 +90,6 @@ static const struct rtc_driver_api rtc_fake_driver_api = { }; #define RTC_FAKE_DEVICE_INIT(inst) \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, NULL, POST_KERNEL, CONFIG_RTC_INIT_PRIORITY, \ - &rtc_fake_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, NULL, NULL, POST_KERNEL, &rtc_fake_driver_api); DT_INST_FOREACH_STATUS_OKAY(RTC_FAKE_DEVICE_INIT); diff --git a/drivers/rtc/rtc_ifx_cat1.c b/drivers/rtc/rtc_ifx_cat1.c index 24569ca3864bf..e39ab7085dc7e 100644 --- a/drivers/rtc/rtc_ifx_cat1.c +++ b/drivers/rtc/rtc_ifx_cat1.c @@ -336,8 +336,7 @@ static const struct rtc_driver_api ifx_cat1_rtc_driver_api = { #define INFINEON_CAT1_RTC_INIT(n) \ static struct ifx_cat1_rtc_data ifx_cat1_rtc_data##n; \ \ - DEVICE_DT_INST_DEFINE(n, ifx_cat1_rtc_init, NULL, &ifx_cat1_rtc_data##n, \ - NULL, PRE_KERNEL_1, CONFIG_RTC_INIT_PRIORITY, \ - &ifx_cat1_rtc_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, ifx_cat1_rtc_init, NULL, &ifx_cat1_rtc_data##n, \ + NULL, PRE_KERNEL_1, &ifx_cat1_rtc_driver_api); DT_INST_FOREACH_STATUS_OKAY(INFINEON_CAT1_RTC_INIT) diff --git a/drivers/rtc/rtc_ll_stm32.c b/drivers/rtc/rtc_ll_stm32.c index c34ae3c595a18..8757fdd904db1 100644 --- a/drivers/rtc/rtc_ll_stm32.c +++ b/drivers/rtc/rtc_ll_stm32.c @@ -1108,5 +1108,5 @@ static const struct rtc_stm32_config rtc_config = { static struct rtc_stm32_data rtc_data; -DEVICE_DT_INST_DEFINE(0, &rtc_stm32_init, NULL, &rtc_data, &rtc_config, PRE_KERNEL_1, - CONFIG_RTC_INIT_PRIORITY, &rtc_stm32_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &rtc_stm32_init, NULL, &rtc_data, &rtc_config, PRE_KERNEL_1, + &rtc_stm32_driver_api); diff --git a/drivers/rtc/rtc_mc146818.c b/drivers/rtc/rtc_mc146818.c index 66257cf8d7461..f6ff14d18d2b9 100644 --- a/drivers/rtc/rtc_mc146818.c +++ b/drivers/rtc/rtc_mc146818.c @@ -535,9 +535,8 @@ static const struct rtc_driver_api rtc_mc146818_driver_api = { \ RTC_MC146818_INIT_FN_DEFINE(inst) \ \ - DEVICE_DT_INST_DEFINE(inst, &rtc_mc146818_init##inst, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &rtc_mc146818_init##inst, NULL, \ &rtc_mc146818_data##inst, NULL, POST_KERNEL, \ - CONFIG_RTC_INIT_PRIORITY, \ &rtc_mc146818_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(RTC_MC146818_DEV_CFG) diff --git a/drivers/rtc/rtc_numaker.c b/drivers/rtc/rtc_numaker.c index 4356a76eef787..10c1e772796bd 100644 --- a/drivers/rtc/rtc_numaker.c +++ b/drivers/rtc/rtc_numaker.c @@ -422,5 +422,5 @@ static const struct rtc_numaker_config rtc_config = { .oscillator = DT_ENUM_IDX(DT_NODELABEL(rtc), oscillator), }; -DEVICE_DT_INST_DEFINE(0, &rtc_numaker_init, NULL, &rtc_data, &rtc_config, PRE_KERNEL_1, - CONFIG_RTC_INIT_PRIORITY, &rtc_numaker_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &rtc_numaker_init, NULL, &rtc_data, &rtc_config, PRE_KERNEL_1, + &rtc_numaker_driver_api); diff --git a/drivers/rtc/rtc_nxp_irtc.c b/drivers/rtc/rtc_nxp_irtc.c index adea90f3aabca..e7f44e537d79f 100644 --- a/drivers/rtc/rtc_nxp_irtc.c +++ b/drivers/rtc/rtc_nxp_irtc.c @@ -391,7 +391,7 @@ static const struct rtc_driver_api rtc_nxp_irtc_driver_api = { \ static struct nxp_irtc_data nxp_irtc_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, nxp_irtc_init, NULL, &nxp_irtc_data_##n, &nxp_irtc_config_##n, \ - PRE_KERNEL_1, CONFIG_RTC_INIT_PRIORITY, &rtc_nxp_irtc_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, nxp_irtc_init, NULL, &nxp_irtc_data_##n, &nxp_irtc_config_##n,\ + PRE_KERNEL_1, &rtc_nxp_irtc_driver_api); DT_INST_FOREACH_STATUS_OKAY(RTC_NXP_IRTC_DEVICE_INIT) diff --git a/drivers/rtc/rtc_pcf8523.c b/drivers/rtc/rtc_pcf8523.c index 3e7287e3fe67e..5d7ddcc5bda43 100644 --- a/drivers/rtc/rtc_pcf8523.c +++ b/drivers/rtc/rtc_pcf8523.c @@ -964,8 +964,8 @@ static const struct rtc_driver_api pcf8523_driver_api = { \ PM_DEVICE_DT_INST_DEFINE(inst, pcf8523_pm_action); \ \ - DEVICE_DT_INST_DEFINE(inst, &pcf8523_init, PM_DEVICE_DT_INST_GET(inst), \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &pcf8523_init, PM_DEVICE_DT_INST_GET(inst), \ &pcf8523_data_##inst, &pcf8523_config_##inst, POST_KERNEL, \ - CONFIG_RTC_INIT_PRIORITY, &pcf8523_driver_api); + &pcf8523_driver_api); DT_INST_FOREACH_STATUS_OKAY(PCF8523_INIT) diff --git a/drivers/rtc/rtc_pcf8563.c b/drivers/rtc/rtc_pcf8563.c index b687d095013c2..3db5226349ee8 100644 --- a/drivers/rtc/rtc_pcf8563.c +++ b/drivers/rtc/rtc_pcf8563.c @@ -499,8 +499,8 @@ int pcf8563_init(const struct device *dev) \ static struct pcf8563_data pcf8563_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, &pcf8563_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &pcf8563_init, NULL, \ &pcf8563_data_##inst, &pcf8563_config_##inst, POST_KERNEL, \ - CONFIG_RTC_INIT_PRIORITY, &pcf8563_driver_api); + &pcf8563_driver_api); DT_INST_FOREACH_STATUS_OKAY(PCF8563_INIT) diff --git a/drivers/rtc/rtc_rpi_pico.c b/drivers/rtc/rtc_rpi_pico.c index 84a0d2a4dec29..1e7adc3496630 100644 --- a/drivers/rtc/rtc_rpi_pico.c +++ b/drivers/rtc/rtc_rpi_pico.c @@ -319,5 +319,5 @@ static const struct rtc_driver_api rtc_rpi_pico_driver_api = { #endif /* CONFIG_RTC_ALARM */ }; -DEVICE_DT_INST_DEFINE(0, &rtc_rpi_pico_init, NULL, &rtc_data, NULL, POST_KERNEL, - CONFIG_RTC_INIT_PRIORITY, &rtc_rpi_pico_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &rtc_rpi_pico_init, NULL, &rtc_data, NULL, POST_KERNEL, + &rtc_rpi_pico_driver_api); diff --git a/drivers/rtc/rtc_rv3028.c b/drivers/rtc/rtc_rv3028.c index 039c5f90e6ef2..327eb9da42011 100644 --- a/drivers/rtc/rtc_rv3028.c +++ b/drivers/rtc/rtc_rv3028.c @@ -919,8 +919,7 @@ static const struct rtc_driver_api rv3028_driver_api = { \ static struct rv3028_data rv3028_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, &rv3028_init, NULL, &rv3028_data_##inst, \ - &rv3028_config_##inst, POST_KERNEL, CONFIG_RTC_INIT_PRIORITY, \ - &rv3028_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, &rv3028_init, NULL, &rv3028_data_##inst, \ + &rv3028_config_##inst, POST_KERNEL, &rv3028_driver_api); DT_INST_FOREACH_STATUS_OKAY(RV3028_INIT) diff --git a/drivers/rtc/rtc_rv8263.c b/drivers/rtc/rtc_rv8263.c index 7e76e7fc55d1f..caac160deca6c 100644 --- a/drivers/rtc/rtc_rv8263.c +++ b/drivers/rtc/rtc_rv8263.c @@ -706,8 +706,7 @@ static const struct rtc_driver_api rv8263c8_driver_api = { .clkout = DT_INST_ENUM_IDX(inst, clkout), \ IF_ENABLED(DT_ANY_INST_HAS_PROP_STATUS_OKAY(int_gpios), \ (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, {0})))}; \ - DEVICE_DT_INST_DEFINE(inst, &rv8263c8_init, NULL, &rv8263c8_data_##inst, \ - &rv8263c8_config_##inst, POST_KERNEL, CONFIG_RTC_INIT_PRIORITY, \ - &rv8263c8_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, &rv8263c8_init, NULL, &rv8263c8_data_##inst, \ + &rv8263c8_config_##inst, POST_KERNEL, &rv8263c8_driver_api); DT_INST_FOREACH_STATUS_OKAY(RV8263_DEFINE) diff --git a/drivers/rtc/rtc_sam.c b/drivers/rtc/rtc_sam.c index 22aec94f1d875..f166e5c52a52e 100644 --- a/drivers/rtc/rtc_sam.c +++ b/drivers/rtc/rtc_sam.c @@ -674,10 +674,9 @@ static int rtc_sam_init(const struct device *dev) \ static struct rtc_sam_data rtc_sam_data_##id; \ \ - DEVICE_DT_INST_DEFINE(id, rtc_sam_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(id, rtc_sam_init, NULL, \ &rtc_sam_data_##id, \ &rtc_sam_config_##id, POST_KERNEL, \ - CONFIG_RTC_INIT_PRIORITY, \ &rtc_sam_driver_api); DT_INST_FOREACH_STATUS_OKAY(RTC_SAM_DEVICE); diff --git a/drivers/rtc/rtc_smartbond.c b/drivers/rtc/rtc_smartbond.c index 3d171e58f6943..bf7c908281635 100644 --- a/drivers/rtc/rtc_smartbond.c +++ b/drivers/rtc/rtc_smartbond.c @@ -654,10 +654,9 @@ static int rtc_smartbond_init(const struct device *dev) \ static struct rtc_smartbond_data rtc_smartbond_data_ ## inst; \ \ - DEVICE_DT_INST_DEFINE(0, rtc_smartbond_init, NULL, \ - &rtc_smartbond_data_ ## inst, NULL, \ - POST_KERNEL, \ - CONFIG_RTC_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(0, rtc_smartbond_init, NULL,\ + &rtc_smartbond_data_ ## inst, NULL, \ + POST_KERNEL, \ &rtc_smartbond_driver_api); DT_INST_FOREACH_STATUS_OKAY(SMARTBOND_RTC_INIT) diff --git a/drivers/rtc/rtc_xmc4xxx.c b/drivers/rtc/rtc_xmc4xxx.c index c6efe8b3a4ac4..4ace251b88dc6 100644 --- a/drivers/rtc/rtc_xmc4xxx.c +++ b/drivers/rtc/rtc_xmc4xxx.c @@ -266,5 +266,5 @@ static int rtc_xmc4xxx_init(const struct device *dev) static struct rtc_xmc4xxx_data rtc_xmc4xxx_data_0; -DEVICE_DT_INST_DEFINE(0, rtc_xmc4xxx_init, NULL, &rtc_xmc4xxx_data_0, NULL, - POST_KERNEL, CONFIG_RTC_INIT_PRIORITY, &rtc_xmc4xxx_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, rtc_xmc4xxx_init, NULL, &rtc_xmc4xxx_data_0, NULL, + POST_KERNEL, &rtc_xmc4xxx_driver_api); diff --git a/drivers/sdhc/ifx_cat1_sdio.c b/drivers/sdhc/ifx_cat1_sdio.c index d298e1d7b6b9d..064579ee16f49 100644 --- a/drivers/sdhc/ifx_cat1_sdio.c +++ b/drivers/sdhc/ifx_cat1_sdio.c @@ -325,8 +325,7 @@ static const struct sdhc_driver_api ifx_cat1_sdio_api = { \ static struct ifx_cat1_sdio_data ifx_cat1_sdio_##n##_data; \ \ - DEVICE_DT_INST_DEFINE(n, &ifx_cat1_sdio_init, NULL, &ifx_cat1_sdio_##n##_data, \ - &ifx_cat1_sdio_##n##_config, POST_KERNEL, CONFIG_SDHC_INIT_PRIORITY, \ - &ifx_cat1_sdio_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &ifx_cat1_sdio_init, NULL, &ifx_cat1_sdio_##n##_data, \ + &ifx_cat1_sdio_##n##_config, POST_KERNEL, &ifx_cat1_sdio_api); DT_INST_FOREACH_STATUS_OKAY(IFX_CAT1_SDHC_INIT) diff --git a/drivers/sdhc/imx_usdhc.c b/drivers/sdhc/imx_usdhc.c index 5a7f372dd201e..2139a5544bfd9 100644 --- a/drivers/sdhc/imx_usdhc.c +++ b/drivers/sdhc/imx_usdhc.c @@ -1122,13 +1122,12 @@ static const struct sdhc_driver_api usdhc_api = { IMX_USDHC_DMA_BUFFER_INIT(n) \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &imx_usdhc_init, \ NULL, \ &usdhc_##n##_data, \ &usdhc_##n##_config, \ POST_KERNEL, \ - CONFIG_SDHC_INIT_PRIORITY, \ &usdhc_api); DT_INST_FOREACH_STATUS_OKAY(IMX_USDHC_INIT) diff --git a/drivers/sdhc/intel_emmc_host.c b/drivers/sdhc/intel_emmc_host.c index 6286965f1564e..4601b1359bbf7 100644 --- a/drivers/sdhc/intel_emmc_host.c +++ b/drivers/sdhc/intel_emmc_host.c @@ -1342,7 +1342,7 @@ static const struct sdhc_driver_api emmc_api = { \ static struct emmc_data emmc_priv_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, emmc_init, NULL, &emmc_priv_data_##n, &emmc_config_data_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &emmc_api); + DEVICE_INSTANCE_FROM_DT_INST(n, emmc_init, NULL, &emmc_priv_data_##n, &emmc_config_data_##n,\ + POST_KERNEL, &emmc_api); DT_INST_FOREACH_STATUS_OKAY(EMMC_HOST_DEV_CFG) diff --git a/drivers/sdhc/mcux_sdif.c b/drivers/sdhc/mcux_sdif.c index 0649c1261e9e6..30da57e47fe09 100644 --- a/drivers/sdhc/mcux_sdif.c +++ b/drivers/sdhc/mcux_sdif.c @@ -450,13 +450,12 @@ static const struct sdhc_driver_api sdif_api = { MCUX_SDIF_DMA_DESCRIPTOR_INIT(n) \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &mcux_sdif_init, \ NULL, \ &sdif_##n##_data, \ &sdif_##n##_config, \ POST_KERNEL, \ - CONFIG_SDHC_INIT_PRIORITY, \ &sdif_api); DT_INST_FOREACH_STATUS_OKAY(MCUX_SDIF_INIT) diff --git a/drivers/sdhc/rcar_mmc.c b/drivers/sdhc/rcar_mmc.c index b6e8c216a739a..7266548e912a8 100644 --- a/drivers/sdhc/rcar_mmc.c +++ b/drivers/sdhc/rcar_mmc.c @@ -2208,7 +2208,7 @@ static int rcar_mmc_init(const struct device *dev) .uhs_support = 1, \ .bus_width = DT_INST_PROP(n, bus_width), \ RCAR_MMC_IRQ_CFG_FUNC_INIT(n)}; \ - DEVICE_DT_INST_DEFINE(n, rcar_mmc_init, NULL, &mmc_rcar_data_##n, &mmc_rcar_cfg_##n, \ - POST_KERNEL, CONFIG_SDHC_INIT_PRIORITY, &rcar_sdhc_api); + DEVICE_INSTANCE_FROM_DT_INST(n, rcar_mmc_init, NULL, &mmc_rcar_data_##n, &mmc_rcar_cfg_##n,\ + POST_KERNEL, &rcar_sdhc_api); DT_INST_FOREACH_STATUS_OKAY(RCAR_MMC_INIT) diff --git a/drivers/sdhc/sam_hsmci.c b/drivers/sdhc/sam_hsmci.c index b7c3d3b878359..d840fc497f0fe 100644 --- a/drivers/sdhc/sam_hsmci.c +++ b/drivers/sdhc/sam_hsmci.c @@ -677,7 +677,7 @@ static const struct sdhc_driver_api hsmci_api = { .clock_cfg = SAM_DT_INST_CLOCK_PMC_CFG(N), \ .carrier_detect = GPIO_DT_SPEC_INST_GET_OR(N, cd_gpios, {0})}; \ static struct sam_hsmci_data hsmci_##N##_data = {}; \ - DEVICE_DT_INST_DEFINE(N, &sam_hsmci_init, NULL, &hsmci_##N##_data, &hsmci_##N##_config, \ - POST_KERNEL, CONFIG_SDHC_INIT_PRIORITY, &hsmci_api); + DEVICE_INSTANCE_FROM_DT_INST(N, &sam_hsmci_init, NULL, &hsmci_##N##_data, &hsmci_##N##_config,\ + POST_KERNEL, &hsmci_api); DT_INST_FOREACH_STATUS_OKAY(SAM_HSMCI_INIT) diff --git a/drivers/sdhc/sdhc_cdns.c b/drivers/sdhc/sdhc_cdns.c index f5a880e5fb4e6..6548989c35680 100644 --- a/drivers/sdhc/sdhc_cdns.c +++ b/drivers/sdhc/sdhc_cdns.c @@ -289,13 +289,12 @@ static const struct sdhc_driver_api sdhc_cdns_api = { .ocr_voltage = OCR_3_3_3_4 | OCR_3_2_3_3, \ }, \ }; \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &sdhc_cdns_init, \ NULL, \ &sdhc_cdns_data_##inst, \ &sdhc_cdns_config_##inst, \ POST_KERNEL, \ - CONFIG_SDHC_INIT_PRIORITY, \ &sdhc_cdns_api); DT_INST_FOREACH_STATUS_OKAY(SDHC_CDNS_INIT) diff --git a/drivers/sdhc/sdhc_esp32.c b/drivers/sdhc/sdhc_esp32.c index e31fe92d99844..a505b0911737b 100644 --- a/drivers/sdhc/sdhc_esp32.c +++ b/drivers/sdhc/sdhc_esp32.c @@ -1455,9 +1455,8 @@ static const struct sdhc_driver_api sdhc_api = {.reset = sdhc_esp32_reset, .timing = SDHC_TIMING_LEGACY, \ .s_host_ctx = {.event_queue = &sdhc##n##_queue}}; \ \ - DEVICE_DT_INST_DEFINE(n, &sdhc_esp32_init, NULL, &sdhc_esp32_##n##_data, \ - &sdhc_esp32_##n##_config, POST_KERNEL, CONFIG_SDHC_INIT_PRIORITY, \ - &sdhc_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &sdhc_esp32_init, NULL, &sdhc_esp32_##n##_data, \ + &sdhc_esp32_##n##_config, POST_KERNEL, &sdhc_api); DT_INST_FOREACH_STATUS_OKAY(SDHC_ESP32_INIT) diff --git a/drivers/sdhc/sdhc_spi.c b/drivers/sdhc/sdhc_spi.c index d5670518e3ebf..1b47b45a7bc99 100644 --- a/drivers/sdhc/sdhc_spi.c +++ b/drivers/sdhc/sdhc_spi.c @@ -837,13 +837,12 @@ static const struct sdhc_driver_api sdhc_spi_api = { 0), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &sdhc_spi_init, \ NULL, \ &sdhc_spi_data_##n, \ &sdhc_spi_config_##n, \ POST_KERNEL, \ - CONFIG_SDHC_INIT_PRIORITY, \ &sdhc_spi_api); DT_INST_FOREACH_STATUS_OKAY(SDHC_SPI_INIT) diff --git a/drivers/sensor/a01nyub/a01nyub.c b/drivers/sensor/a01nyub/a01nyub.c index f1d57becd04d0..c5d53e0d4f3cf 100644 --- a/drivers/sensor/a01nyub/a01nyub.c +++ b/drivers/sensor/a01nyub/a01nyub.c @@ -204,8 +204,8 @@ static int a01nyub_init(const struct device *dev) .cb = a01nyub_uart_isr, \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, a01nyub_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, a01nyub_init, NULL, \ &a01nyub_data_##inst, &a01nyub_cfg_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &a01nyub_api_funcs); + POST_KERNEL, &a01nyub_api_funcs); DT_INST_FOREACH_STATUS_OKAY(A01NYUB_INIT) diff --git a/drivers/sensor/adi/adltc2990/adltc2990.c b/drivers/sensor/adi/adltc2990/adltc2990.c index 8dcd1dec66f17..cce3435cf6f66 100644 --- a/drivers/sensor/adi/adltc2990/adltc2990.c +++ b/drivers/sensor/adi/adltc2990/adltc2990.c @@ -530,8 +530,8 @@ static const struct sensor_driver_api adltc2990_driver_api = { .pins_v3_v4.voltage_divider_resistors.v4_r1_r2 = \ DT_INST_PROP_OR(inst, pin_v4_voltage_divider_resistors, NULL)}; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, adltc2990_init, NULL, &adltc2990_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, adltc2990_init, NULL, &adltc2990_data_##inst, \ &adltc2990_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &adltc2990_driver_api); + &adltc2990_driver_api); DT_INST_FOREACH_STATUS_OKAY(ADLTC2990_DEFINE) diff --git a/drivers/sensor/adi/adt7310/adt7310.c b/drivers/sensor/adi/adt7310/adt7310.c index c86e03f0a46dd..ebfcf5cb86140 100644 --- a/drivers/sensor/adi/adt7310/adt7310.c +++ b/drivers/sensor/adi/adt7310/adt7310.c @@ -296,8 +296,8 @@ static const struct sensor_driver_api adt7310_driver_api = { IF_ENABLED(CONFIG_ADT7310_TRIGGER, \ (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, {0}),))}; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, adt7310_init, NULL, &adt7310_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, adt7310_init, NULL, &adt7310_data_##inst, \ &adt7310_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &adt7310_driver_api); + &adt7310_driver_api); DT_INST_FOREACH_STATUS_OKAY(ADT7310_DEFINE) diff --git a/drivers/sensor/adi/adt7420/adt7420.c b/drivers/sensor/adi/adt7420/adt7420.c index a126674b6ff42..9bf36de98e4fb 100644 --- a/drivers/sensor/adi/adt7420/adt7420.c +++ b/drivers/sensor/adi/adt7420/adt7420.c @@ -222,8 +222,8 @@ static int adt7420_init(const struct device *dev) (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, { 0 }),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, adt7420_init, NULL, &adt7420_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, adt7420_init, NULL, &adt7420_data_##inst,\ &adt7420_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &adt7420_driver_api); \ + &adt7420_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(ADT7420_DEFINE) diff --git a/drivers/sensor/adi/adxl345/adxl345.c b/drivers/sensor/adi/adxl345/adxl345.c index d5f07bad26585..ea50d12fe8888 100644 --- a/drivers/sensor/adi/adxl345/adxl345.c +++ b/drivers/sensor/adi/adxl345/adxl345.c @@ -565,8 +565,8 @@ static int adxl345_init(const struct device *dev) COND_CODE_1(DT_INST_ON_BUS(inst, spi), (ADXL345_CONFIG_SPI(inst)), \ (ADXL345_CONFIG_I2C(inst))); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, adxl345_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, adxl345_init, NULL, \ &adxl345_data_##inst, &adxl345_config_##inst, POST_KERNEL,\ - CONFIG_SENSOR_INIT_PRIORITY, &adxl345_api_funcs); \ + &adxl345_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(ADXL345_DEFINE) diff --git a/drivers/sensor/adi/adxl362/adxl362.c b/drivers/sensor/adi/adxl362/adxl362.c index cc7067aca6345..81c00cd3b48d8 100644 --- a/drivers/sensor/adi/adxl362/adxl362.c +++ b/drivers/sensor/adi/adxl362/adxl362.c @@ -836,8 +836,8 @@ static int adxl362_init(const struct device *dev) (.interrupt = GPIO_DT_SPEC_INST_GET_OR(inst, int1_gpios, { 0 }),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, adxl362_init, NULL, &adxl362_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, adxl362_init, NULL, &adxl362_data_##inst, \ &adxl362_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &adxl362_api_funcs); \ + &adxl362_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(ADXL362_DEFINE) diff --git a/drivers/sensor/adi/adxl367/adxl367.c b/drivers/sensor/adi/adxl367/adxl367.c index 031f97f0c926b..dfff9b55a1860 100644 --- a/drivers/sensor/adi/adxl367/adxl367.c +++ b/drivers/sensor/adi/adxl367/adxl367.c @@ -1084,13 +1084,12 @@ static int adxl367_init(const struct device *dev) */ #define ADXL367_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ adxl367_init, \ NULL, \ &adxl367_data_##inst, \ &adxl367_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &adxl367_api_funcs); #ifdef CONFIG_ADXL367_TRIGGER diff --git a/drivers/sensor/adi/adxl372/adxl372.c b/drivers/sensor/adi/adxl372/adxl372.c index 8eb1ea643994c..f9d9888ebfb2b 100644 --- a/drivers/sensor/adi/adxl372/adxl372.c +++ b/drivers/sensor/adi/adxl372/adxl372.c @@ -856,13 +856,12 @@ static int adxl372_init(const struct device *dev) */ #define ADXL372_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ adxl372_init, \ NULL, \ &adxl372_data_##inst, \ &adxl372_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &adxl372_api_funcs); /* diff --git a/drivers/sensor/amd_sb_tsi/sb_tsi.c b/drivers/sensor/amd_sb_tsi/sb_tsi.c index de0b91f570d2a..f635a8bf3f735 100644 --- a/drivers/sensor/amd_sb_tsi/sb_tsi.c +++ b/drivers/sensor/amd_sb_tsi/sb_tsi.c @@ -124,8 +124,8 @@ static int sb_tsi_pm_action(const struct device *dev, enum pm_device_action acti .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ PM_DEVICE_DT_INST_DEFINE(inst, sb_tsi_pm_action); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, sb_tsi_init, PM_DEVICE_DT_INST_GET(inst), \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, sb_tsi_init, PM_DEVICE_DT_INST_GET(inst),\ &sb_tsi_data_##inst, &sb_tsi_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &sb_tsi_driver_api); + &sb_tsi_driver_api); DT_INST_FOREACH_STATUS_OKAY(SB_TSI_INST) diff --git a/drivers/sensor/amg88xx/amg88xx.c b/drivers/sensor/amg88xx/amg88xx.c index 30e4049dd0c7d..7892e5c0cc8a6 100644 --- a/drivers/sensor/amg88xx/amg88xx.c +++ b/drivers/sensor/amg88xx/amg88xx.c @@ -145,8 +145,8 @@ static const struct sensor_driver_api amg88xx_driver_api = { (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, { 0 }),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, amg88xx_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, amg88xx_init, NULL, \ &amg88xx_data_##inst, &amg88xx_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &amg88xx_driver_api); \ + &amg88xx_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(AMG88XX_DEFINE) diff --git a/drivers/sensor/ams/ams_as5600/ams_as5600.c b/drivers/sensor/ams/ams_as5600/ams_as5600.c index 68c9e2e90a779..847c9013d3f9b 100644 --- a/drivers/sensor/ams/ams_as5600/ams_as5600.c +++ b/drivers/sensor/ams/ams_as5600/ams_as5600.c @@ -92,9 +92,8 @@ static const struct sensor_driver_api as5600_driver_api = { .i2c_port = I2C_DT_SPEC_INST_GET(n) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, as5600_initialize, NULL, \ - &as5600_data##n, &as5600_cfg##n, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &as5600_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, as5600_initialize, NULL, \ + &as5600_data##n, &as5600_cfg##n, \ + POST_KERNEL, &as5600_driver_api); DT_INST_FOREACH_STATUS_OKAY(AS5600_INIT) diff --git a/drivers/sensor/ams/ams_iAQcore/iAQcore.c b/drivers/sensor/ams/ams_iAQcore/iAQcore.c index 7eea17f71d3e0..b48c5f1919dae 100644 --- a/drivers/sensor/ams/ams_iAQcore/iAQcore.c +++ b/drivers/sensor/ams/ams_iAQcore/iAQcore.c @@ -117,8 +117,8 @@ static int iaq_core_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, iaq_core_init, NULL, &iaq_core_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, iaq_core_init, NULL, &iaq_core_data_##inst,\ &iaq_core_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &iaq_core_driver_api); \ + &iaq_core_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(IAQ_CORE_DEFINE) diff --git a/drivers/sensor/ams/ccs811/ccs811.c b/drivers/sensor/ams/ccs811/ccs811.c index 83ee1957a3e17..55c4a2a69bebb 100644 --- a/drivers/sensor/ams/ccs811/ccs811.c +++ b/drivers/sensor/ams/ccs811/ccs811.c @@ -580,9 +580,8 @@ static int ccs811_init(const struct device *dev) .wake_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, wake_gpios, { 0 }), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(0, ccs811_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(0, ccs811_init, NULL, \ &ccs811_data_##inst, &ccs811_config_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &ccs811_driver_api); \ + POST_KERNEL, &ccs811_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(CCS811_DEFINE) diff --git a/drivers/sensor/ams/ens210/ens210.c b/drivers/sensor/ams/ens210/ens210.c index a6924c584f77e..f1d50b4ab47ed 100644 --- a/drivers/sensor/ams/ens210/ens210.c +++ b/drivers/sensor/ams/ens210/ens210.c @@ -344,8 +344,8 @@ static int ens210_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, ens210_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, ens210_init, NULL, \ &ens210_data_##inst, &ens210_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &en210_driver_api); \ + &en210_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(ENS210_DEFINE) diff --git a/drivers/sensor/ams/tcs3400/tcs3400.c b/drivers/sensor/ams/tcs3400/tcs3400.c index 367359056050b..3472b3679655e 100644 --- a/drivers/sensor/ams/tcs3400/tcs3400.c +++ b/drivers/sensor/ams/tcs3400/tcs3400.c @@ -296,9 +296,8 @@ static int tcs3400_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(n), \ .int_gpio = GPIO_DT_SPEC_INST_GET(n, int_gpios), \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(n, &tcs3400_init, NULL, \ - &tcs3400_data_##n, &tcs3400_config_##n, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &tcs3400_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, &tcs3400_init, NULL,\ + &tcs3400_data_##n, &tcs3400_config_##n,\ + POST_KERNEL, &tcs3400_api); DT_INST_FOREACH_STATUS_OKAY(TCS3400_INIT) diff --git a/drivers/sensor/ams/tmd2620/tmd2620.c b/drivers/sensor/ams/tmd2620/tmd2620.c index daa28d4be81f6..2eb230b6d078d 100644 --- a/drivers/sensor/ams/tmd2620/tmd2620.c +++ b/drivers/sensor/ams/tmd2620/tmd2620.c @@ -414,8 +414,8 @@ static const struct sensor_driver_api tmd2620_driver_api = { }; \ \ PM_DEVICE_DT_INST_DEFINE(n, tmd2620_pm_action); \ - SENSOR_DEVICE_DT_INST_DEFINE(n, tmd2620_init, PM_DEVICE_DT_INST_GET(n), &tmd2620_data_##n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, tmd2620_init, PM_DEVICE_DT_INST_GET(n), &tmd2620_data_##n,\ &tmd2620_config_##n, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &tmd2620_driver_api); + &tmd2620_driver_api); DT_INST_FOREACH_STATUS_OKAY(TMD2620_INIT_INST); diff --git a/drivers/sensor/ams/tsl2540/tsl2540.c b/drivers/sensor/ams/tsl2540/tsl2540.c index 2a24c8b180a21..07032ab02e885 100644 --- a/drivers/sensor/ams/tsl2540/tsl2540.c +++ b/drivers/sensor/ams/tsl2540/tsl2540.c @@ -382,8 +382,8 @@ static int tsl2540_pm_action(const struct device *dev, enum pm_device_action act TSL2540_GLASS_ATTEN(inst) \ }; \ PM_DEVICE_DT_INST_DEFINE(inst, tsl2540_pm_action); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, &tsl2540_init, PM_DEVICE_DT_INST_GET(inst), \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, &tsl2540_init, PM_DEVICE_DT_INST_GET(inst), \ &tsl2540_prv_data_##inst, &tsl2540_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &tsl2540_driver_api); + &tsl2540_driver_api); DT_INST_FOREACH_STATUS_OKAY(TSL2540_DEFINE) diff --git a/drivers/sensor/ams/tsl2561/tsl2561.c b/drivers/sensor/ams/tsl2561/tsl2561.c index 0e5c0209b6b19..e749a5e2cefc4 100644 --- a/drivers/sensor/ams/tsl2561/tsl2561.c +++ b/drivers/sensor/ams/tsl2561/tsl2561.c @@ -339,8 +339,8 @@ static int tsl2561_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(n), \ .integration_time = DT_INST_PROP(n, integration_time), \ .gain = DT_INST_PROP(n, gain)}; \ - SENSOR_DEVICE_DT_INST_DEFINE(n, tsl2561_init, NULL, &tsl2561_data_##n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, tsl2561_init, NULL, &tsl2561_data_##n, \ &tsl2561_config_##n, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &tsl2561_driver_api); + &tsl2561_driver_api); DT_INST_FOREACH_STATUS_OKAY(TSL2561_INIT_INST) diff --git a/drivers/sensor/ams/tsl2591/tsl2591.c b/drivers/sensor/ams/tsl2591/tsl2591.c index 59f7054938fb2..14f7f683a6cf6 100644 --- a/drivers/sensor/ams/tsl2591/tsl2591.c +++ b/drivers/sensor/ams/tsl2591/tsl2591.c @@ -528,8 +528,8 @@ static int tsl2591_pm_action(const struct device *dev, enum pm_device_action act IF_ENABLED(CONFIG_TSL2591_TRIGGER, \ (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(n, int_gpios, {0}),))}; \ PM_DEVICE_DT_INST_DEFINE(n, tsl2591_pm_action); \ - SENSOR_DEVICE_DT_INST_DEFINE(n, tsl2591_init, PM_DEVICE_DT_INST_GET(n), &tsl2591_data_##n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, tsl2591_init, PM_DEVICE_DT_INST_GET(n), &tsl2591_data_##n,\ &tsl2591_config_##n, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &tsl2591_driver_api); + &tsl2591_driver_api); DT_INST_FOREACH_STATUS_OKAY(TSL2591_INIT_INST) diff --git a/drivers/sensor/aosong/ags10/ags10.c b/drivers/sensor/aosong/ags10/ags10.c index e5d761bfdf451..9184f58dd865d 100644 --- a/drivers/sensor/aosong/ags10/ags10.c +++ b/drivers/sensor/aosong/ags10/ags10.c @@ -128,7 +128,7 @@ static const struct sensor_driver_api ags10_api = {.sample_fetch = ags10_sample_ .bus = I2C_DT_SPEC_INST_GET(n), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, ags10_init, NULL, &ags10_data_##n, &ags10_config_##n, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &ags10_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, ags10_init, NULL, &ags10_data_##n, &ags10_config_##n,\ + POST_KERNEL, &ags10_api); DT_INST_FOREACH_STATUS_OKAY(AGS10_INIT) diff --git a/drivers/sensor/aosong/dht/dht.c b/drivers/sensor/aosong/dht/dht.c index acfa541b5fcc5..16eb7e7c1327a 100644 --- a/drivers/sensor/aosong/dht/dht.c +++ b/drivers/sensor/aosong/dht/dht.c @@ -257,8 +257,8 @@ static int dht_init(const struct device *dev) .dio_gpio = GPIO_DT_SPEC_INST_GET(inst, dio_gpios), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, &dht_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, &dht_init, NULL, \ &dht_data_##inst, &dht_config_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &dht_api); \ + POST_KERNEL, &dht_api); \ DT_INST_FOREACH_STATUS_OKAY(DHT_DEFINE) diff --git a/drivers/sensor/aosong/dht20/dht20.c b/drivers/sensor/aosong/dht20/dht20.c index 1e0dbac12a542..629c3e3299f11 100644 --- a/drivers/sensor/aosong/dht20/dht20.c +++ b/drivers/sensor/aosong/dht20/dht20.c @@ -318,8 +318,8 @@ static const struct sensor_driver_api dht20_driver_api = {.sample_fetch = dht20_ \ static const struct dht20_config dht20_config_##n = {.bus = I2C_DT_SPEC_INST_GET(n)}; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, dht20_init, NULL, &dht20_data_##n, &dht20_config_##n, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &dht20_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, dht20_init, NULL, &dht20_data_##n, &dht20_config_##n,\ + POST_KERNEL, &dht20_driver_api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_DHT20) @@ -334,8 +334,8 @@ DT_INST_FOREACH_STATUS_OKAY(DEFINE_DHT20) \ static const struct dht20_config aht20_config_##n = {.bus = I2C_DT_SPEC_INST_GET(n)}; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, dht20_init, NULL, &aht20_data_##n, &aht20_config_##n, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &dht20_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, dht20_init, NULL, &aht20_data_##n, &aht20_config_##n,\ + POST_KERNEL, &dht20_driver_api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_AHT20) @@ -350,8 +350,8 @@ DT_INST_FOREACH_STATUS_OKAY(DEFINE_AHT20) \ static const struct dht20_config am2301b_config_##n = {.bus = I2C_DT_SPEC_INST_GET(n)}; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, dht20_init, NULL, &am2301b_data_##n, &am2301b_config_##n, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &dht20_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, dht20_init, NULL, &am2301b_data_##n, &am2301b_config_##n,\ + POST_KERNEL, &dht20_driver_api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_AM2301B) diff --git a/drivers/sensor/apds9253/apds9253.c b/drivers/sensor/apds9253/apds9253.c index 539b882998355..065c74b038054 100644 --- a/drivers/sensor/apds9253/apds9253.c +++ b/drivers/sensor/apds9253/apds9253.c @@ -246,8 +246,8 @@ static const struct sensor_driver_api apds9253_driver_api = { .ls_gain = DT_INST_PROP(n, gain), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, apds9253_init, NULL, &apds9253_data_##n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, apds9253_init, NULL, &apds9253_data_##n, \ &apds9253_config_##n, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &apds9253_driver_api); + &apds9253_driver_api); DT_INST_FOREACH_STATUS_OKAY(APDS9253_INIT) diff --git a/drivers/sensor/apds9306/apds9306.c b/drivers/sensor/apds9306/apds9306.c index 2c3ccc25d7330..e77dd06e6625f 100644 --- a/drivers/sensor/apds9306/apds9306.c +++ b/drivers/sensor/apds9306/apds9306.c @@ -364,8 +364,8 @@ static const struct sensor_driver_api apds9306_driver_api = { .frequency = DT_INST_PROP(inst, frequency), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, apds9306_init, NULL, &apds9306_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, apds9306_init, NULL, &apds9306_data_##inst, \ &apds9306_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &apds9306_driver_api); + &apds9306_driver_api); DT_INST_FOREACH_STATUS_OKAY(APDS9306) diff --git a/drivers/sensor/apds9960/apds9960.c b/drivers/sensor/apds9960/apds9960.c index c37baede45ef9..69056e240d4f5 100644 --- a/drivers/sensor/apds9960/apds9960.c +++ b/drivers/sensor/apds9960/apds9960.c @@ -524,6 +524,6 @@ static struct apds9960_data apds9960_data; PM_DEVICE_DT_INST_DEFINE(0, apds9960_pm_action); -SENSOR_DEVICE_DT_INST_DEFINE(0, apds9960_init, +SENSOR_DEVICE_INSTANCE_FROM_DT_INST(0, apds9960_init, PM_DEVICE_DT_INST_GET(0), &apds9960_data, &apds9960_config, - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &apds9960_driver_api); + POST_KERNEL, &apds9960_driver_api); diff --git a/drivers/sensor/asahi_kasei/ak8975/ak8975.c b/drivers/sensor/asahi_kasei/ak8975/ak8975.c index d23c107d080fe..2de5839fa20da 100644 --- a/drivers/sensor/asahi_kasei/ak8975/ak8975.c +++ b/drivers/sensor/asahi_kasei/ak8975/ak8975.c @@ -149,9 +149,8 @@ int ak8975_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, ak8975_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, ak8975_init, NULL, \ &ak8975_data_##inst, &ak8975_config_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &ak8975_driver_api); \ + POST_KERNEL, &ak8975_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(AK8975_DEFINE) diff --git a/drivers/sensor/asahi_kasei/akm09918c/akm09918c.c b/drivers/sensor/asahi_kasei/akm09918c/akm09918c.c index 19bb837cc09c9..c00f459dbea0b 100644 --- a/drivers/sensor/asahi_kasei/akm09918c/akm09918c.c +++ b/drivers/sensor/asahi_kasei/akm09918c/akm09918c.c @@ -255,8 +255,8 @@ static const struct sensor_driver_api akm09918c_driver_api = { .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, akm09918c_init, NULL, &akm09918c_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, akm09918c_init, NULL, &akm09918c_data_##inst, \ &akm09918c_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &akm09918c_driver_api); + &akm09918c_driver_api); DT_INST_FOREACH_STATUS_OKAY(AKM09918C_DEFINE) diff --git a/drivers/sensor/bosch/bma280/bma280.c b/drivers/sensor/bosch/bma280/bma280.c index 2ba6fb5c4735c..1e9c52c4caf1f 100644 --- a/drivers/sensor/bosch/bma280/bma280.c +++ b/drivers/sensor/bosch/bma280/bma280.c @@ -171,8 +171,8 @@ int bma280_init(const struct device *dev) (.int1_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int1_gpios, { 0 }),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, bma280_init, NULL, &bma280_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, bma280_init, NULL, &bma280_data_##inst, \ &bma280_config##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &bma280_driver_api); \ + &bma280_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(BMA280_DEFINE) diff --git a/drivers/sensor/bosch/bma4xx/bma4xx.c b/drivers/sensor/bosch/bma4xx/bma4xx.c index e953e33130e85..356ebaf4ec9e2 100644 --- a/drivers/sensor/bosch/bma4xx/bma4xx.c +++ b/drivers/sensor/bosch/bma4xx/bma4xx.c @@ -717,8 +717,8 @@ static const struct sensor_driver_api bma4xx_driver_api = { static const struct bma4xx_config bma4xx_config_##inst = COND_CODE_1( \ DT_INST_ON_BUS(inst, spi), (BMA4XX_CONFIG_SPI(inst)), (BMA4XX_CONFIG_I2C(inst))); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, bma4xx_chip_init, NULL, &bma4xx_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, bma4xx_chip_init, NULL, &bma4xx_data_##inst, \ &bma4xx_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &bma4xx_driver_api); + &bma4xx_driver_api); DT_INST_FOREACH_STATUS_OKAY(BMA4XX_DEFINE) diff --git a/drivers/sensor/bosch/bmc150_magn/bmc150_magn.c b/drivers/sensor/bosch/bmc150_magn/bmc150_magn.c index 32b0cf8f25b8f..bd0d05ad52529 100644 --- a/drivers/sensor/bosch/bmc150_magn/bmc150_magn.c +++ b/drivers/sensor/bosch/bmc150_magn/bmc150_magn.c @@ -596,8 +596,8 @@ static int bmc150_magn_init(const struct device *dev) (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, drdy_gpios, { 0 }),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, bmc150_magn_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, bmc150_magn_init, NULL, \ &bmc150_magn_data_##inst, &bmc150_magn_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &bmc150_magn_api_funcs); \ + &bmc150_magn_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(BMC150_MAGN_DEFINE) diff --git a/drivers/sensor/bosch/bme280/bme280.c b/drivers/sensor/bosch/bme280/bme280.c index acbb48152c2d6..01929e9f6add4 100644 --- a/drivers/sensor/bosch/bme280/bme280.c +++ b/drivers/sensor/bosch/bme280/bme280.c @@ -446,13 +446,12 @@ static int bme280_pm_action(const struct device *dev, \ PM_DEVICE_DT_INST_DEFINE(inst, bme280_pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ bme280_chip_init, \ PM_DEVICE_DT_INST_GET(inst), \ &bme280_data_##inst, \ &bme280_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &bme280_api_funcs); /* Create the struct device for every status "okay" node in the devicetree. */ diff --git a/drivers/sensor/bosch/bme680/bme680.c b/drivers/sensor/bosch/bme680/bme680.c index 27ee31341576a..7ec92d020bcf2 100644 --- a/drivers/sensor/bosch/bme680/bme680.c +++ b/drivers/sensor/bosch/bme680/bme680.c @@ -509,13 +509,12 @@ static const struct sensor_driver_api bme680_api_funcs = { (BME680_CONFIG_SPI(inst)), \ (BME680_CONFIG_I2C(inst))); \ PM_DEVICE_DT_INST_DEFINE(inst, bme680_pm_control); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ bme680_init, \ PM_DEVICE_DT_INST_GET(inst), \ &bme680_data_##inst, \ &bme680_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &bme680_api_funcs); /* Create the struct device for every status "okay" node in the devicetree. */ diff --git a/drivers/sensor/bosch/bmg160/bmg160.c b/drivers/sensor/bosch/bmg160/bmg160.c index 22602a11c89e5..140b7570de60e 100644 --- a/drivers/sensor/bosch/bmg160/bmg160.c +++ b/drivers/sensor/bosch/bmg160/bmg160.c @@ -350,8 +350,8 @@ int bmg160_init(const struct device *dev) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, bmg160_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, bmg160_init, NULL, \ &bmg160_data_##inst, &bmg160_config_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &bmg160_api); \ + POST_KERNEL, &bmg160_api); \ DT_INST_FOREACH_STATUS_OKAY(BMG160_DEFINE) diff --git a/drivers/sensor/bosch/bmi08x/bmi08x_accel.c b/drivers/sensor/bosch/bmi08x/bmi08x_accel.c index d2a69b7c98901..350ce54d9edca 100644 --- a/drivers/sensor/bosch/bmi08x/bmi08x_accel.c +++ b/drivers/sensor/bosch/bmi08x/bmi08x_accel.c @@ -804,9 +804,9 @@ int bmi08x_accel_init(const struct device *dev) .accel_fs = DT_INST_PROP(inst, accel_fs), BMI08X_DATA_SYNC_REG(inst)}; \ \ PM_DEVICE_DT_INST_DEFINE(inst, bmi08x_accel_pm_action); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, bmi08x_accel_init, PM_DEVICE_DT_INST_GET(inst), \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, bmi08x_accel_init, PM_DEVICE_DT_INST_GET(inst), \ &bmi08x_drv_##inst, &bmi08x_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &bmi08x_api); + &bmi08x_api); /* Create the struct device for every status "okay" node in the devicetree. */ DT_INST_FOREACH_STATUS_OKAY(BMI08X_CREATE_INST) diff --git a/drivers/sensor/bosch/bmi08x/bmi08x_gyro.c b/drivers/sensor/bosch/bmi08x/bmi08x_gyro.c index e9463d170796c..9228ee64fd566 100644 --- a/drivers/sensor/bosch/bmi08x/bmi08x_gyro.c +++ b/drivers/sensor/bosch/bmi08x/bmi08x_gyro.c @@ -476,9 +476,9 @@ BUILD_ASSERT(CONFIG_BMI08X_GYRO_TRIGGER_NONE, }; \ \ PM_DEVICE_DT_INST_DEFINE(inst, bmi08x_gyro_pm_action); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, bmi08x_gyro_init, PM_DEVICE_DT_INST_GET(inst), \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, bmi08x_gyro_init, PM_DEVICE_DT_INST_GET(inst), \ &bmi08x_drv_##inst, &bmi08x_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &bmi08x_api); + &bmi08x_api); /* Create the struct device for every status "okay" node in the devicetree. */ DT_INST_FOREACH_STATUS_OKAY(BMI08X_CREATE_INST) diff --git a/drivers/sensor/bosch/bmi160/bmi160.c b/drivers/sensor/bosch/bmi160/bmi160.c index 8f19cedac7809..65b156deba1b2 100644 --- a/drivers/sensor/bosch/bmi160/bmi160.c +++ b/drivers/sensor/bosch/bmi160/bmi160.c @@ -1192,10 +1192,10 @@ int bmi160_pm(const struct device *dev, enum pm_device_action action) #define BMI160_DEVICE_INIT(inst) \ IF_ENABLED(CONFIG_PM_DEVICE_RUNTIME, (PM_DEVICE_DT_INST_DEFINE(inst, bmi160_pm))); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, bmi160_init, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, bmi160_init, \ COND_CODE_1(CONFIG_PM_DEVICE_RUNTIME, (PM_DEVICE_DT_INST_GET(inst)), (NULL)), \ &bmi160_data_##inst, &bmi160_cfg_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ + POST_KERNEL, \ &bmi160_api); /* Instantiation macros used when a device is on a SPI bus */ diff --git a/drivers/sensor/bosch/bmi270/bmi270.c b/drivers/sensor/bosch/bmi270/bmi270.c index 33daf00dbf047..e9157eae38636 100644 --- a/drivers/sensor/bosch/bmi270/bmi270.c +++ b/drivers/sensor/bosch/bmi270/bmi270.c @@ -828,13 +828,12 @@ static const struct bmi270_feature_config bmi270_feature_base = { BMI270_CONFIG_INT(inst) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ bmi270_init, \ NULL, \ &bmi270_drv_##inst, \ &bmi270_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &bmi270_driver_api); DT_INST_FOREACH_STATUS_OKAY(BMI270_CREATE_INST); diff --git a/drivers/sensor/bosch/bmi323/bmi323.c b/drivers/sensor/bosch/bmi323/bmi323.c index 65bdef619ec84..71e3e2e7f9222 100644 --- a/drivers/sensor/bosch/bmi323/bmi323.c +++ b/drivers/sensor/bosch/bmi323/bmi323.c @@ -1342,8 +1342,8 @@ static int bosch_bmi323_init(const struct device *dev) \ PM_DEVICE_DT_INST_DEFINE(inst, bosch_bmi323_pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, bosch_bmi323_init, PM_DEVICE_DT_INST_GET(inst), \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, bosch_bmi323_init, PM_DEVICE_DT_INST_GET(inst), \ &bosch_bmi323_data_##inst, &bosch_bmi323_config_##inst, \ - POST_KERNEL, 99, &bosch_bmi323_api); + POST_KERNEL, &bosch_bmi323_api); DT_INST_FOREACH_STATUS_OKAY(BMI323_DEVICE) diff --git a/drivers/sensor/bosch/bmm150/bmm150.c b/drivers/sensor/bosch/bmm150/bmm150.c index b3c04c7680fba..ab5d192bb0046 100644 --- a/drivers/sensor/bosch/bmm150/bmm150.c +++ b/drivers/sensor/bosch/bmm150/bmm150.c @@ -730,13 +730,12 @@ static int bmm150_init(const struct device *dev) \ PM_DEVICE_DT_INST_DEFINE(inst, pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ bmm150_init, \ PM_DEVICE_DT_INST_GET(inst), \ &bmm150_data_##inst, \ &bmm150_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &bmm150_api_funcs); /* Create the struct device for every status "okay" node in the devicetree. */ diff --git a/drivers/sensor/bosch/bmp180/bmp180.c b/drivers/sensor/bosch/bmp180/bmp180.c index 752f605463a6e..b900487bc776e 100644 --- a/drivers/sensor/bosch/bmp180/bmp180.c +++ b/drivers/sensor/bosch/bmp180/bmp180.c @@ -467,9 +467,8 @@ static int bmp180_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst),\ };\ PM_DEVICE_DT_INST_DEFINE(inst, bmp180_pm_action);\ - SENSOR_DEVICE_DT_INST_DEFINE(inst, bmp180_init, PM_DEVICE_DT_INST_GET(inst),\ - &bmp180_data_##inst, &bmp180_config_##inst,\ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY,\ - &bmp180_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, bmp180_init, PM_DEVICE_DT_INST_GET(inst),\ + &bmp180_data_##inst, &bmp180_config_##inst, \ + POST_KERNEL, &bmp180_api); DT_INST_FOREACH_STATUS_OKAY(BMP180_INST) diff --git a/drivers/sensor/bosch/bmp388/bmp388.c b/drivers/sensor/bosch/bmp388/bmp388.c index 1033db00035d4..4dfd65d68bd11 100644 --- a/drivers/sensor/bosch/bmp388/bmp388.c +++ b/drivers/sensor/bosch/bmp388/bmp388.c @@ -588,9 +588,9 @@ static int bmp388_init(const struct device *dev) .iir_filter = DT_INST_ENUM_IDX(inst, iir_filter),\ };\ PM_DEVICE_DT_INST_DEFINE(inst, bmp388_pm_action);\ - SENSOR_DEVICE_DT_INST_DEFINE(inst, bmp388_init, PM_DEVICE_DT_INST_GET(inst),\ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, bmp388_init, PM_DEVICE_DT_INST_GET(inst),\ &bmp388_data_##inst##chipid, &bmp388_config_##inst##chipid,\ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &bmp388_api); + POST_KERNEL, &bmp388_api); #define DT_DRV_COMPAT bosch_bmp388 DT_INST_FOREACH_STATUS_OKAY_VARGS(BMP3XX_INST, BMP388_ID) diff --git a/drivers/sensor/bosch/bmp581/bmp581.c b/drivers/sensor/bosch/bmp581/bmp581.c index 9989f51d0ad5b..acc34924b5ffd 100644 --- a/drivers/sensor/bosch/bmp581/bmp581.c +++ b/drivers/sensor/bosch/bmp581/bmp581.c @@ -553,8 +553,7 @@ static const struct sensor_driver_api bmp581_driver_api = {.sample_fetch = bmp58 static struct bmp581_data bmp581_data_##i; \ BMP581_CONFIG(i); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(i, bmp581_init, NULL, &bmp581_data_##i, &bmp581_config_##i, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &bmp581_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(i, bmp581_init, NULL, &bmp581_data_##i, &bmp581_config_##i,\ + POST_KERNEL, &bmp581_driver_api); DT_INST_FOREACH_STATUS_OKAY(BMP581_INIT) diff --git a/drivers/sensor/current_amp/current_amp.c b/drivers/sensor/current_amp/current_amp.c index f5d37fc70553a..f692cfff7b443 100644 --- a/drivers/sensor/current_amp/current_amp.c +++ b/drivers/sensor/current_amp/current_amp.c @@ -165,8 +165,8 @@ static int current_init(const struct device *dev) \ PM_DEVICE_DT_INST_DEFINE(inst, pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, ¤t_init, PM_DEVICE_DT_INST_GET(inst), \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, ¤t_init, PM_DEVICE_DT_INST_GET(inst), \ ¤t_amp_##inst##_data, ¤t_amp_##inst##_config, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, ¤t_api); + POST_KERNEL, ¤t_api); DT_INST_FOREACH_STATUS_OKAY(CURRENT_SENSE_AMPLIFIER_INIT) diff --git a/drivers/sensor/ene_tach_kb1200/tach_ene_kb1200.c b/drivers/sensor/ene_tach_kb1200/tach_ene_kb1200.c index d7493109e4722..6f515b2c48276 100644 --- a/drivers/sensor/ene_tach_kb1200/tach_ene_kb1200.c +++ b/drivers/sensor/ene_tach_kb1200/tach_ene_kb1200.c @@ -136,8 +136,7 @@ static const struct sensor_driver_api tach_kb1200_driver_api = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ }; \ static struct tach_kb1200_data tach_data_##inst; \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, tach_kb1200_init, NULL, &tach_data_##inst, \ - &tach_cfg_##inst, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &tach_kb1200_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, tach_kb1200_init, NULL, &tach_data_##inst, \ + &tach_cfg_##inst, POST_KERNEL, &tach_kb1200_driver_api); DT_INST_FOREACH_STATUS_OKAY(KB1200_TACH_INIT) diff --git a/drivers/sensor/ens160/ens160.c b/drivers/sensor/ens160/ens160.c index c5420b7cd39d5..761eaf96ddd18 100644 --- a/drivers/sensor/ens160/ens160.c +++ b/drivers/sensor/ens160/ens160.c @@ -323,8 +323,8 @@ static int ens160_pm_action(const struct device *dev, enum pm_device_action acti }; \ \ PM_DEVICE_DT_INST_DEFINE(inst, ens160_pm_action); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, ens160_init, PM_DEVICE_DT_INST_GET(inst), \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, ens160_init, PM_DEVICE_DT_INST_GET(inst), \ &ens160_data_##inst, &ens160_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &ens160_driver_api); + &ens160_driver_api); DT_INST_FOREACH_STATUS_OKAY(ENS160_DEFINE) diff --git a/drivers/sensor/espressif/esp32_temp/esp32_temp.c b/drivers/sensor/espressif/esp32_temp/esp32_temp.c index 3c9c289d8ed33..9604ab5da66b6 100644 --- a/drivers/sensor/espressif/esp32_temp/esp32_temp.c +++ b/drivers/sensor/espressif/esp32_temp/esp32_temp.c @@ -91,9 +91,8 @@ static int esp32_temp_init(const struct device *dev) .range = (temp_sensor_dac_offset_t) DT_INST_PROP(inst, range), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, esp32_temp_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, esp32_temp_init, NULL, \ &esp32_temp_dev_data_##inst, &esp32_temp_dev_config_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &esp32_temp_driver_api); \ + POST_KERNEL, &esp32_temp_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(ESP32_TEMP_DEFINE) diff --git a/drivers/sensor/espressif/pcnt_esp32/pcnt_esp32.c b/drivers/sensor/espressif/pcnt_esp32/pcnt_esp32.c index 75a6eefa6fc1b..7ac29b4dee197 100644 --- a/drivers/sensor/espressif/pcnt_esp32/pcnt_esp32.c +++ b/drivers/sensor/espressif/pcnt_esp32/pcnt_esp32.c @@ -421,9 +421,8 @@ static struct pcnt_esp32_data pcnt_esp32_data = { #endif /* CONFIG_PCNT_ESP32_TRIGGER */ }; -SENSOR_DEVICE_DT_INST_DEFINE(0, &pcnt_esp32_init, NULL, +SENSOR_DEVICE_INSTANCE_FROM_DT_INST(0, &pcnt_esp32_init, NULL, &pcnt_esp32_data, &pcnt_esp32_config, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &pcnt_esp32_api); diff --git a/drivers/sensor/explorir_m/explorir_m.c b/drivers/sensor/explorir_m/explorir_m.c index 4744e77860df1..2676ae9c99e06 100644 --- a/drivers/sensor/explorir_m/explorir_m.c +++ b/drivers/sensor/explorir_m/explorir_m.c @@ -381,8 +381,8 @@ static int explorir_m_init(const struct device *dev) .cb = explorir_m_uart_isr, \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, explorir_m_init, NULL, &explorir_m_data_##n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, explorir_m_init, NULL, &explorir_m_data_##n, \ &explorir_m_cfg_##n, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &explorir_m_api_funcs); + &explorir_m_api_funcs); DT_INST_FOREACH_STATUS_OKAY(EXPLORIR_M_INIT) diff --git a/drivers/sensor/f75303/f75303.c b/drivers/sensor/f75303/f75303.c index dd656fc26e062..f5728b86eed12 100644 --- a/drivers/sensor/f75303/f75303.c +++ b/drivers/sensor/f75303/f75303.c @@ -191,8 +191,8 @@ static int f75303_pm_action(const struct device *dev, enum pm_device_action acti .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ PM_DEVICE_DT_INST_DEFINE(inst, f75303_pm_action); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, f75303_init, PM_DEVICE_DT_INST_GET(inst), \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, f75303_init, PM_DEVICE_DT_INST_GET(inst),\ &f75303_data_##inst, &f75303_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &f75303_driver_api); + &f75303_driver_api); DT_INST_FOREACH_STATUS_OKAY(F75303_INST) diff --git a/drivers/sensor/fcx_mldx5/fcx_mldx5.c b/drivers/sensor/fcx_mldx5/fcx_mldx5.c index a6f5ba3866c0e..455967c53fc45 100644 --- a/drivers/sensor/fcx_mldx5/fcx_mldx5.c +++ b/drivers/sensor/fcx_mldx5/fcx_mldx5.c @@ -489,8 +489,8 @@ static int fcx_mldx5_init(const struct device *dev) \ PM_DEVICE_DT_INST_DEFINE(n, pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, fcx_mldx5_init, PM_DEVICE_DT_INST_GET(n), \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, fcx_mldx5_init, PM_DEVICE_DT_INST_GET(n), \ &fcx_mldx5_data_##n, &fcx_mldx5_cfg_##n, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &fcx_mldx5_api_funcs); + &fcx_mldx5_api_funcs); DT_INST_FOREACH_STATUS_OKAY(FCX_MLDX5_INIT) diff --git a/drivers/sensor/grow_r502a/grow_r502a.c b/drivers/sensor/grow_r502a/grow_r502a.c index 15714314b95f4..8882f13b0c0c2 100644 --- a/drivers/sensor/grow_r502a/grow_r502a.c +++ b/drivers/sensor/grow_r502a/grow_r502a.c @@ -1238,14 +1238,14 @@ static const struct led_driver_api grow_r502a_leds_api = { (.int_gpios = GPIO_DT_SPEC_INST_GET_OR(index, int_gpios, {}),)) \ }; \ \ - DEVICE_DT_INST_DEFINE(index, &grow_r502a_init, NULL, &grow_r502a_data_##index, \ + DEVICE_INSTANCE_FROM_DT_INST(index, &grow_r502a_init, NULL, &grow_r502a_data_##index, \ &grow_r502a_config_##index, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &grow_r502a_api); \ + &grow_r502a_api); \ #define GROW_R502A_LED_INIT(index) \ - DEVICE_DT_INST_DEFINE(index, NULL, NULL, &grow_r502a_data_##index, \ + DEVICE_INSTANCE_FROM_DT_INST(index, NULL, NULL, &grow_r502a_data_##index, \ &grow_r502a_config_##index, POST_KERNEL, \ - CONFIG_LED_INIT_PRIORITY, &grow_r502a_leds_api); \ + &grow_r502a_leds_api); \ #define DT_DRV_COMPAT hzgrow_r502a DT_INST_FOREACH_STATUS_OKAY(GROW_R502A_INIT) diff --git a/drivers/sensor/honeywell/hmc5883l/hmc5883l.c b/drivers/sensor/honeywell/hmc5883l/hmc5883l.c index 053b431ba0e4d..bd53366dc78cb 100644 --- a/drivers/sensor/honeywell/hmc5883l/hmc5883l.c +++ b/drivers/sensor/honeywell/hmc5883l/hmc5883l.c @@ -167,8 +167,8 @@ int hmc5883l_init(const struct device *dev) (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, { 0 }),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, hmc5883l_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, hmc5883l_init, NULL, \ &hmc5883l_data_##inst, &hmc5883l_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &hmc5883l_driver_api); \ + &hmc5883l_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(HMC5883L_DEFINE) diff --git a/drivers/sensor/honeywell/mpr/mpr.c b/drivers/sensor/honeywell/mpr/mpr.c index c01a16c84634d..214bcb187e1a0 100644 --- a/drivers/sensor/honeywell/mpr/mpr.c +++ b/drivers/sensor/honeywell/mpr/mpr.c @@ -139,8 +139,8 @@ static const struct sensor_driver_api mpr_api_funcs = { .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, mpr_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, mpr_init, NULL, \ &mpr_data_##inst, &mpr_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &mpr_api_funcs); \ + &mpr_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(MPR_DEFINE) diff --git a/drivers/sensor/honeywell/sm351lt/sm351lt.c b/drivers/sensor/honeywell/sm351lt/sm351lt.c index 7ec8325315227..f5e218e23e4f2 100644 --- a/drivers/sensor/honeywell/sm351lt/sm351lt.c +++ b/drivers/sensor/honeywell/sm351lt/sm351lt.c @@ -249,13 +249,12 @@ static int sm351lt_init(const struct device *dev) .int_gpio = GPIO_DT_SPEC_INST_GET(inst, gpios), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ sm351lt_init, \ NULL, \ &sm351lt_data_##inst, \ &sm351lt_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &sm351lt_api_funcs); diff --git a/drivers/sensor/hp206c/hp206c.c b/drivers/sensor/hp206c/hp206c.c index 29fd751143fb9..2ae92006a7ba5 100644 --- a/drivers/sensor/hp206c/hp206c.c +++ b/drivers/sensor/hp206c/hp206c.c @@ -320,8 +320,8 @@ static int hp206c_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, hp206c_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, hp206c_init, NULL, \ &hp206c_data_##inst, &hp206c_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &hp206c_api); \ + &hp206c_api); \ DT_INST_FOREACH_STATUS_OKAY(HP206C_DEFINE) diff --git a/drivers/sensor/infineon/dps310/dps310.c b/drivers/sensor/infineon/dps310/dps310.c index 3d91f5a7c48cb..abd9355e8d75a 100644 --- a/drivers/sensor/infineon/dps310/dps310.c +++ b/drivers/sensor/infineon/dps310/dps310.c @@ -721,8 +721,8 @@ static const struct sensor_driver_api dps310_api_funcs = { .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, dps310_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, dps310_init, NULL, \ &dps310_data_##inst, &dps310_cfg_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &dps310_api_funcs); \ + &dps310_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(DPS310_DEFINE) diff --git a/drivers/sensor/infineon/tle9104/tle9104_diagnostics.c b/drivers/sensor/infineon/tle9104/tle9104_diagnostics.c index d1c820ab115bb..63a70833cc8b0 100644 --- a/drivers/sensor/infineon/tle9104/tle9104_diagnostics.c +++ b/drivers/sensor/infineon/tle9104/tle9104_diagnostics.c @@ -88,9 +88,8 @@ int tle9104_diagnostics_init(const struct device *dev) .parent = DEVICE_DT_GET(DT_PARENT(DT_DRV_INST(inst))), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE( \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST( \ inst, tle9104_diagnostics_init, NULL, &tle9104_diagnostics_data_##inst, \ - &tle9104_diagnostics_config##inst, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &tle9104_diagnostics_driver_api); + &tle9104_diagnostics_config##inst, POST_KERNEL, &tle9104_diagnostics_driver_api); DT_INST_FOREACH_STATUS_OKAY(TLE9104_DIAGNOSTICS_DEFINE) diff --git a/drivers/sensor/infineon/xmc4xxx_temp/xmc4xxx_temp.c b/drivers/sensor/infineon/xmc4xxx_temp/xmc4xxx_temp.c index ea4ce1ee4cc7f..622aa592a655c 100644 --- a/drivers/sensor/infineon/xmc4xxx_temp/xmc4xxx_temp.c +++ b/drivers/sensor/infineon/xmc4xxx_temp/xmc4xxx_temp.c @@ -81,9 +81,8 @@ static int xmc4xxx_temp_init(const struct device *dev) #define XMC4XXX_TEMP_DEFINE(inst) \ static struct xmc4xxx_temp_data xmc4xxx_temp_dev_data_##inst; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, xmc4xxx_temp_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, xmc4xxx_temp_init, NULL, \ &xmc4xxx_temp_dev_data_##inst, NULL, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &xmc4xxx_temp_driver_api); \ + POST_KERNEL, &xmc4xxx_temp_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(XMC4XXX_TEMP_DEFINE) diff --git a/drivers/sensor/ist8310/ist8310.c b/drivers/sensor/ist8310/ist8310.c index 764af30cb4332..fe07f6699e5eb 100644 --- a/drivers/sensor/ist8310/ist8310.c +++ b/drivers/sensor/ist8310/ist8310.c @@ -213,9 +213,9 @@ static int ist8310_init(const struct device *dev) static struct ist8310_data ist8310_data_##inst; \ static const struct ist8310_config ist8310_config_##inst = {IST8310_BUS_CFG(inst)}; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, ist8310_init, NULL, &ist8310_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, ist8310_init, NULL, &ist8310_data_##inst, \ &ist8310_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &ist8310_api_funcs); + &ist8310_api_funcs); /* Create the struct device for every status "okay" node in the devicetree. */ DT_INST_FOREACH_STATUS_OKAY(IST8310_DEFINE) diff --git a/drivers/sensor/ite/ite_tach_it8xxx2/tach_ite_it8xxx2.c b/drivers/sensor/ite/ite_tach_it8xxx2/tach_ite_it8xxx2.c index 6dc0926cc8e57..c0dd8b1eebea8 100644 --- a/drivers/sensor/ite/ite_tach_it8xxx2/tach_ite_it8xxx2.c +++ b/drivers/sensor/ite/ite_tach_it8xxx2/tach_ite_it8xxx2.c @@ -234,13 +234,12 @@ static const struct sensor_driver_api tach_it8xxx2_driver_api = { \ static struct tach_it8xxx2_data tach_it8xxx2_data_##inst; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ - tach_it8xxx2_init, \ - NULL, \ - &tach_it8xxx2_data_##inst, \ - &tach_it8xxx2_cfg_##inst, \ - POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ + tach_it8xxx2_init, \ + NULL, \ + &tach_it8xxx2_data_##inst, \ + &tach_it8xxx2_cfg_##inst, \ + POST_KERNEL, \ &tach_it8xxx2_driver_api); DT_INST_FOREACH_STATUS_OKAY(TACH_IT8XXX2_INIT) diff --git a/drivers/sensor/ite/ite_vcmp_it8xxx2/vcmp_ite_it8xxx2.c b/drivers/sensor/ite/ite_vcmp_it8xxx2/vcmp_ite_it8xxx2.c index 3a40c574a7f8d..559acf214da5d 100644 --- a/drivers/sensor/ite/ite_vcmp_it8xxx2/vcmp_ite_it8xxx2.c +++ b/drivers/sensor/ite/ite_vcmp_it8xxx2/vcmp_ite_it8xxx2.c @@ -407,13 +407,12 @@ SYS_INIT(vcmp_it8xxx2_init_work_q, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY); .adc_ch_cfg.channel_id = (uint8_t)DT_INST_IO_CHANNELS_INPUT(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ vcmp_it8xxx2_init, \ NULL, \ &vcmp_it8xxx2_data_##inst, \ &vcmp_it8xxx2_cfg_##inst, \ POST_KERNEL, \ - CONFIG_VCMP_IT8XXX2_INIT_PRIORITY, \ &vcmp_ite_it8xxx2_api); DT_INST_FOREACH_STATUS_OKAY(VCMP_IT8XXX2_INIT) diff --git a/drivers/sensor/jedec/jc42/jc42.c b/drivers/sensor/jedec/jc42/jc42.c index 8d1e87abeae99..6182f2a81e59c 100644 --- a/drivers/sensor/jedec/jc42/jc42.c +++ b/drivers/sensor/jedec/jc42/jc42.c @@ -132,8 +132,8 @@ int jc42_init(const struct device *dev) IF_ENABLED(CONFIG_JC42_TRIGGER, \ (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, {0}),))}; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, jc42_init, NULL, &jc42_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, jc42_init, NULL, &jc42_data_##inst, \ &jc42_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &jc42_api_funcs); + &jc42_api_funcs); DT_INST_FOREACH_STATUS_OKAY(JC42_DEFINE) diff --git a/drivers/sensor/lm35/lm35.c b/drivers/sensor/lm35/lm35.c index 576741f937b44..0fe453ae1030f 100644 --- a/drivers/sensor/lm35/lm35.c +++ b/drivers/sensor/lm35/lm35.c @@ -103,7 +103,7 @@ static int lm35_init(const struct device *dev) .channel_id = DT_INST_IO_CHANNELS_INPUT(inst), \ }}; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, lm35_init, NULL, &lm35_data_##inst, &lm35_cfg_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &lm35_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, lm35_init, NULL, &lm35_data_##inst, &lm35_cfg_##inst,\ + POST_KERNEL, &lm35_driver_api); DT_INST_FOREACH_STATUS_OKAY(LM35_INST) diff --git a/drivers/sensor/lm75/lm75.c b/drivers/sensor/lm75/lm75.c index dc6f7924b6f57..0e887647930dc 100644 --- a/drivers/sensor/lm75/lm75.c +++ b/drivers/sensor/lm75/lm75.c @@ -421,8 +421,8 @@ static const struct lm75_config lm75_config_##inst = { \ LM75_INT_GPIO_INIT(inst) \ }; \ PM_DEVICE_DT_INST_DEFINE(inst, lm75_pm_action); \ -SENSOR_DEVICE_DT_INST_DEFINE(inst, lm75_init, PM_DEVICE_DT_INST_GET(inst), &lm75_data_##inst, \ - &lm75_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &lm75_driver_api); +SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, lm75_init, PM_DEVICE_DT_INST_GET(inst), &lm75_data_##inst,\ + &lm75_config_##inst, POST_KERNEL, \ + &lm75_driver_api); DT_INST_FOREACH_STATUS_OKAY(LM75_INST) diff --git a/drivers/sensor/lm77/lm77.c b/drivers/sensor/lm77/lm77.c index 1b0b6fb17cb93..1ad2c243b5717 100644 --- a/drivers/sensor/lm77/lm77.c +++ b/drivers/sensor/lm77/lm77.c @@ -413,11 +413,10 @@ static int lm77_pm_action(const struct device *dev, \ PM_DEVICE_DT_INST_DEFINE(n, lm77_pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, lm77_init, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, lm77_init, \ PM_DEVICE_DT_INST_GET(n), \ &lm77_data_##n, \ &lm77_config_##n, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &lm77_driver_api); DT_INST_FOREACH_STATUS_OKAY(LM77_INIT) diff --git a/drivers/sensor/ltrf216a/ltrf216a.c b/drivers/sensor/ltrf216a/ltrf216a.c index ada5e8b08ec52..ae83492119806 100644 --- a/drivers/sensor/ltrf216a/ltrf216a.c +++ b/drivers/sensor/ltrf216a/ltrf216a.c @@ -169,8 +169,8 @@ static int ltrf216a_chip_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, ltrf216a_chip_init, NULL, <rf216a_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, ltrf216a_chip_init, NULL, <rf216a_data_##inst, \ <rf216a_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, <rf216a_driver_api); + <rf216a_driver_api); DT_INST_FOREACH_STATUS_OKAY(LTRF216A_DEFINE) diff --git a/drivers/sensor/maxim/ds18b20/ds18b20.c b/drivers/sensor/maxim/ds18b20/ds18b20.c index 138eed0e93f1a..cd2b00cb1b0b2 100644 --- a/drivers/sensor/maxim/ds18b20/ds18b20.c +++ b/drivers/sensor/maxim/ds18b20/ds18b20.c @@ -347,13 +347,12 @@ static int ds18b20_init(const struct device *dev) static struct ds18b20_data data_##name##_##inst; \ static const struct ds18b20_config config_##name##_##inst = \ DS18B20_CONFIG_INIT(inst, family_code, chip_type); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ ds18b20_init, \ NULL, \ &data_##name##_##inst, \ &config_##name##_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &ds18b20_driver_api); #define DT_DRV_COMPAT maxim_ds18b20 diff --git a/drivers/sensor/maxim/max17055/max17055.c b/drivers/sensor/maxim/max17055/max17055.c index 139cef36a5d9a..e8974cbc58433 100644 --- a/drivers/sensor/maxim/max17055/max17055.c +++ b/drivers/sensor/maxim/max17055/max17055.c @@ -488,11 +488,10 @@ static const struct sensor_driver_api max17055_battery_driver_api = { .v_empty = DT_INST_PROP(index, v_empty), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(index, &max17055_gauge_init, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(index, &max17055_gauge_init, \ NULL, \ &max17055_driver_##index, \ &max17055_config_##index, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &max17055_battery_driver_api) DT_INST_FOREACH_STATUS_OKAY(MAX17055_INIT); diff --git a/drivers/sensor/maxim/max17262/max17262.c b/drivers/sensor/maxim/max17262/max17262.c index 5c8429484df8f..1f87a94bb98d7 100644 --- a/drivers/sensor/maxim/max17262/max17262.c +++ b/drivers/sensor/maxim/max17262/max17262.c @@ -382,8 +382,8 @@ static const struct sensor_driver_api max17262_battery_driver_api = { .charge_voltage = DT_INST_PROP(n, charge_voltage), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, &max17262_gauge_init, NULL, &max17262_data_##n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, &max17262_gauge_init, NULL, &max17262_data_##n, \ &max17262_config_##n, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &max17262_battery_driver_api); + &max17262_battery_driver_api); DT_INST_FOREACH_STATUS_OKAY(MAX17262_INIT) diff --git a/drivers/sensor/maxim/max30101/max30101.c b/drivers/sensor/maxim/max30101/max30101.c index f1b444f65f0d0..3391fcb971440 100644 --- a/drivers/sensor/maxim/max30101/max30101.c +++ b/drivers/sensor/maxim/max30101/max30101.c @@ -244,7 +244,6 @@ static struct max30101_config max30101_config = { static struct max30101_data max30101_data; -SENSOR_DEVICE_DT_INST_DEFINE(0, max30101_init, NULL, +SENSOR_DEVICE_INSTANCE_FROM_DT_INST(0, max30101_init, NULL, &max30101_data, &max30101_config, - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, - &max30101_driver_api); + POST_KERNEL, &max30101_driver_api); diff --git a/drivers/sensor/maxim/max31790/max31790_fan_fault.c b/drivers/sensor/maxim/max31790/max31790_fan_fault.c index ec25000a761df..f5b89c6371c28 100644 --- a/drivers/sensor/maxim/max31790/max31790_fan_fault.c +++ b/drivers/sensor/maxim/max31790/max31790_fan_fault.c @@ -73,9 +73,9 @@ static int max31790_fan_fault_init(const struct device *dev) \ static struct max31790_fan_fault_data max31790_fan_fault_##inst##_data; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, max31790_fan_fault_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, max31790_fan_fault_init, NULL, \ &max31790_fan_fault_##inst##_data, \ &max31790_fan_fault_##inst##_config, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &max31790_fan_fault_api); + &max31790_fan_fault_api); DT_INST_FOREACH_STATUS_OKAY(MAX31790_FAN_FAULT_INIT); diff --git a/drivers/sensor/maxim/max31790/max31790_fan_speed.c b/drivers/sensor/maxim/max31790/max31790_fan_speed.c index b0db008d8dc76..2b00eff8a539c 100644 --- a/drivers/sensor/maxim/max31790/max31790_fan_speed.c +++ b/drivers/sensor/maxim/max31790/max31790_fan_speed.c @@ -130,9 +130,9 @@ static int max31790_fan_speed_init(const struct device *dev) \ static struct max31790_fan_speed_data max31790_fan_speed_##inst##_data; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, max31790_fan_speed_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, max31790_fan_speed_init, NULL, \ &max31790_fan_speed_##inst##_data, \ &max31790_fan_speed_##inst##_config, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &max31790_fan_speed_api); + &max31790_fan_speed_api); DT_INST_FOREACH_STATUS_OKAY(MAX31790_FAN_SPEED_INIT); diff --git a/drivers/sensor/maxim/max31855/max31855.c b/drivers/sensor/maxim/max31855/max31855.c index aa71ad7cfbe41..563f4a462beb8 100644 --- a/drivers/sensor/maxim/max31855/max31855.c +++ b/drivers/sensor/maxim/max31855/max31855.c @@ -125,8 +125,8 @@ static int max31855_init(const struct device *dev) static const struct max31855_config max31855_config_##n = { \ .spi = SPI_DT_SPEC_INST_GET(n, SPI_OP_MODE_MASTER | SPI_WORD_SET(8U), 0U), \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(n, &max31855_init, NULL, &max31855_data_##n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, &max31855_init, NULL, &max31855_data_##n, \ &max31855_config_##n, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &max31855_api); + &max31855_api); DT_INST_FOREACH_STATUS_OKAY(MAX31855_INIT) diff --git a/drivers/sensor/maxim/max31865/max31865.c b/drivers/sensor/maxim/max31865/max31865.c index f56f70db5d90e..4c5e54f38a7cb 100644 --- a/drivers/sensor/maxim/max31865/max31865.c +++ b/drivers/sensor/maxim/max31865/max31865.c @@ -325,9 +325,8 @@ static const struct sensor_driver_api max31865_api_funcs = { .high_threshold = DT_INST_PROP(inst, high_threshold), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, max31865_init, NULL, &max31865_data_##inst, \ - &max31865_config_##inst, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &max31865_api_funcs); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, max31865_init, NULL, &max31865_data_##inst, \ + &max31865_config_##inst, POST_KERNEL, &max31865_api_funcs); /* Create the struct device for every status "okay" node in the devicetree. */ DT_INST_FOREACH_STATUS_OKAY(MAX31865_DEFINE) diff --git a/drivers/sensor/maxim/max31875/max31875.c b/drivers/sensor/maxim/max31875/max31875.c index 4d9eb9009485b..4a2e587de2c9c 100644 --- a/drivers/sensor/maxim/max31875/max31875.c +++ b/drivers/sensor/maxim/max31875/max31875.c @@ -268,8 +268,8 @@ static int max31875_init(const struct device *dev) .resolution = DT_INST_ENUM_IDX(inst, resolution), \ .data_format = DT_INST_PROP(inst, extended_mode), \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, max31875_init, NULL, &max31875_data_##inst, \ - &max31875_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &max31875_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, max31875_init, NULL, &max31875_data_##inst, \ + &max31875_config_##inst, POST_KERNEL, \ + &max31875_driver_api); DT_INST_FOREACH_STATUS_OKAY(MAX31875_INST) diff --git a/drivers/sensor/maxim/max44009/max44009.c b/drivers/sensor/maxim/max44009/max44009.c index 97f94873173f9..e08f158d003ee 100644 --- a/drivers/sensor/maxim/max44009/max44009.c +++ b/drivers/sensor/maxim/max44009/max44009.c @@ -190,8 +190,8 @@ int max44009_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, max44009_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, max44009_init, NULL, \ &max44009_data_##inst, &max44009_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &max44009_driver_api); \ + &max44009_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(MAX44009_DEFINE) diff --git a/drivers/sensor/maxim/max6675/max6675.c b/drivers/sensor/maxim/max6675/max6675.c index f7320caaa7c7b..66f15eda0ca56 100644 --- a/drivers/sensor/maxim/max6675/max6675.c +++ b/drivers/sensor/maxim/max6675/max6675.c @@ -107,9 +107,8 @@ static int max6675_init(const struct device *dev) SPI_WORD_SET(8U), \ 0U), \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(n, &max6675_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, &max6675_init, NULL, \ &max6675_data_##n, &max6675_config_##n, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &max6675_api); + POST_KERNEL, &max6675_api); DT_INST_FOREACH_STATUS_OKAY(MAX6675_INIT) diff --git a/drivers/sensor/meas/ms5607/ms5607.c b/drivers/sensor/meas/ms5607/ms5607.c index 77258e0ba96b9..8eecc5228ed87 100644 --- a/drivers/sensor/meas/ms5607/ms5607.c +++ b/drivers/sensor/meas/ms5607/ms5607.c @@ -345,13 +345,12 @@ static const struct sensor_driver_api ms5607_api_funcs = { COND_CODE_1(DT_INST_ON_BUS(inst, spi), \ (MS5607_CONFIG_SPI(inst)), \ (MS5607_CONFIG_I2C(inst))); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ ms5607_init, \ NULL, \ &ms5607_data_##inst, \ &ms5607_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &ms5607_api_funcs); /* Create the struct device for every status "okay" node in the devicetree. */ diff --git a/drivers/sensor/meas/ms5837/ms5837.c b/drivers/sensor/meas/ms5837/ms5837.c index d07d23071aa54..f3060e158e9f4 100644 --- a/drivers/sensor/meas/ms5837/ms5837.c +++ b/drivers/sensor/meas/ms5837/ms5837.c @@ -374,8 +374,8 @@ static int ms5837_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, ms5837_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, ms5837_init, NULL, \ &ms5837_data_##inst, &ms5837_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &ms5837_api_funcs); \ + &ms5837_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(MS5837_DEFINE) diff --git a/drivers/sensor/memsic/mc3419/mc3419.c b/drivers/sensor/memsic/mc3419/mc3419.c index a5a0fcae4d299..14a180debcd62 100644 --- a/drivers/sensor/memsic/mc3419/mc3419.c +++ b/drivers/sensor/memsic/mc3419/mc3419.c @@ -310,8 +310,8 @@ static const struct sensor_driver_api mc3419_api = { .decimation_rate = DT_INST_PROP(idx, decimation_rate), \ MC3419_CFG_IRQ(idx)}; \ static struct mc3419_driver_data mc3419_data_##idx; \ - SENSOR_DEVICE_DT_INST_DEFINE(idx, mc3419_init, NULL, &mc3419_data_##idx, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(idx, mc3419_init, NULL, &mc3419_data_##idx, \ &mc3419_config_##idx, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &mc3419_api); + &mc3419_api); DT_INST_FOREACH_STATUS_OKAY(MC3419_DEFINE) diff --git a/drivers/sensor/memsic/mmc56x3/mmc56x3.c b/drivers/sensor/memsic/mmc56x3/mmc56x3.c index a21735bed2804..5d5dd44c4fb73 100644 --- a/drivers/sensor/memsic/mmc56x3/mmc56x3.c +++ b/drivers/sensor/memsic/mmc56x3/mmc56x3.c @@ -473,9 +473,9 @@ static const struct sensor_driver_api mmc56x3_api_funcs = { MMC56X3_DATA_INIT(inst); \ const static struct mmc56x3_dev_config mmc56x3_dev_config_##inst = \ MMC56X3_DT_DEV_CONFIG_INIT(inst); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, mmc56x3_chip_init, NULL, &mmc56x3_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, mmc56x3_chip_init, NULL, &mmc56x3_data_##inst, \ &mmc56x3_dev_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &mmc56x3_api_funcs); + &mmc56x3_api_funcs); /* Create the struct device for every status "okay" node in the devicetree. */ DT_INST_FOREACH_STATUS_OKAY(MMC56X3_DEFINE) diff --git a/drivers/sensor/mhz19b/mhz19b.c b/drivers/sensor/mhz19b/mhz19b.c index 9f78d68b23480..6d47ec8e8666c 100644 --- a/drivers/sensor/mhz19b/mhz19b.c +++ b/drivers/sensor/mhz19b/mhz19b.c @@ -341,8 +341,8 @@ static int mhz19b_init(const struct device *dev) .cb = mhz19b_uart_isr, \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, mhz19b_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, mhz19b_init, NULL, \ &mhz19b_data_##inst, &mhz19b_cfg_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &mhz19b_api_funcs); + POST_KERNEL, &mhz19b_api_funcs); DT_INST_FOREACH_STATUS_OKAY(MHZ19B_INIT) diff --git a/drivers/sensor/microchip/mchp_tach_xec/tach_mchp_xec.c b/drivers/sensor/microchip/mchp_tach_xec/tach_mchp_xec.c index 9ee732475da93..b3be246851126 100644 --- a/drivers/sensor/microchip/mchp_tach_xec/tach_mchp_xec.c +++ b/drivers/sensor/microchip/mchp_tach_xec/tach_mchp_xec.c @@ -201,13 +201,12 @@ static const struct sensor_driver_api tach_xec_driver_api = { \ PM_DEVICE_DT_INST_DEFINE(id, tach_xec_pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(id, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(id, \ tach_xec_init, \ PM_DEVICE_DT_INST_GET(id), \ &tach_xec_data_##id, \ &tach_xec_config_##id, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &tach_xec_driver_api); DT_INST_FOREACH_STATUS_OKAY(TACH_XEC_DEVICE) diff --git a/drivers/sensor/microchip/mcp9600/mcp9600.c b/drivers/sensor/microchip/mcp9600/mcp9600.c index dfec3a5d064de..959e0eb225f6b 100644 --- a/drivers/sensor/microchip/mcp9600/mcp9600.c +++ b/drivers/sensor/microchip/mcp9600/mcp9600.c @@ -133,8 +133,8 @@ static int mcp9600_init(const struct device *dev) .bus = I2C_DT_SPEC_INST_GET(id), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(id, mcp9600_init, NULL, &mcp9600_data_##id, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(id, mcp9600_init, NULL, &mcp9600_data_##id, \ &mcp9600_config_##id, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &mcp9600_api); + &mcp9600_api); DT_INST_FOREACH_STATUS_OKAY(MCP9600_DEFINE) diff --git a/drivers/sensor/microchip/mcp970x/mcp970x.c b/drivers/sensor/microchip/mcp970x/mcp970x.c index fb43f4d92e374..314040ebc57f5 100644 --- a/drivers/sensor/microchip/mcp970x/mcp970x.c +++ b/drivers/sensor/microchip/mcp970x/mcp970x.c @@ -133,8 +133,8 @@ static int init(const struct device *dev) .family = DT_INST_ENUM_IDX(inst, family), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, &init, NULL, &mcp970x_##inst##_data, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, &init, NULL, &mcp970x_##inst##_data, \ &mcp970x_##inst##_config, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &mcp970x_api); + &mcp970x_api); DT_INST_FOREACH_STATUS_OKAY(MCP970X_INIT) diff --git a/drivers/sensor/microchip/tcn75a/tcn75a.c b/drivers/sensor/microchip/tcn75a/tcn75a.c index c9594efcfa74e..f446853ace08c 100644 --- a/drivers/sensor/microchip/tcn75a/tcn75a.c +++ b/drivers/sensor/microchip/tcn75a/tcn75a.c @@ -129,7 +129,7 @@ static int tcn75a_init(const struct device *dev) .oneshot_mode = DT_INST_PROP(n, oneshot_mode), \ TCN75A_TRIGGER(n) \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(n, &tcn75a_init, NULL, &tcn75a_data_##n, &tcn75a_config_##n, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &tcn75a_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, &tcn75a_init, NULL, &tcn75a_data_##n, &tcn75a_config_##n,\ + POST_KERNEL, &tcn75a_api); DT_INST_FOREACH_STATUS_OKAY(TCN75A_INIT) diff --git a/drivers/sensor/nct75/nct75.c b/drivers/sensor/nct75/nct75.c index 2759c632d27cd..9e589e441c483 100644 --- a/drivers/sensor/nct75/nct75.c +++ b/drivers/sensor/nct75/nct75.c @@ -113,8 +113,8 @@ static int nct75_init(const struct device *dev) \ static struct nct75_data nct75_##inst##_data; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, nct75_init, NULL, &nct75_##inst##_data, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, nct75_init, NULL, &nct75_##inst##_data, \ &nct75_##inst##_config, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &nct75_api); + &nct75_api); DT_INST_FOREACH_STATUS_OKAY(NCT75_INIT); diff --git a/drivers/sensor/nordic/npm1300_charger/npm1300_charger.c b/drivers/sensor/nordic/npm1300_charger/npm1300_charger.c index 869f8f5848fc7..015e737db2304 100644 --- a/drivers/sensor/nordic/npm1300_charger/npm1300_charger.c +++ b/drivers/sensor/nordic/npm1300_charger/npm1300_charger.c @@ -695,9 +695,8 @@ static const struct sensor_driver_api npm1300_charger_battery_driver_api = { DT_INST_PROP_OR(n, thermistor_warm_millidegrees, INT32_MAX), \ DT_INST_PROP_OR(n, thermistor_hot_millidegrees, INT32_MAX)}}; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, &npm1300_charger_init, NULL, &npm1300_charger_data_##n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, &npm1300_charger_init, NULL, &npm1300_charger_data_##n,\ &npm1300_charger_config_##n, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &npm1300_charger_battery_driver_api); DT_INST_FOREACH_STATUS_OKAY(NPM1300_CHARGER_INIT) diff --git a/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c b/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c index e7f014de0d080..4cc2278665b45 100644 --- a/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c +++ b/drivers/sensor/nordic/qdec_nrfx/qdec_nrfx.c @@ -285,13 +285,12 @@ static int qdec_nrfx_init(const struct device *dev) .steps = QDEC_PROP(idx, steps), \ }; \ PM_DEVICE_DT_DEFINE(QDEC(idx), qdec_nrfx_pm_action, PM_DEVICE_ISR_SAFE); \ - SENSOR_DEVICE_DT_DEFINE(QDEC(idx), \ + SENSOR_DEVICE_INSTANCE(QDEC(idx), \ qdec_nrfx_init, \ PM_DEVICE_DT_GET(QDEC(idx)), \ &qdec_##idx##_data, \ &qdec_##idx##_config, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &qdec_nrfx_driver_api) #ifdef CONFIG_HAS_HW_NRF_QDEC0 diff --git a/drivers/sensor/nordic/temp/temp_nrf5.c b/drivers/sensor/nordic/temp/temp_nrf5.c index beef0354e0ed2..5bc8fccfdfbea 100644 --- a/drivers/sensor/nordic/temp/temp_nrf5.c +++ b/drivers/sensor/nordic/temp/temp_nrf5.c @@ -137,8 +137,8 @@ static int temp_nrf5_init(const struct device *dev) #define NRF_TEMP_DEFINE(inst) \ static struct temp_nrf5_data temp_nrf5_data_##inst; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, temp_nrf5_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, temp_nrf5_init, NULL, \ &temp_nrf5_data_##inst, NULL, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &temp_nrf5_driver_api); \ + &temp_nrf5_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(NRF_TEMP_DEFINE) diff --git a/drivers/sensor/nordic/temp/temp_nrfs.c b/drivers/sensor/nordic/temp/temp_nrfs.c index 015e05918f04d..b392a8e00ee94 100644 --- a/drivers/sensor/nordic/temp/temp_nrfs.c +++ b/drivers/sensor/nordic/temp/temp_nrfs.c @@ -306,7 +306,6 @@ static struct temp_nrfs_data temp_nrfs_drv_data = { #endif }; -DEVICE_DT_INST_DEFINE(0, temp_nrfs_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, temp_nrfs_init, NULL, &temp_nrfs_drv_data, NULL, - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, - &temp_nrfs_drv_api); + POST_KERNEL, &temp_nrfs_drv_api); diff --git a/drivers/sensor/ntc_thermistor/ntc_thermistor.c b/drivers/sensor/ntc_thermistor/ntc_thermistor.c index 6fcdb6a70ed63..4f43874419172 100644 --- a/drivers/sensor/ntc_thermistor/ntc_thermistor.c +++ b/drivers/sensor/ntc_thermistor/ntc_thermistor.c @@ -156,10 +156,10 @@ static int ntc_thermistor_pm_action(const struct device *dev, enum pm_device_act \ PM_DEVICE_DT_INST_DEFINE(inst, ntc_thermistor_pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE( \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST( \ inst, ntc_thermistor_init, PM_DEVICE_DT_INST_GET(inst), \ &ntc_thermistor_driver_##id##inst, &ntc_thermistor_cfg_##id##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &ntc_thermistor_driver_api); + &ntc_thermistor_driver_api); #define NTC_THERMISTOR_DEFINE(inst, id, comp) \ NTC_THERMISTOR_DEFINE0(inst, id, comp, ARRAY_SIZE(comp)) diff --git a/drivers/sensor/nuvoton/nuvoton_adc_cmp_npcx/adc_cmp_npcx.c b/drivers/sensor/nuvoton/nuvoton_adc_cmp_npcx/adc_cmp_npcx.c index cba37069ce9df..36caa07014101 100644 --- a/drivers/sensor/nuvoton/nuvoton_adc_cmp_npcx/adc_cmp_npcx.c +++ b/drivers/sensor/nuvoton/nuvoton_adc_cmp_npcx/adc_cmp_npcx.c @@ -262,10 +262,9 @@ static const struct sensor_driver_api adc_cmp_npcx_api = { .comparison = DT_INST_STRING_TOKEN_OR(inst, \ comparison, ADC_CMP_NPCX_UNDEFINED) \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, adc_cmp_npcx_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, adc_cmp_npcx_init, NULL, \ &adc_cmp_npcx_data_##inst, \ &adc_cmp_npcx_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &adc_cmp_npcx_api); \ BUILD_ASSERT(DT_INST_STRING_TOKEN_OR(inst, thr_sel, inst) < \ DT_PROP(DT_INST_IO_CHANNELS_CTLR(inst), threshold_count), \ diff --git a/drivers/sensor/nuvoton/nuvoton_tach_npcx/tach_nuvoton_npcx.c b/drivers/sensor/nuvoton/nuvoton_tach_npcx/tach_nuvoton_npcx.c index b373d998b6489..af04b1f3fc44e 100644 --- a/drivers/sensor/nuvoton/nuvoton_tach_npcx/tach_nuvoton_npcx.c +++ b/drivers/sensor/nuvoton/nuvoton_tach_npcx/tach_nuvoton_npcx.c @@ -382,13 +382,12 @@ static const struct sensor_driver_api tach_npcx_driver_api = { \ static struct tach_npcx_data tach_data_##inst; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ tach_npcx_init, \ NULL, \ &tach_data_##inst, \ &tach_cfg_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &tach_npcx_driver_api); DT_INST_FOREACH_STATUS_OKAY(NPCX_TACH_INIT) diff --git a/drivers/sensor/nxp/fxas21002/fxas21002.c b/drivers/sensor/nxp/fxas21002/fxas21002.c index 436bc9fb26970..1ab737a1bf54c 100644 --- a/drivers/sensor/nxp/fxas21002/fxas21002.c +++ b/drivers/sensor/nxp/fxas21002/fxas21002.c @@ -475,9 +475,8 @@ static const struct sensor_driver_api fxas21002_driver_api = { { 0 }),)))) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, fxas21002_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, fxas21002_init, NULL, \ &fxas21002_data_##inst, &fxas21002_config_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &fxas21002_driver_api); \ + POST_KERNEL, &fxas21002_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(FXAS21002_DEFINE) diff --git a/drivers/sensor/nxp/fxls8974/fxls8974.c b/drivers/sensor/nxp/fxls8974/fxls8974.c index 049f289da84e0..9c3459902c3dd 100644 --- a/drivers/sensor/nxp/fxls8974/fxls8974.c +++ b/drivers/sensor/nxp/fxls8974/fxls8974.c @@ -628,13 +628,12 @@ static const struct sensor_driver_api fxls8974_driver_api = { \ static struct fxls8974_data fxls8974_data_##n; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, \ fxls8974_init, \ NULL, \ &fxls8974_data_##n, \ &fxls8974_config_##n, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &fxls8974_driver_api); DT_INST_FOREACH_STATUS_OKAY(FXLS8974_INIT) diff --git a/drivers/sensor/nxp/fxos8700/fxos8700.c b/drivers/sensor/nxp/fxos8700/fxos8700.c index 67b5f4e3d60ff..bfabe66143ec1 100644 --- a/drivers/sensor/nxp/fxos8700/fxos8700.c +++ b/drivers/sensor/nxp/fxos8700/fxos8700.c @@ -767,13 +767,12 @@ static const struct sensor_driver_api fxos8700_driver_api = { \ static struct fxos8700_data fxos8700_data_##n; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, \ fxos8700_init, \ NULL, \ &fxos8700_data_##n, \ &fxos8700_config_##n, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &fxos8700_driver_api); DT_INST_FOREACH_STATUS_OKAY(FXOS8700_INIT) diff --git a/drivers/sensor/nxp/mcux_acmp/mcux_acmp.c b/drivers/sensor/nxp/mcux_acmp/mcux_acmp.c index 90dde17e83c37..3a0f7a874d726 100644 --- a/drivers/sensor/nxp/mcux_acmp/mcux_acmp.c +++ b/drivers/sensor/nxp/mcux_acmp/mcux_acmp.c @@ -574,11 +574,10 @@ static const struct mcux_acmp_config mcux_acmp_config_##n = { \ \ PINCTRL_DT_INST_DEFINE(n); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, &mcux_acmp_init, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, &mcux_acmp_init, \ NULL, \ &mcux_acmp_data_##n, \ &mcux_acmp_config_##n, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &mcux_acmp_driver_api); \ MCUX_ACMP_CONFIG_FUNC(n) \ MCUX_ACMP_INIT_CONFIG(n); diff --git a/drivers/sensor/nxp/mcux_lpcmp/mcux_lpcmp.c b/drivers/sensor/nxp/mcux_lpcmp/mcux_lpcmp.c index 57e89b3a4d948..1360bceced46f 100644 --- a/drivers/sensor/nxp/mcux_lpcmp/mcux_lpcmp.c +++ b/drivers/sensor/nxp/mcux_lpcmp/mcux_lpcmp.c @@ -440,9 +440,9 @@ static const struct sensor_driver_api mcux_lpcmp_driver_api = { static struct mcux_lpcmp_data mcux_lpcmp_data_##n; \ static const struct mcux_lpcmp_config mcux_lpcmp_config_##n; \ PINCTRL_DT_INST_DEFINE(n); \ - SENSOR_DEVICE_DT_INST_DEFINE(n, &mcux_lpcmp_init, NULL, &mcux_lpcmp_data_##n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, &mcux_lpcmp_init, NULL, &mcux_lpcmp_data_##n, \ &mcux_lpcmp_config_##n, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &mcux_lpcmp_driver_api); \ + &mcux_lpcmp_driver_api); \ MCUX_LPCMP_CONFIG_FUNC(n) \ MCUX_LPCMP_INIT_CONFIG(n); diff --git a/drivers/sensor/nxp/nxp_kinetis_temp/temp_kinetis.c b/drivers/sensor/nxp/nxp_kinetis_temp/temp_kinetis.c index 7f5beda55ebad..3dd8dafe7b1ff 100644 --- a/drivers/sensor/nxp/nxp_kinetis_temp/temp_kinetis.c +++ b/drivers/sensor/nxp/nxp_kinetis_temp/temp_kinetis.c @@ -212,11 +212,10 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) <= 1, }, \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, temp_kinetis_init, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, temp_kinetis_init, \ NULL, \ &temp_kinetis_data_0, \ &temp_kinetis_config_0, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &temp_kinetis_driver_api); DT_INST_FOREACH_STATUS_OKAY(TEMP_KINETIS_INIT) diff --git a/drivers/sensor/nxp/nxp_tempmon/nxp_tempmon.c b/drivers/sensor/nxp/nxp_tempmon/nxp_tempmon.c index 93dfd0ed07aee..44b6dc26855f3 100644 --- a/drivers/sensor/nxp/nxp_tempmon/nxp_tempmon.c +++ b/drivers/sensor/nxp/nxp_tempmon/nxp_tempmon.c @@ -109,6 +109,5 @@ static const struct nxp_tempmon_config nxp_tempmon_dev_config = { .base = (TEMPMON_Type *)DT_INST_REG_ADDR(0), }; -SENSOR_DEVICE_DT_INST_DEFINE(0, nxp_tempmon_init, NULL, &nxp_tempmon_dev_data, - &nxp_tempmon_dev_config, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, - &nxp_tempmon_driver_api); +SENSOR_DEVICE_INSTANCE_FROM_DT_INST(0, nxp_tempmon_init, NULL, &nxp_tempmon_dev_data, + &nxp_tempmon_dev_config, POST_KERNEL, &nxp_tempmon_driver_api); diff --git a/drivers/sensor/nxp/p3t1755/p3t1755.c b/drivers/sensor/nxp/p3t1755/p3t1755.c index b84dde4ffe213..3601b9295a83e 100644 --- a/drivers/sensor/nxp/p3t1755/p3t1755.c +++ b/drivers/sensor/nxp/p3t1755/p3t1755.c @@ -184,8 +184,8 @@ static const struct sensor_driver_api p3t1755_driver_api = { .oneshot_mode = DT_INST_PROP(n, oneshot_mode), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, p3t1755_init, NULL, &p3t1755_data_##n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, p3t1755_init, NULL, &p3t1755_data_##n, \ &p3t1755_config_##n, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &p3t1755_driver_api); + &p3t1755_driver_api); DT_INST_FOREACH_STATUS_OKAY(P3T1755_INIT) diff --git a/drivers/sensor/nxp/qdec_mcux/qdec_mcux.c b/drivers/sensor/nxp/qdec_mcux/qdec_mcux.c index ac95a4d0a7fdb..f639a55382dd7 100644 --- a/drivers/sensor/nxp/qdec_mcux/qdec_mcux.c +++ b/drivers/sensor/nxp/qdec_mcux/qdec_mcux.c @@ -205,10 +205,9 @@ static void init_inputs(const struct device *dev) } \ \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, qdec_mcux_##n##_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, qdec_mcux_##n##_init, NULL, \ &qdec_mcux_##n##_data, &qdec_mcux_##n##_config, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &qdec_mcux_api); \ + POST_KERNEL, &qdec_mcux_api); \ \ DT_INST_FOREACH_STATUS_OKAY(QDEC_MCUX_INIT) diff --git a/drivers/sensor/nxp/qdec_nxp_s32/qdec_nxp_s32.c b/drivers/sensor/nxp/qdec_nxp_s32/qdec_nxp_s32.c index 56e31f357f43a..6d803c7a50d92 100644 --- a/drivers/sensor/nxp/qdec_nxp_s32/qdec_nxp_s32.c +++ b/drivers/sensor/nxp/qdec_nxp_s32/qdec_nxp_s32.c @@ -444,8 +444,8 @@ static int qdec_s32_initialize(const struct device *dev) .emios_ccw_overflow_cb = &qdec##n##_emios_overflow_count_ccw_callback, \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, qdec_s32_initialize, NULL, &qdec_s32_##n##_data, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, qdec_s32_initialize, NULL, &qdec_s32_##n##_data, \ &qdec_s32_##n##_config, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &qdec_s32_api); + &qdec_s32_api); DT_INST_FOREACH_STATUS_OKAY(QDEC_NXP_S32_INIT) diff --git a/drivers/sensor/pms7003/pms7003.c b/drivers/sensor/pms7003/pms7003.c index a154baafcfd04..1c0eb5747c76a 100644 --- a/drivers/sensor/pms7003/pms7003.c +++ b/drivers/sensor/pms7003/pms7003.c @@ -191,8 +191,8 @@ static int pms7003_init(const struct device *dev) .uart_dev = DEVICE_DT_GET(DT_INST_BUS(inst)), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, &pms7003_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, &pms7003_init, NULL, \ &pms7003_data_##inst, &pms7003_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &pms7003_api); \ + &pms7003_api); \ DT_INST_FOREACH_STATUS_OKAY(PMS7003_DEFINE) diff --git a/drivers/sensor/qdec_sam/qdec_sam.c b/drivers/sensor/qdec_sam/qdec_sam.c index f5914b5574603..4c102574890e6 100644 --- a/drivers/sensor/qdec_sam/qdec_sam.c +++ b/drivers/sensor/qdec_sam/qdec_sam.c @@ -132,9 +132,8 @@ static const struct sensor_driver_api qdec_sam_driver_api = { \ static struct qdec_sam_dev_data qdec##n##_sam_data; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, qdec_sam_initialize, NULL, \ - &qdec##n##_sam_data, &qdec##n##_sam_config, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &qdec_sam_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, qdec_sam_initialize, NULL,\ + &qdec##n##_sam_data, &qdec##n##_sam_config, \ + POST_KERNEL, &qdec_sam_driver_api); DT_INST_FOREACH_STATUS_OKAY(QDEC_SAM_INIT) diff --git a/drivers/sensor/renesas/hs300x/hs300x.c b/drivers/sensor/renesas/hs300x/hs300x.c index 8ccfdd3ee40a2..3b605b080014f 100644 --- a/drivers/sensor/renesas/hs300x/hs300x.c +++ b/drivers/sensor/renesas/hs300x/hs300x.c @@ -158,8 +158,7 @@ static const struct sensor_driver_api hs300x_driver_api = {.sample_fetch = hs300 \ static const struct hs300x_config hs300x_config_##n = {.bus = I2C_DT_SPEC_INST_GET(n)}; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, hs300x_init, NULL, &hs300x_data_##n, &hs300x_config_##n, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &hs300x_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, hs300x_init, NULL, &hs300x_data_##n, &hs300x_config_##n,\ + POST_KERNEL, &hs300x_driver_api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_HS300X) diff --git a/drivers/sensor/renesas/isl29035/isl29035.c b/drivers/sensor/renesas/isl29035/isl29035.c index d7df0a41704fa..7e2e125956560 100644 --- a/drivers/sensor/renesas/isl29035/isl29035.c +++ b/drivers/sensor/renesas/isl29035/isl29035.c @@ -154,8 +154,8 @@ static int isl29035_init(const struct device *dev) (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, { 0 }),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, &isl29035_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, &isl29035_init, NULL, \ &isl29035_data_##inst, &isl29035_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &isl29035_api); \ + &isl29035_api); \ DT_INST_FOREACH_STATUS_OKAY(ISL29035_DEFINE) diff --git a/drivers/sensor/rohm/bd8lb600fs/bd8lb600fs_diagnostics.c b/drivers/sensor/rohm/bd8lb600fs/bd8lb600fs_diagnostics.c index 0f0624112949c..1d15a56c03543 100644 --- a/drivers/sensor/rohm/bd8lb600fs/bd8lb600fs_diagnostics.c +++ b/drivers/sensor/rohm/bd8lb600fs/bd8lb600fs_diagnostics.c @@ -69,9 +69,8 @@ static int bd8lb600fs_diagnostics_init(const struct device *dev) .parent_dev = DEVICE_DT_GET(DT_PARENT(DT_DRV_INST(inst))), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE( \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST( \ inst, bd8lb600fs_diagnostics_init, NULL, &bd8lb600fs_diagnostics_data_##inst, \ - &bd8lb600fs_diagnostics_config_##inst, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &bd8lb600fs_diagnostics_driver_api); + &bd8lb600fs_diagnostics_config_##inst, POST_KERNEL, &bd8lb600fs_diagnostics_driver_api); DT_INST_FOREACH_STATUS_OKAY(BD8LB600FS_DIAGNOSTICS_DEFINE) diff --git a/drivers/sensor/rohm/bh1750/bh1750.c b/drivers/sensor/rohm/bh1750/bh1750.c index 09a3de3ef9535..beea2338d6ab5 100644 --- a/drivers/sensor/rohm/bh1750/bh1750.c +++ b/drivers/sensor/rohm/bh1750/bh1750.c @@ -215,8 +215,8 @@ static int bh1750_init(const struct device *dev) .mtreg = DT_INST_PROP(_num, mtreg), \ .resolution = DT_INST_PROP(_num, resolution) \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(_num, bh1750_init, NULL, \ - &bh1750_data_##_num, &bh1750_config_##_num, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &bh1750_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(_num, bh1750_init, NULL, \ + &bh1750_data_##_num, &bh1750_config_##_num, POST_KERNEL, \ + &bh1750_driver_api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_BH1750) diff --git a/drivers/sensor/rpi_pico_temp/rpi_pico_temp.c b/drivers/sensor/rpi_pico_temp/rpi_pico_temp.c index 894b2b0cabfd6..b625891ca4417 100644 --- a/drivers/sensor/rpi_pico_temp/rpi_pico_temp.c +++ b/drivers/sensor/rpi_pico_temp/rpi_pico_temp.c @@ -125,9 +125,8 @@ static int rpi_pico_temp_init(const struct device *dev) }, \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, rpi_pico_temp_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, rpi_pico_temp_init, NULL, \ &rpi_pico_temp_dev_data_##inst, &rpi_pico_temp_config_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &rpi_pico_temp_driver_api); + POST_KERNEL, &rpi_pico_temp_driver_api); DT_INST_FOREACH_STATUS_OKAY(RPI_PICO_TEMP_DEFINE) diff --git a/drivers/sensor/s11059/s11059.c b/drivers/sensor/s11059/s11059.c index b544b640ef9c9..1774c753f7378 100644 --- a/drivers/sensor/s11059/s11059.c +++ b/drivers/sensor/s11059/s11059.c @@ -301,8 +301,8 @@ static const struct sensor_driver_api s11059_driver_api = { .bus = I2C_DT_SPEC_INST_GET(inst), \ .gain = DT_INST_PROP(inst, high_gain), \ .integration_time = DT_INST_PROP(inst, integration_time)}; \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, s11059_init, NULL, &s11059_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, s11059_init, NULL, &s11059_data_##inst, \ &s11059_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &s11059_driver_api); + &s11059_driver_api); DT_INST_FOREACH_STATUS_OKAY(S11059_INST) diff --git a/drivers/sensor/sbs_gauge/sbs_gauge.c b/drivers/sensor/sbs_gauge/sbs_gauge.c index 192b0fad3f777..3556f56e3131f 100644 --- a/drivers/sensor/sbs_gauge/sbs_gauge.c +++ b/drivers/sensor/sbs_gauge/sbs_gauge.c @@ -284,12 +284,11 @@ static const struct sensor_driver_api sbs_gauge_driver_api = { .i2c = I2C_DT_SPEC_INST_GET(index), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(index, \ - &sbs_gauge_init, \ - NULL, \ - &sbs_gauge_driver_##index, \ - &sbs_gauge_config_##index, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(index,\ + &sbs_gauge_init,\ + NULL, \ + &sbs_gauge_driver_##index,\ + &sbs_gauge_config_##index, POST_KERNEL,\ &sbs_gauge_driver_api); DT_INST_FOREACH_STATUS_OKAY(SBS_GAUGE_INIT) diff --git a/drivers/sensor/seeed/grove/light_sensor.c b/drivers/sensor/seeed/grove/light_sensor.c index 50be8d392e26c..3d8e5f2c1436d 100644 --- a/drivers/sensor/seeed/grove/light_sensor.c +++ b/drivers/sensor/seeed/grove/light_sensor.c @@ -121,8 +121,8 @@ static int gls_init(const struct device *dev) .adc_channel = DT_INST_IO_CHANNELS_INPUT(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, &gls_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, &gls_init, NULL, \ &gls_data_##inst, &gls_cfg_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &gls_api); \ + &gls_api); \ DT_INST_FOREACH_STATUS_OKAY(GLS_DEFINE) diff --git a/drivers/sensor/seeed/grove/temperature_sensor.c b/drivers/sensor/seeed/grove/temperature_sensor.c index 22d90641329c4..b2c5f92b55262 100644 --- a/drivers/sensor/seeed/grove/temperature_sensor.c +++ b/drivers/sensor/seeed/grove/temperature_sensor.c @@ -126,8 +126,8 @@ static int gts_init(const struct device *dev) .adc_channel = DT_INST_IO_CHANNELS_INPUT(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, >s_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, >s_init, NULL, \ >s_data_##inst, >s_cfg_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, >s_api); \ + >s_api); \ DT_INST_FOREACH_STATUS_OKAY(GTS_DEFINE) diff --git a/drivers/sensor/seeed/hm330x/hm330x.c b/drivers/sensor/seeed/hm330x/hm330x.c index a1ec7baccd82f..1698e474a5f38 100644 --- a/drivers/sensor/seeed/hm330x/hm330x.c +++ b/drivers/sensor/seeed/hm330x/hm330x.c @@ -114,8 +114,8 @@ int hm330x_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, hm330x_init, NULL, &hm330x_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, hm330x_init, NULL, &hm330x_data_##inst, \ &hm330x_config##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &hm330x_driver_api); \ + &hm330x_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(HM330X_DEFINE) diff --git a/drivers/sensor/sensirion/sgp40/sgp40.c b/drivers/sensor/sensirion/sgp40/sgp40.c index 4cf04a446a080..d06edd5a3e341 100644 --- a/drivers/sensor/sensirion/sgp40/sgp40.c +++ b/drivers/sensor/sensirion/sgp40/sgp40.c @@ -258,13 +258,12 @@ static const struct sensor_driver_api sgp40_api = { \ PM_DEVICE_DT_INST_DEFINE(n, sgp40_pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, \ sgp40_init, \ - PM_DEVICE_DT_INST_GET(n), \ + PM_DEVICE_DT_INST_GET(n), \ &sgp40_data_##n, \ &sgp40_config_##n, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &sgp40_api); DT_INST_FOREACH_STATUS_OKAY(SGP40_INIT) diff --git a/drivers/sensor/sensirion/sht3xd/sht3xd.c b/drivers/sensor/sensirion/sht3xd/sht3xd.c index 7431e4f7973f5..88ee6a5048741 100644 --- a/drivers/sensor/sensirion/sht3xd/sht3xd.c +++ b/drivers/sensor/sensirion/sht3xd/sht3xd.c @@ -219,9 +219,8 @@ static int sht3xd_init(const struct device *dev) .bus = I2C_DT_SPEC_INST_GET(inst), \ SHT3XD_TRIGGER_INIT(inst) \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, sht3xd_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, sht3xd_init, NULL, \ &sht3xd0_data_##inst, &sht3xd0_cfg_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &sht3xd_driver_api); + POST_KERNEL, &sht3xd_driver_api); DT_INST_FOREACH_STATUS_OKAY(SHT3XD_DEFINE) diff --git a/drivers/sensor/sensirion/sht4x/sht4x.c b/drivers/sensor/sensirion/sht4x/sht4x.c index bec76be386cef..6fdd691f99fc2 100644 --- a/drivers/sensor/sensirion/sht4x/sht4x.c +++ b/drivers/sensor/sensirion/sht4x/sht4x.c @@ -216,13 +216,12 @@ static const struct sensor_driver_api sht4x_api = { .repeatability = DT_INST_PROP(n, repeatability) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, \ sht4x_init, \ NULL, \ &sht4x_data_##n, \ &sht4x_config_##n, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &sht4x_api); DT_INST_FOREACH_STATUS_OKAY(SHT4X_INIT) diff --git a/drivers/sensor/sensirion/shtcx/shtcx.c b/drivers/sensor/sensirion/shtcx/shtcx.c index 1abd4694a9860..5c663fbf783a1 100644 --- a/drivers/sensor/sensirion/shtcx/shtcx.c +++ b/drivers/sensor/sensirion/shtcx/shtcx.c @@ -252,13 +252,12 @@ static int shtcx_init(const struct device *dev) static struct shtcx_data shtcx_data_##inst; \ static struct shtcx_config shtcx_config_##inst = \ SHTCX_CONFIG(inst); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ shtcx_init, \ NULL, \ &shtcx_data_##inst, \ &shtcx_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &shtcx_driver_api); DT_INST_FOREACH_STATUS_OKAY(SHTCX_DEFINE) diff --git a/drivers/sensor/silabs/si7006/si7006.c b/drivers/sensor/silabs/si7006/si7006.c index da7732661ae5e..36090027ee945 100644 --- a/drivers/sensor/silabs/si7006/si7006.c +++ b/drivers/sensor/silabs/si7006/si7006.c @@ -205,11 +205,10 @@ static int si7006_init(const struct device *dev) .read_temp_cmd = temp_cmd, \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, si7006_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, si7006_init, NULL, \ &si7006_data_##name##_##inst, \ &si7006_config_##name##_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &si7006_api); + POST_KERNEL, &si7006_api); #define DT_DRV_COMPAT silabs_si7006 DT_INST_FOREACH_STATUS_OKAY_VARGS(SI7006_DEFINE, DT_DRV_COMPAT, SI7006_READ_OLD_TEMP); diff --git a/drivers/sensor/silabs/si7055/si7055.c b/drivers/sensor/silabs/si7055/si7055.c index 136fe6b3362c0..86c80ceda27ea 100644 --- a/drivers/sensor/silabs/si7055/si7055.c +++ b/drivers/sensor/silabs/si7055/si7055.c @@ -151,8 +151,8 @@ static int si7055_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, si7055_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, si7055_init, NULL, \ &si7055_data_##inst, &si7055_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &si7055_api); \ + &si7055_api); \ DT_INST_FOREACH_STATUS_OKAY(SI7055_DEFINE) diff --git a/drivers/sensor/silabs/si7060/si7060.c b/drivers/sensor/silabs/si7060/si7060.c index ae19030a5dc06..c2de82129c01b 100644 --- a/drivers/sensor/silabs/si7060/si7060.c +++ b/drivers/sensor/silabs/si7060/si7060.c @@ -135,8 +135,8 @@ static int si7060_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, si7060_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, si7060_init, NULL, \ &si7060_data_##inst, &si7060_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &si7060_api); \ + &si7060_api); \ DT_INST_FOREACH_STATUS_OKAY(SI7060_DEFINE) diff --git a/drivers/sensor/silabs/si7210/si7210.c b/drivers/sensor/silabs/si7210/si7210.c index 7aebbab785cb6..672fb1b5f0960 100644 --- a/drivers/sensor/silabs/si7210/si7210.c +++ b/drivers/sensor/silabs/si7210/si7210.c @@ -540,8 +540,8 @@ static int si7210_init(const struct device *dev) .bus = I2C_DT_SPEC_INST_GET(inst), \ }; \ PM_DEVICE_DT_INST_DEFINE(inst, si7210_pm_action); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, si7210_init, PM_DEVICE_DT_INST_GET(inst), \ - &si7210_data_##inst, &si7210_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &si7210_api_funcs); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, si7210_init, PM_DEVICE_DT_INST_GET(inst),\ + &si7210_data_##inst, &si7210_config_##inst, POST_KERNEL, \ + &si7210_api_funcs); DT_INST_FOREACH_STATUS_OKAY(DEFINE_SI7210) diff --git a/drivers/sensor/st/hts221/hts221.c b/drivers/sensor/st/hts221/hts221.c index ef37138460430..3e1af5b97af54 100644 --- a/drivers/sensor/st/hts221/hts221.c +++ b/drivers/sensor/st/hts221/hts221.c @@ -204,13 +204,12 @@ int hts221_init(const struct device *dev) */ #define HTS221_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ hts221_init, \ NULL, \ &hts221_data_##inst, \ &hts221_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &hts221_driver_api); /* diff --git a/drivers/sensor/st/i3g4250d/i3g4250d.c b/drivers/sensor/st/i3g4250d/i3g4250d.c index 4f07d5c78053d..9283a67475104 100644 --- a/drivers/sensor/st/i3g4250d/i3g4250d.c +++ b/drivers/sensor/st/i3g4250d/i3g4250d.c @@ -216,13 +216,12 @@ static int i3g4250d_init(const struct device *dev) SPI_MODE_CPHA | SPI_WORD_SET(8) | SPI_LINES_SINGLE, \ 0), \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ i3g4250d_init, \ NULL, \ &i3g4250d_data_##inst, \ &i3g4250d_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &i3g4250d_driver_api); DT_INST_FOREACH_STATUS_OKAY(I3G4250D_DEVICE_INIT) diff --git a/drivers/sensor/st/iis2dh/iis2dh.c b/drivers/sensor/st/iis2dh/iis2dh.c index d6ef3188da796..658faa846f0bd 100644 --- a/drivers/sensor/st/iis2dh/iis2dh.c +++ b/drivers/sensor/st/iis2dh/iis2dh.c @@ -317,8 +317,8 @@ static int iis2dh_init(const struct device *dev) (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, drdy_gpios, { 0 }),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, iis2dh_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, iis2dh_init, NULL, \ &iis2dh_data_##inst, &iis2dh_device_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &iis2dh_driver_api); \ + &iis2dh_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(IIS2DH_DEFINE) diff --git a/drivers/sensor/st/iis2dlpc/iis2dlpc.c b/drivers/sensor/st/iis2dlpc/iis2dlpc.c index 20254b2ffa486..6f266a31b88bc 100644 --- a/drivers/sensor/st/iis2dlpc/iis2dlpc.c +++ b/drivers/sensor/st/iis2dlpc/iis2dlpc.c @@ -414,13 +414,12 @@ static int iis2dlpc_init(const struct device *dev) */ #define IIS2DLPC_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ iis2dlpc_init, \ NULL, \ &iis2dlpc_data_##inst, \ &iis2dlpc_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &iis2dlpc_driver_api); /* diff --git a/drivers/sensor/st/iis2iclx/iis2iclx.c b/drivers/sensor/st/iis2iclx/iis2iclx.c index 7f0a01baa3008..7cfa8499a876a 100644 --- a/drivers/sensor/st/iis2iclx/iis2iclx.c +++ b/drivers/sensor/st/iis2iclx/iis2iclx.c @@ -627,13 +627,12 @@ static int iis2iclx_init(const struct device *dev) */ #define IIS2ICLX_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ iis2iclx_init, \ NULL, \ &iis2iclx_data_##inst, \ &iis2iclx_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &iis2iclx_driver_api); /* diff --git a/drivers/sensor/st/iis2mdc/iis2mdc.c b/drivers/sensor/st/iis2mdc/iis2mdc.c index 8b4e58c7f3940..0b2154c7c6094 100644 --- a/drivers/sensor/st/iis2mdc/iis2mdc.c +++ b/drivers/sensor/st/iis2mdc/iis2mdc.c @@ -324,13 +324,12 @@ static int iis2mdc_init(const struct device *dev) */ #define IIS2MDC_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ iis2mdc_init, \ NULL, \ &iis2mdc_data_##inst, \ &iis2mdc_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &iis2mdc_driver_api); /* diff --git a/drivers/sensor/st/iis328dq/iis328dq.c b/drivers/sensor/st/iis328dq/iis328dq.c index a38f0f51e8637..ac5c093c48844 100644 --- a/drivers/sensor/st/iis328dq/iis328dq.c +++ b/drivers/sensor/st/iis328dq/iis328dq.c @@ -367,9 +367,9 @@ static int iis328dq_init(const struct device *dev) */ #define IIS328DQ_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, iis328dq_init, NULL, &iis328dq_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, iis328dq_init, NULL, &iis328dq_data_##inst, \ &iis328dq_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &iis328dq_driver_api); + &iis328dq_driver_api); #ifdef CONFIG_IIS328DQ_TRIGGER #ifdef CONFIG_IIS328DQ_THRESHOLD diff --git a/drivers/sensor/st/iis3dhhc/iis3dhhc.c b/drivers/sensor/st/iis3dhhc/iis3dhhc.c index 709f3d8c44847..3fb7912eb02b2 100644 --- a/drivers/sensor/st/iis3dhhc/iis3dhhc.c +++ b/drivers/sensor/st/iis3dhhc/iis3dhhc.c @@ -236,8 +236,8 @@ static int iis3dhhc_init(const struct device *dev) SPI_WORD_SET(8), 0U), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, iis3dhhc_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, iis3dhhc_init, NULL, \ &iis3dhhc_data_##inst, &iis3dhhc_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &iis3dhhc_api_funcs); \ + &iis3dhhc_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(IIS3DHHC_DEFINE) diff --git a/drivers/sensor/st/ism330dhcx/ism330dhcx.c b/drivers/sensor/st/ism330dhcx/ism330dhcx.c index ddea7b33ee26e..13ba2f0745a14 100644 --- a/drivers/sensor/st/ism330dhcx/ism330dhcx.c +++ b/drivers/sensor/st/ism330dhcx/ism330dhcx.c @@ -805,8 +805,8 @@ static int ism330dhcx_init(const struct device *dev) .int_pin = DT_INST_PROP_OR(inst, int_pin, 0),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, ism330dhcx_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, ism330dhcx_init, NULL, \ &ism330dhcx_data_##inst, &ism330dhcx_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &ism330dhcx_api_funcs); \ + &ism330dhcx_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(ISM330DHCX_DEFINE) diff --git a/drivers/sensor/st/lis2de12/lis2de12.c b/drivers/sensor/st/lis2de12/lis2de12.c index 9cceccdeb2061..83214c5adfeb9 100644 --- a/drivers/sensor/st/lis2de12/lis2de12.c +++ b/drivers/sensor/st/lis2de12/lis2de12.c @@ -394,13 +394,12 @@ static int lis2de12_init(const struct device *dev) */ #define LIS2DE12_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ lis2de12_init, \ NULL, \ &lis2de12_data_##inst, \ &lis2de12_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &lis2de12_driver_api); /* diff --git a/drivers/sensor/st/lis2dh/lis2dh.c b/drivers/sensor/st/lis2dh/lis2dh.c index 9eca45335adaa..4fa0cbbdbf891 100644 --- a/drivers/sensor/st/lis2dh/lis2dh.c +++ b/drivers/sensor/st/lis2dh/lis2dh.c @@ -490,13 +490,12 @@ static int lis2dh_pm_action(const struct device *dev, #define LIS2DH_DEVICE_INIT(inst) \ PM_DEVICE_DT_INST_DEFINE(inst, lis2dh_pm_action); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ lis2dh_init, \ PM_DEVICE_DT_INST_GET(inst), \ &lis2dh_data_##inst, \ &lis2dh_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &lis2dh_driver_api); #define IS_LSM303AGR_DEV(inst) \ diff --git a/drivers/sensor/st/lis2ds12/lis2ds12.c b/drivers/sensor/st/lis2ds12/lis2ds12.c index 1dc363c4f0ebc..b4ea53399ecda 100644 --- a/drivers/sensor/st/lis2ds12/lis2ds12.c +++ b/drivers/sensor/st/lis2ds12/lis2ds12.c @@ -333,13 +333,12 @@ static int lis2ds12_init(const struct device *dev) */ #define LIS2DS12_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ lis2ds12_init, \ NULL, \ &lis2ds12_data_##inst, \ &lis2ds12_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &lis2ds12_driver_api); /* diff --git a/drivers/sensor/st/lis2du12/lis2du12.c b/drivers/sensor/st/lis2du12/lis2du12.c index bd5d8b2faf046..e0b299f4b52e3 100644 --- a/drivers/sensor/st/lis2du12/lis2du12.c +++ b/drivers/sensor/st/lis2du12/lis2du12.c @@ -391,13 +391,12 @@ static int lis2du12_init(const struct device *dev) */ #define LIS2DU12_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ lis2du12_init, \ NULL, \ &lis2du12_data_##inst, \ &lis2du12_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &lis2du12_driver_api); /* diff --git a/drivers/sensor/st/lis2dux12/lis2dux12.c b/drivers/sensor/st/lis2dux12/lis2dux12.c index e967f5b8fe45b..54603fcc1e379 100644 --- a/drivers/sensor/st/lis2dux12/lis2dux12.c +++ b/drivers/sensor/st/lis2dux12/lis2dux12.c @@ -379,9 +379,9 @@ static int lis2dux12_init(const struct device *dev) */ #define LIS2DUX12_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, lis2dux12_init, NULL, &lis2dux12_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, lis2dux12_init, NULL, &lis2dux12_data_##inst, \ &lis2dux12_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &lis2dux12_driver_api); + &lis2dux12_driver_api); /* * Instantiation macros used when a device is on a SPI bus. diff --git a/drivers/sensor/st/lis2dw12/lis2dw12.c b/drivers/sensor/st/lis2dw12/lis2dw12.c index 1029376f8dc50..c3194b689ab04 100644 --- a/drivers/sensor/st/lis2dw12/lis2dw12.c +++ b/drivers/sensor/st/lis2dw12/lis2dw12.c @@ -593,13 +593,12 @@ static int lis2dw12_init(const struct device *dev) */ #define LIS2DW12_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ lis2dw12_init, \ NULL, \ &lis2dw12_data_##inst, \ &lis2dw12_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &lis2dw12_driver_api); /* diff --git a/drivers/sensor/st/lis2mdl/lis2mdl.c b/drivers/sensor/st/lis2mdl/lis2mdl.c index 99f2d176f337e..3454468025cf1 100644 --- a/drivers/sensor/st/lis2mdl/lis2mdl.c +++ b/drivers/sensor/st/lis2mdl/lis2mdl.c @@ -490,13 +490,12 @@ static int lis2mdl_pm_action(const struct device *dev, #define LIS2MDL_DEVICE_INIT(inst) \ PM_DEVICE_DT_INST_DEFINE(inst, lis2mdl_pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ lis2mdl_init, \ PM_DEVICE_DT_INST_GET(inst), \ &lis2mdl_data_##inst, \ &lis2mdl_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &lis2mdl_driver_api); /* diff --git a/drivers/sensor/st/lis3mdl/lis3mdl.c b/drivers/sensor/st/lis3mdl/lis3mdl.c index 2567df0cf79ac..ff4ce269e8bba 100644 --- a/drivers/sensor/st/lis3mdl/lis3mdl.c +++ b/drivers/sensor/st/lis3mdl/lis3mdl.c @@ -171,8 +171,8 @@ int lis3mdl_init(const struct device *dev) (.irq_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, irq_gpios, { 0 }),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, lis3mdl_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, lis3mdl_init, NULL, \ &lis3mdl_data_##inst, &lis3mdl_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &lis3mdl_driver_api); \ + &lis3mdl_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(LIS3MDL_DEFINE) diff --git a/drivers/sensor/st/lps22hb/lps22hb.c b/drivers/sensor/st/lps22hb/lps22hb.c index 30d21482546d7..631d9848e4a92 100644 --- a/drivers/sensor/st/lps22hb/lps22hb.c +++ b/drivers/sensor/st/lps22hb/lps22hb.c @@ -151,8 +151,8 @@ static int lps22hb_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, lps22hb_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, lps22hb_init, NULL, \ &lps22hb_data_##inst, &lps22hb_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &lps22hb_api_funcs); \ + &lps22hb_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(LPS22HB_DEFINE) diff --git a/drivers/sensor/st/lps22hh/lps22hh.c b/drivers/sensor/st/lps22hh/lps22hh.c index 77072ea230449..f364872f28a4b 100644 --- a/drivers/sensor/st/lps22hh/lps22hh.c +++ b/drivers/sensor/st/lps22hh/lps22hh.c @@ -351,8 +351,8 @@ static int lps22hh_init(const struct device *dev) (COND_CODE_1(DT_INST_ON_BUS(inst, i3c), \ (LPS22HH_CONFIG_I3C_OR_I2C(inst)), \ (LPS22HH_CONFIG_I2C(inst))))); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, lps22hh_init, NULL, &lps22hh_data_##inst, \ - &lps22hh_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &lps22hh_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, lps22hh_init, NULL, &lps22hh_data_##inst,\ + &lps22hh_config_##inst, POST_KERNEL, \ + &lps22hh_driver_api); DT_INST_FOREACH_STATUS_OKAY(LPS22HH_DEFINE) diff --git a/drivers/sensor/st/lps25hb/lps25hb.c b/drivers/sensor/st/lps25hb/lps25hb.c index 38291b114719e..5289ddc6b9077 100644 --- a/drivers/sensor/st/lps25hb/lps25hb.c +++ b/drivers/sensor/st/lps25hb/lps25hb.c @@ -183,8 +183,8 @@ static int lps25hb_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, lps25hb_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, lps25hb_init, NULL, \ &lps25hb_data_##inst, &lps25hb_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &lps25hb_api_funcs); \ + &lps25hb_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(LPS25HB_DEFINE) diff --git a/drivers/sensor/st/lps2xdf/lps2xdf.c b/drivers/sensor/st/lps2xdf/lps2xdf.c index 0fb7ce87bf828..4dfdb239bbf17 100644 --- a/drivers/sensor/st/lps2xdf/lps2xdf.c +++ b/drivers/sensor/st/lps2xdf/lps2xdf.c @@ -215,9 +215,9 @@ static const struct sensor_driver_api lps2xdf_driver_api = { (LPS2XDF_CONFIG_I3C_OR_I2C(inst, name)), \ (LPS2XDF_CONFIG_I2C(inst, name))))); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, name##_init, NULL, &lps2xdf_data_##name##_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, name##_init, NULL, &lps2xdf_data_##name##_##inst,\ &lps2xdf_config_##name##_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &lps2xdf_driver_api); + &lps2xdf_driver_api); #define DT_DRV_COMPAT st_ilps22qs DT_INST_FOREACH_STATUS_OKAY_VARGS(LPS2XDF_DEFINE, DT_DRV_COMPAT) diff --git a/drivers/sensor/st/lsm303dlhc_magn/lsm303dlhc_magn.c b/drivers/sensor/st/lsm303dlhc_magn/lsm303dlhc_magn.c index ee075bbc01469..19ea1e376389b 100644 --- a/drivers/sensor/st/lsm303dlhc_magn/lsm303dlhc_magn.c +++ b/drivers/sensor/st/lsm303dlhc_magn/lsm303dlhc_magn.c @@ -133,9 +133,8 @@ static int lsm303dlhc_magn_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, lsm303dlhc_magn_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, lsm303dlhc_magn_init, NULL, \ &lsm303dlhc_magn_data_##inst, &lsm303dlhc_magn_config_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &lsm303dlhc_magn_driver_api); \ + POST_KERNEL, &lsm303dlhc_magn_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(LSM303DLHC_MAGN_DEFINE) diff --git a/drivers/sensor/st/lsm6ds0/lsm6ds0.c b/drivers/sensor/st/lsm6ds0/lsm6ds0.c index 918e2747251ae..3fbbe76910163 100644 --- a/drivers/sensor/st/lsm6ds0/lsm6ds0.c +++ b/drivers/sensor/st/lsm6ds0/lsm6ds0.c @@ -486,8 +486,8 @@ static int lsm6ds0_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, lsm6ds0_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, lsm6ds0_init, NULL, \ &lsm6ds0_data_##inst, &lsm6ds0_config_##inst, POST_KERNEL,\ - CONFIG_SENSOR_INIT_PRIORITY, &lsm6ds0_api_funcs); \ + &lsm6ds0_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(LSM6DS0_DEFINE) diff --git a/drivers/sensor/st/lsm6dsl/lsm6dsl.c b/drivers/sensor/st/lsm6dsl/lsm6dsl.c index a29b18e8fea17..4d137ba7888a4 100644 --- a/drivers/sensor/st/lsm6dsl/lsm6dsl.c +++ b/drivers/sensor/st/lsm6dsl/lsm6dsl.c @@ -892,13 +892,12 @@ static int lsm6dsl_pm_action(const struct device *dev, #define LSM6DSL_DEVICE_INIT(inst) \ PM_DEVICE_DT_INST_DEFINE(inst, lsm6dsl_pm_action); \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ lsm6dsl_init, \ PM_DEVICE_DT_INST_GET(inst), \ &lsm6dsl_data_##inst, \ &lsm6dsl_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &lsm6dsl_driver_api); /* diff --git a/drivers/sensor/st/lsm6dso/lsm6dso.c b/drivers/sensor/st/lsm6dso/lsm6dso.c index 872f09dd601a0..dffdb17aea22b 100644 --- a/drivers/sensor/st/lsm6dso/lsm6dso.c +++ b/drivers/sensor/st/lsm6dso/lsm6dso.c @@ -877,13 +877,12 @@ static int lsm6dso_init(const struct device *dev) */ #define LSM6DSO_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ lsm6dso_init, \ NULL, \ &lsm6dso_data_##inst, \ &lsm6dso_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &lsm6dso_driver_api); /* diff --git a/drivers/sensor/st/lsm6dso16is/lsm6dso16is.c b/drivers/sensor/st/lsm6dso16is/lsm6dso16is.c index 111eac80eb891..5ef430e658392 100644 --- a/drivers/sensor/st/lsm6dso16is/lsm6dso16is.c +++ b/drivers/sensor/st/lsm6dso16is/lsm6dso16is.c @@ -853,13 +853,12 @@ static int lsm6dso16is_init(const struct device *dev) */ #define LSM6DSO16IS_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ lsm6dso16is_init, \ NULL, \ &lsm6dso16is_data_##inst, \ &lsm6dso16is_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &lsm6dso16is_driver_api); /* diff --git a/drivers/sensor/st/lsm6dsv16x/lsm6dsv16x.c b/drivers/sensor/st/lsm6dsv16x/lsm6dsv16x.c index 3ac7110786c39..3ca842aa8894e 100644 --- a/drivers/sensor/st/lsm6dsv16x/lsm6dsv16x.c +++ b/drivers/sensor/st/lsm6dsv16x/lsm6dsv16x.c @@ -902,13 +902,12 @@ static int lsm6dsv16x_init(const struct device *dev) */ #define LSM6DSV16X_DEVICE_INIT(inst) \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ lsm6dsv16x_init, \ NULL, \ &lsm6dsv16x_data_##inst, \ &lsm6dsv16x_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &lsm6dsv16x_driver_api); /* diff --git a/drivers/sensor/st/lsm9ds0_gyro/lsm9ds0_gyro.c b/drivers/sensor/st/lsm9ds0_gyro/lsm9ds0_gyro.c index dd8d0f7f703bc..d0f8afbf71bba 100644 --- a/drivers/sensor/st/lsm9ds0_gyro/lsm9ds0_gyro.c +++ b/drivers/sensor/st/lsm9ds0_gyro/lsm9ds0_gyro.c @@ -343,9 +343,8 @@ static int lsm9ds0_gyro_init(const struct device *dev) (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, irq_gpios, { 0 }),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, lsm9ds0_gyro_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, lsm9ds0_gyro_init, NULL, \ &lsm9ds0_gyro_data_##inst, &lsm9ds0_gyro_config_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &lsm9ds0_gyro_api_funcs); \ + POST_KERNEL, &lsm9ds0_gyro_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(LSM9DS0_GYRO_DEFINE) diff --git a/drivers/sensor/st/lsm9ds0_mfd/lsm9ds0_mfd.c b/drivers/sensor/st/lsm9ds0_mfd/lsm9ds0_mfd.c index a442205e368bc..2ca6b30ea636f 100644 --- a/drivers/sensor/st/lsm9ds0_mfd/lsm9ds0_mfd.c +++ b/drivers/sensor/st/lsm9ds0_mfd/lsm9ds0_mfd.c @@ -758,8 +758,8 @@ int lsm9ds0_mfd_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, lsm9ds0_mfd_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, lsm9ds0_mfd_init, NULL, \ &lsm9ds0_mfd_data_##inst, &lsm9ds0_mfd_config_##inst, POST_KERNEL,\ - CONFIG_SENSOR_INIT_PRIORITY, &lsm9ds0_mfd_api_funcs); \ + &lsm9ds0_mfd_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(LSM9DS0_MFD_DEFINE) diff --git a/drivers/sensor/st/lsm9ds1/lsm9ds1.c b/drivers/sensor/st/lsm9ds1/lsm9ds1.c index 4f6131e6b687d..25090f15cf764 100644 --- a/drivers/sensor/st/lsm9ds1/lsm9ds1.c +++ b/drivers/sensor/st/lsm9ds1/lsm9ds1.c @@ -644,8 +644,8 @@ static int lsm9ds1_init(const struct device *dev) \ static struct lsm9ds1_config lsm9ds1_config_##inst = LSM9DS1_CONFIG_I2C(inst); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, lsm9ds1_init, NULL, &lsm9ds1_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, lsm9ds1_init, NULL, &lsm9ds1_data_##inst, \ &lsm9ds1_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &lsm9ds1_api_funcs); + &lsm9ds1_api_funcs); DT_INST_FOREACH_STATUS_OKAY(LSM9DS1_DEFINE); diff --git a/drivers/sensor/st/qdec_stm32/qdec_stm32.c b/drivers/sensor/st/qdec_stm32/qdec_stm32.c index b60c242684fcd..defaf2c2c9518 100644 --- a/drivers/sensor/st/qdec_stm32/qdec_stm32.c +++ b/drivers/sensor/st/qdec_stm32/qdec_stm32.c @@ -159,8 +159,8 @@ static const struct sensor_driver_api qdec_stm32_driver_api = { \ static struct qdec_stm32_dev_data qdec##n##_stm32_data; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, qdec_stm32_initialize, NULL, &qdec##n##_stm32_data, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, qdec_stm32_initialize, NULL, &qdec##n##_stm32_data, \ &qdec##n##_stm32_config, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &qdec_stm32_driver_api); + &qdec_stm32_driver_api); DT_INST_FOREACH_STATUS_OKAY(QDEC_STM32_INIT) diff --git a/drivers/sensor/st/stm32_digi_temp/stm32_digi_temp.c b/drivers/sensor/st/stm32_digi_temp/stm32_digi_temp.c index d862bb7a29a39..4282257b50430 100644 --- a/drivers/sensor/st/stm32_digi_temp/stm32_digi_temp.c +++ b/drivers/sensor/st/stm32_digi_temp/stm32_digi_temp.c @@ -284,11 +284,10 @@ static const struct stm32_digi_temp_config stm32_digi_temp_dev_config_##index = \ PM_DEVICE_DT_INST_DEFINE(index, stm32_digi_temp_pm_action); \ \ -SENSOR_DEVICE_DT_INST_DEFINE(index, stm32_digi_temp_init, \ +SENSOR_DEVICE_INSTANCE_FROM_DT_INST(index, stm32_digi_temp_init, \ PM_DEVICE_DT_INST_GET(index), \ &stm32_digi_temp_dev_data_##index, \ &stm32_digi_temp_dev_config_##index, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &stm32_digi_temp_driver_api); \ + POST_KERNEL, &stm32_digi_temp_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(STM32_DIGI_TEMP_INIT) diff --git a/drivers/sensor/st/stm32_temp/stm32_temp.c b/drivers/sensor/st/stm32_temp/stm32_temp.c index 76e502bcfaeaf..4c4c29a35a086 100644 --- a/drivers/sensor/st/stm32_temp/stm32_temp.c +++ b/drivers/sensor/st/stm32_temp/stm32_temp.c @@ -329,9 +329,8 @@ static const struct stm32_temp_config stm32_temp_dev_config = { .is_ntc = DT_INST_PROP_OR(0, ntc, false) }; -SENSOR_DEVICE_DT_INST_DEFINE(0, stm32_temp_init, NULL, +SENSOR_DEVICE_INSTANCE_FROM_DT_INST(0, stm32_temp_init, NULL, &stm32_temp_dev_data, &stm32_temp_dev_config, - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, - &stm32_temp_driver_api); + POST_KERNEL, &stm32_temp_driver_api); #endif /* !DT_NODE_HAS_STATUS_OKAY(DT_INST_IO_CHANNELS_CTLR(0)) */ diff --git a/drivers/sensor/st/stm32_vbat/stm32_vbat.c b/drivers/sensor/st/stm32_vbat/stm32_vbat.c index 98bebad37faec..1635cf114226a 100644 --- a/drivers/sensor/st/stm32_vbat/stm32_vbat.c +++ b/drivers/sensor/st/stm32_vbat/stm32_vbat.c @@ -148,9 +148,8 @@ static int stm32_vbat_init(const struct device *dev) .ratio = DT_INST_PROP(inst, ratio), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, stm32_vbat_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, stm32_vbat_init, NULL, \ &stm32_vbat_dev_data_##inst, &stm32_vbat_dev_config_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &stm32_vbat_driver_api); + POST_KERNEL, &stm32_vbat_driver_api); DT_INST_FOREACH_STATUS_OKAY(STM32_VBAT_DEFINE) diff --git a/drivers/sensor/st/stm32_vref/stm32_vref.c b/drivers/sensor/st/stm32_vref/stm32_vref.c index b76c2ea0e6ec6..7fa7f59851c39 100644 --- a/drivers/sensor/st/stm32_vref/stm32_vref.c +++ b/drivers/sensor/st/stm32_vref/stm32_vref.c @@ -180,7 +180,7 @@ static const struct stm32_vref_config stm32_vref_dev_config = { .cal_mv = DT_INST_PROP(0, vrefint_cal_mv), }; -SENSOR_DEVICE_DT_INST_DEFINE(0, stm32_vref_init, NULL, &stm32_vref_dev_data, &stm32_vref_dev_config, - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, &stm32_vref_driver_api); +SENSOR_DEVICE_INSTANCE_FROM_DT_INST(0, stm32_vref_init, NULL, &stm32_vref_dev_data, &stm32_vref_dev_config, + POST_KERNEL, &stm32_vref_driver_api); #endif /* !DT_NODE_HAS_STATUS_OKAY(DT_INST_IO_CHANNELS_CTLR(0)) */ diff --git a/drivers/sensor/st/stts22h/stts22h.c b/drivers/sensor/st/stts22h/stts22h.c index fe5bb2dc0ffaa..3d1ee89049aa5 100644 --- a/drivers/sensor/st/stts22h/stts22h.c +++ b/drivers/sensor/st/stts22h/stts22h.c @@ -205,8 +205,8 @@ static int stts22h_init(const struct device *dev) (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, { 0 }),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, stts22h_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, stts22h_init, NULL, \ &stts22h_data_##inst, &stts22h_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &stts22h_api_funcs); \ + &stts22h_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(STTS22H_DEFINE) diff --git a/drivers/sensor/st/stts751/stts751.c b/drivers/sensor/st/stts751/stts751.c index 427f7298a4cac..9e7ac1c68af0b 100644 --- a/drivers/sensor/st/stts751/stts751.c +++ b/drivers/sensor/st/stts751/stts751.c @@ -211,8 +211,8 @@ static int stts751_init(const struct device *dev) (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, drdy_gpios, { 0 }),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, stts751_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, stts751_init, NULL, \ &stts751_data_##inst, &stts751_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &stts751_api_funcs); \ + &stts751_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(STTS751_DEFINE) diff --git a/drivers/sensor/st/vl53l0x/vl53l0x.c b/drivers/sensor/st/vl53l0x/vl53l0x.c index bd822e9e6f20e..8ca3434915a52 100644 --- a/drivers/sensor/st/vl53l0x/vl53l0x.c +++ b/drivers/sensor/st/vl53l0x/vl53l0x.c @@ -388,12 +388,11 @@ static int vl53l0x_pm_action(const struct device *dev, \ PM_DEVICE_DT_INST_DEFINE(inst, vl53l0x_pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, vl53l0x_init, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, vl53l0x_init, \ PM_DEVICE_DT_INST_GET(inst), \ &vl53l0x_##inst##_driver, \ &vl53l0x_##inst##_config, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &vl53l0x_api_funcs); DT_INST_FOREACH_STATUS_OKAY(VL53L0X_INIT) diff --git a/drivers/sensor/st/vl53l1x/vl53l1.c b/drivers/sensor/st/vl53l1x/vl53l1.c index 2422602466372..5f752eafd87fd 100644 --- a/drivers/sensor/st/vl53l1x/vl53l1.c +++ b/drivers/sensor/st/vl53l1x/vl53l1.c @@ -472,13 +472,12 @@ static int vl53l1x_init(const struct device *dev) \ static struct vl53l1x_data vl53l1x_data_##i; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(i, \ - vl53l1x_init, \ - NULL, \ - &vl53l1x_data_##i, \ - &vl53l1x_config_##i, \ - POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(i,\ + vl53l1x_init,\ + NULL,\ + &vl53l1x_data_##i,\ + &vl53l1x_config_##i,\ + POST_KERNEL,\ &vl53l1x_api_funcs); DT_INST_FOREACH_STATUS_OKAY(VL53L1X_INIT) diff --git a/drivers/sensor/sx9500/sx9500.c b/drivers/sensor/sx9500/sx9500.c index 888359a89132a..26a44b32e9521 100644 --- a/drivers/sensor/sx9500/sx9500.c +++ b/drivers/sensor/sx9500/sx9500.c @@ -145,8 +145,8 @@ int sx9500_init(const struct device *dev) (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, { 0 }),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, sx9500_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, sx9500_init, NULL, \ &sx9500_data_##inst, &sx9500_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &sx9500_api_funcs); \ + &sx9500_api_funcs); \ DT_INST_FOREACH_STATUS_OKAY(SX9500_DEFINE) diff --git a/drivers/sensor/tdk/icm42605/icm42605.c b/drivers/sensor/tdk/icm42605/icm42605.c index 3f91c2f53f7f7..024dcb8390dee 100644 --- a/drivers/sensor/tdk/icm42605/icm42605.c +++ b/drivers/sensor/tdk/icm42605/icm42605.c @@ -444,11 +444,10 @@ static const struct sensor_driver_api icm42605_driver_api = { #define ICM42605_INIT(index) \ ICM42605_DEFINE_CONFIG(index); \ static struct icm42605_data icm42605_driver_##index; \ - SENSOR_DEVICE_DT_INST_DEFINE(index, icm42605_init, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(index, icm42605_init, \ NULL, \ &icm42605_driver_##index, \ &icm42605_cfg_##index, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &icm42605_driver_api); DT_INST_FOREACH_STATUS_OKAY(ICM42605_INIT) diff --git a/drivers/sensor/tdk/icm42670/icm42670.c b/drivers/sensor/tdk/icm42670/icm42670.c index fda92574810f3..dc22ca6af10a8 100644 --- a/drivers/sensor/tdk/icm42670/icm42670.c +++ b/drivers/sensor/tdk/icm42670/icm42670.c @@ -716,8 +716,7 @@ static const struct sensor_driver_api icm42670_driver_api = { .gpio_int = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, {0}), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, icm42670_init, NULL, &icm42670_driver_##inst, \ - &icm42670_cfg_##inst, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &icm42670_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, icm42670_init, NULL, &icm42670_driver_##inst, \ + &icm42670_cfg_##inst, POST_KERNEL, &icm42670_driver_api); DT_INST_FOREACH_STATUS_OKAY(ICM42670_INIT) diff --git a/drivers/sensor/tdk/icm42688/icm42688.c b/drivers/sensor/tdk/icm42688/icm42688.c index febb4612efaf8..4fc6fdeb0b1da 100644 --- a/drivers/sensor/tdk/icm42688/icm42688.c +++ b/drivers/sensor/tdk/icm42688/icm42688.c @@ -332,8 +332,8 @@ void icm42688_unlock(const struct device *dev) .gpio_int1 = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, {0}), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, icm42688_init, NULL, &icm42688_driver_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, icm42688_init, NULL, &icm42688_driver_##inst, \ &icm42688_cfg_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &icm42688_driver_api); + &icm42688_driver_api); DT_INST_FOREACH_STATUS_OKAY(ICM42688_INIT) diff --git a/drivers/sensor/tdk/icp10125/icp10125.c b/drivers/sensor/tdk/icp10125/icp10125.c index 71c4e364f32b3..e7ff9770f2de6 100644 --- a/drivers/sensor/tdk/icp10125/icp10125.c +++ b/drivers/sensor/tdk/icp10125/icp10125.c @@ -314,8 +314,7 @@ static const struct sensor_driver_api icp10125_api_funcs = { .i2c = I2C_DT_SPEC_INST_GET(inst), \ .ambient_temp_mode = DT_INST_ENUM_IDX(inst, temperature_measurement_mode), \ .press_mode = DT_INST_ENUM_IDX(inst, pressure_measurement_mode)}; \ - DEVICE_DT_INST_DEFINE(inst, icp10125_init, NULL, &icp10125_drv_##inst, \ - &icp10125_config_##inst, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &icp10125_api_funcs); + DEVICE_INSTANCE_FROM_DT_INST(inst, icp10125_init, NULL, &icp10125_drv_##inst, \ + &icp10125_config_##inst, POST_KERNEL, &icp10125_api_funcs); DT_INST_FOREACH_STATUS_OKAY(ICP10125_DEFINE) diff --git a/drivers/sensor/tdk/mpu6050/mpu6050.c b/drivers/sensor/tdk/mpu6050/mpu6050.c index ce8d157444ff8..343d810a43614 100644 --- a/drivers/sensor/tdk/mpu6050/mpu6050.c +++ b/drivers/sensor/tdk/mpu6050/mpu6050.c @@ -245,9 +245,8 @@ int mpu6050_init(const struct device *dev) (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, { 0 }),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, mpu6050_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, mpu6050_init, NULL, \ &mpu6050_data_##inst, &mpu6050_config_##inst, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &mpu6050_driver_api); \ + POST_KERNEL, &mpu6050_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(MPU6050_DEFINE) diff --git a/drivers/sensor/tdk/mpu9250/mpu9250.c b/drivers/sensor/tdk/mpu9250/mpu9250.c index 8d4571055f474..4adf21ce90909 100644 --- a/drivers/sensor/tdk/mpu9250/mpu9250.c +++ b/drivers/sensor/tdk/mpu9250/mpu9250.c @@ -358,9 +358,8 @@ static int mpu9250_init(const struct device *dev) (.int_pin = GPIO_DT_SPEC_INST_GET(inst, irq_gpios))) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, mpu9250_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, mpu9250_init, NULL, \ &mpu9250_data_##inst, &mpu9250_cfg_##inst,\ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &mpu9250_driver_api); + POST_KERNEL, &mpu9250_driver_api); DT_INST_FOREACH_STATUS_OKAY(INIT_MPU9250_INST) diff --git a/drivers/sensor/th02/th02.c b/drivers/sensor/th02/th02.c index 44c5f0c66f5ba..7ee38b82f54f3 100644 --- a/drivers/sensor/th02/th02.c +++ b/drivers/sensor/th02/th02.c @@ -145,8 +145,8 @@ static int th02_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, th02_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, th02_init, NULL, \ &th02_data_##inst, &th02_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &th02_driver_api); \ + &th02_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(TH02_DEFINE) diff --git a/drivers/sensor/ti/bq274xx/bq274xx.c b/drivers/sensor/ti/bq274xx/bq274xx.c index cb9f8f423062a..8a529a85647c8 100644 --- a/drivers/sensor/ti/bq274xx/bq274xx.c +++ b/drivers/sensor/ti/bq274xx/bq274xx.c @@ -879,11 +879,10 @@ static const struct sensor_driver_api bq274xx_battery_driver_api = { \ PM_BQ274XX_DT_INST_DEFINE(index, bq274xx_pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(index, &bq274xx_gauge_init, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(index, &bq274xx_gauge_init, \ PM_BQ274XX_DT_INST_GET(index), \ &bq274xx_driver_##index, \ &bq274xx_config_##index, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &bq274xx_battery_driver_api); DT_INST_FOREACH_STATUS_OKAY(BQ274XX_INIT) diff --git a/drivers/sensor/ti/fdc2x1x/fdc2x1x.c b/drivers/sensor/ti/fdc2x1x/fdc2x1x.c index 700fd297cb681..f3e7f9c296b8b 100644 --- a/drivers/sensor/ti/fdc2x1x/fdc2x1x.c +++ b/drivers/sensor/ti/fdc2x1x/fdc2x1x.c @@ -1018,13 +1018,12 @@ static int fdc2x1x_init(const struct device *dev) \ PM_DEVICE_DT_INST_DEFINE(n, fdc2x1x_device_pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, \ - fdc2x1x_init, \ - PM_DEVICE_DT_INST_GET(n), \ - &fdc2x1x_data_##n, \ - &fdc2x1x_config_##n, \ - POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, \ + fdc2x1x_init, \ + PM_DEVICE_DT_INST_GET(n), \ + &fdc2x1x_data_##n, \ + &fdc2x1x_config_##n, \ + POST_KERNEL, \ &fdc2x1x_api_funcs); DT_INST_FOREACH_STATUS_OKAY(FDC2X1X_INIT) diff --git a/drivers/sensor/ti/ina219/ina219.c b/drivers/sensor/ti/ina219/ina219.c index 2560d879b8cf1..adbb645e56fd8 100644 --- a/drivers/sensor/ti/ina219/ina219.c +++ b/drivers/sensor/ti/ina219/ina219.c @@ -298,13 +298,12 @@ static const struct sensor_driver_api ina219_api = { \ PM_DEVICE_DT_INST_DEFINE(n, ina219_pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, \ ina219_init, \ PM_DEVICE_DT_INST_GET(n), \ &ina219_data_##n, \ &ina219_config_##n, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &ina219_api); DT_INST_FOREACH_STATUS_OKAY(INA219_INIT) diff --git a/drivers/sensor/ti/ina226/ina226.c b/drivers/sensor/ti/ina226/ina226.c index 5f46b0322f064..a5770053114ca 100644 --- a/drivers/sensor/ti/ina226/ina226.c +++ b/drivers/sensor/ti/ina226/ina226.c @@ -323,13 +323,12 @@ static const struct sensor_driver_api ina226_driver_api = { (DT_INST_ENUM_IDX(inst, vshunt_conversion_time_us) << 3) | \ DT_INST_ENUM_IDX(inst, operating_mode), \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ &ina226_init, \ NULL, \ &ina226_data_##inst, \ &ina226_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &ina226_driver_api); DT_INST_FOREACH_STATUS_OKAY(INA226_DRIVER_INIT) diff --git a/drivers/sensor/ti/ina23x/ina230.c b/drivers/sensor/ti/ina23x/ina230.c index 3ea34e5b5dfde..7caeeb6562cbf 100644 --- a/drivers/sensor/ti/ina23x/ina230.c +++ b/drivers/sensor/ti/ina23x/ina230.c @@ -266,9 +266,9 @@ static const struct sensor_driver_api ina230_driver_api = { (DT_INST_PROP_OR(inst, high_precision, 0) << 1)), \ COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, alert_gpios), (INA230_CFG_IRQ(inst)), \ ())}; \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, &ina230_init, NULL, &drv_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, &ina230_init, NULL, &drv_data_##inst, \ &drv_config_##type##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &ina230_driver_api); + &ina230_driver_api); #undef DT_DRV_COMPAT #define DT_DRV_COMPAT ti_ina230 diff --git a/drivers/sensor/ti/ina23x/ina237.c b/drivers/sensor/ti/ina23x/ina237.c index d63c5e950ba12..c62245e39ec41 100644 --- a/drivers/sensor/ti/ina23x/ina237.c +++ b/drivers/sensor/ti/ina23x/ina237.c @@ -418,8 +418,8 @@ static const struct sensor_driver_api ina237_driver_api = { .alert_config = DT_INST_PROP_OR(inst, alert_config, 0x01), \ .alert_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, alert_gpios, {0}), \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, &ina237_init, NULL, &ina237_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, &ina237_init, NULL, &ina237_data_##inst, \ &ina237_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &ina237_driver_api); \ + &ina237_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(INA237_DRIVER_INIT) diff --git a/drivers/sensor/ti/ina3221/ina3221.c b/drivers/sensor/ti/ina3221/ina3221.c index dc42ec79458cd..133a8461ec693 100644 --- a/drivers/sensor/ti/ina3221/ina3221.c +++ b/drivers/sensor/ti/ina3221/ina3221.c @@ -284,8 +284,7 @@ static const struct sensor_driver_api ina3221_api = { }; \ static struct ina3221_data ina3221_data_##index; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(index, ina3221_init, NULL, &ina3221_data_##index, \ - &ina3221_config_##index, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &ina3221_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(index, ina3221_init, NULL, &ina3221_data_##index, \ + &ina3221_config_##index, POST_KERNEL, &ina3221_api); DT_INST_FOREACH_STATUS_OKAY(INST_DT_INA3221); diff --git a/drivers/sensor/ti/lm95234/lm95234.c b/drivers/sensor/ti/lm95234/lm95234.c index c14f2ce50cc0d..4a2ccaa38b34a 100644 --- a/drivers/sensor/ti/lm95234/lm95234.c +++ b/drivers/sensor/ti/lm95234/lm95234.c @@ -313,12 +313,11 @@ static const struct lm95234_config lm95234_config_##inst = { \ .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ PM_DEVICE_DT_INST_DEFINE(inst, lm95234_pm_action); \ -SENSOR_DEVICE_DT_INST_DEFINE(inst, lm95234_init, \ +SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, lm95234_init, \ PM_DEVICE_DT_INST_GET(inst), \ - &lm95234_data_##inst, \ + &lm95234_data_##inst, \ &lm95234_config_##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &lm95234_driver_api); DT_INST_FOREACH_STATUS_OKAY(LM95234_INST) diff --git a/drivers/sensor/ti/opt3001/opt3001.c b/drivers/sensor/ti/opt3001/opt3001.c index 1ef3c74961bce..bc31dbb7e4bcb 100644 --- a/drivers/sensor/ti/opt3001/opt3001.c +++ b/drivers/sensor/ti/opt3001/opt3001.c @@ -166,8 +166,8 @@ int opt3001_init(const struct device *dev) .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, opt3001_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, opt3001_init, NULL, \ &opt3001_data_##inst, &opt3001_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &opt3001_driver_api); \ + &opt3001_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(OPT3001_DEFINE) diff --git a/drivers/sensor/ti/ti_hdc/ti_hdc.c b/drivers/sensor/ti/ti_hdc/ti_hdc.c index 688d56e3691ab..85367c106707b 100644 --- a/drivers/sensor/ti/ti_hdc/ti_hdc.c +++ b/drivers/sensor/ti/ti_hdc/ti_hdc.c @@ -175,8 +175,8 @@ static int ti_hdc_init(const struct device *dev) .drdy = GPIO_DT_SPEC_INST_GET_OR(inst, drdy_gpios, { 0 }), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, ti_hdc_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, ti_hdc_init, NULL, \ &ti_hdc_data_##inst, &ti_hdc_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &ti_hdc_driver_api); \ + &ti_hdc_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(TI_HDC_DEFINE) diff --git a/drivers/sensor/ti/ti_hdc20xx/ti_hdc20xx.c b/drivers/sensor/ti/ti_hdc20xx/ti_hdc20xx.c index f79a222520575..f817e690a4562 100644 --- a/drivers/sensor/ti/ti_hdc20xx/ti_hdc20xx.c +++ b/drivers/sensor/ti/ti_hdc20xx/ti_hdc20xx.c @@ -248,13 +248,12 @@ static int ti_hdc20xx_init(const struct device *dev) .bus = I2C_DT_SPEC_GET(DT_INST(inst, compat)), \ .gpio_int = GPIO_DT_SPEC_GET_OR(DT_INST(inst, compat), int_gpios, {0}), \ }; \ - DEVICE_DT_DEFINE(DT_INST(inst, compat), \ + DEVICE_INSTANCE(DT_INST(inst, compat), \ ti_hdc20xx_init, \ NULL, \ &ti_hdc20xx_data_##compat##inst, \ &ti_hdc20xx_config_##compat##inst, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &ti_hdc20xx_api_funcs); /* Create the struct device for every status "okay" node in the devicetree. */ diff --git a/drivers/sensor/ti/tmag5170/tmag5170.c b/drivers/sensor/ti/tmag5170/tmag5170.c index 2e34f52dfabcf..85c46eae363d6 100644 --- a/drivers/sensor/ti/tmag5170/tmag5170.c +++ b/drivers/sensor/ti/tmag5170/tmag5170.c @@ -574,13 +574,12 @@ static int tmag5170_init(const struct device *dev) }; \ PM_DEVICE_DT_INST_DEFINE(_num, tmag5170_pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(_num, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(_num, \ tmag5170_init, \ PM_DEVICE_DT_INST_GET(_num), \ &tmag5170_data_##_num, \ &tmag5170_config_##_num, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &tmag5170_driver_api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_TMAG5170) diff --git a/drivers/sensor/ti/tmag5273/tmag5273.c b/drivers/sensor/ti/tmag5273/tmag5273.c index 5f452a75fe759..416802050d9ba 100644 --- a/drivers/sensor/ti/tmag5273/tmag5273.c +++ b/drivers/sensor/ti/tmag5273/tmag5273.c @@ -1242,8 +1242,8 @@ static const struct sensor_driver_api tmag5273_driver_api = { .int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, {0}), \ IF_ENABLED(CONFIG_CRC, (.crc_enabled = DT_INST_PROP(inst, crc_enabled),))}; \ static struct tmag5273_data tmag5273_driver_data##inst; \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, tmag5273_init, NULL, &tmag5273_driver_data##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, tmag5273_init, NULL, &tmag5273_driver_data##inst,\ &tmag5273_driver_cfg##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &tmag5273_driver_api); + &tmag5273_driver_api); DT_INST_FOREACH_STATUS_OKAY(TMAG5273_DEFINE) diff --git a/drivers/sensor/ti/tmp007/tmp007.c b/drivers/sensor/ti/tmp007/tmp007.c index 37b7de714721a..5f3f8c7512464 100644 --- a/drivers/sensor/ti/tmp007/tmp007.c +++ b/drivers/sensor/ti/tmp007/tmp007.c @@ -134,8 +134,8 @@ int tmp007_init(const struct device *dev) (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, { 0 }),)) \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, tmp007_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, tmp007_init, NULL, \ &tmp007_data_##inst, &tmp007_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &tmp007_driver_api); \ + &tmp007_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(TMP007_DEFINE) diff --git a/drivers/sensor/ti/tmp1075/tmp1075.c b/drivers/sensor/ti/tmp1075/tmp1075.c index a3c7db54ac732..de69920375b83 100644 --- a/drivers/sensor/ti/tmp1075/tmp1075.c +++ b/drivers/sensor/ti/tmp1075/tmp1075.c @@ -246,9 +246,9 @@ static int tmp1075_init(const struct device *dev) .bus = I2C_DT_SPEC_INST_GET(inst), \ .alert_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, alert_gpios, {0}), \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, tmp1075_init, NULL, &tmp1075_data_##inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, tmp1075_init, NULL, &tmp1075_data_##inst, \ \ &tmp1075_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &tmp1075_driver_api); + &tmp1075_driver_api); DT_INST_FOREACH_STATUS_OKAY(TMP1075_INST) diff --git a/drivers/sensor/ti/tmp108/tmp108.c b/drivers/sensor/ti/tmp108/tmp108.c index 70dc1e8b5bdbf..a8004e028305b 100644 --- a/drivers/sensor/ti/tmp108/tmp108.c +++ b/drivers/sensor/ti/tmp108/tmp108.c @@ -397,13 +397,12 @@ static int tmp108_init(const struct device *dev) alert_gpios, { 0 }),\ .reg_def = t##_CONF \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, \ &tmp108_init, \ NULL, \ &tmp108_prv_data_##inst##t, \ &tmp108_config_##inst##t, \ POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, \ &tmp108_driver_api); #define TMP108_INIT(n) TMP108_DEFINE(n, TI_TMP108) diff --git a/drivers/sensor/ti/tmp112/tmp112.c b/drivers/sensor/ti/tmp112/tmp112.c index 815d69b406373..60840dabcb57d 100644 --- a/drivers/sensor/ti/tmp112/tmp112.c +++ b/drivers/sensor/ti/tmp112/tmp112.c @@ -209,8 +209,8 @@ int tmp112_init(const struct device *dev) .extended_mode = DT_INST_PROP(inst, extended_mode), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, tmp112_init, NULL, &tmp112_data_##inst, \ - &tmp112_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &tmp112_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, tmp112_init, NULL, &tmp112_data_##inst,\ + &tmp112_config_##inst, POST_KERNEL, \ + &tmp112_driver_api); DT_INST_FOREACH_STATUS_OKAY(TMP112_INST) diff --git a/drivers/sensor/ti/tmp114/tmp114.c b/drivers/sensor/ti/tmp114/tmp114.c index 128bfc53bc26b..24238a6347dc3 100644 --- a/drivers/sensor/ti/tmp114/tmp114.c +++ b/drivers/sensor/ti/tmp114/tmp114.c @@ -232,8 +232,8 @@ static int tmp114_init(const struct device *dev) static const struct tmp114_dev_config tmp114_config_##_num = { \ .bus = I2C_DT_SPEC_INST_GET(_num) \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(_num, tmp114_init, NULL, \ - &tmp114_data_##_num, &tmp114_config_##_num, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &tmp114_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(_num, tmp114_init, NULL,\ + &tmp114_data_##_num, &tmp114_config_##_num, POST_KERNEL,\ + &tmp114_driver_api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_TMP114) diff --git a/drivers/sensor/ti/tmp116/tmp116.c b/drivers/sensor/ti/tmp116/tmp116.c index d52c9d52399b7..87278077aab0a 100644 --- a/drivers/sensor/ti/tmp116/tmp116.c +++ b/drivers/sensor/ti/tmp116/tmp116.c @@ -369,8 +369,8 @@ static int tmp116_init(const struct device *dev) static const struct tmp116_dev_config tmp116_config_##_num = { \ .bus = I2C_DT_SPEC_INST_GET(_num) \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(_num, tmp116_init, NULL, \ - &tmp116_data_##_num, &tmp116_config_##_num, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &tmp116_driver_api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(_num, tmp116_init, NULL,\ + &tmp116_data_##_num, &tmp116_config_##_num, POST_KERNEL,\ + &tmp116_driver_api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_TMP116) diff --git a/drivers/sensor/tsic_xx6/tsic_xx6.c b/drivers/sensor/tsic_xx6/tsic_xx6.c index 5470394a49ff9..441d910b8c4c6 100644 --- a/drivers/sensor/tsic_xx6/tsic_xx6.c +++ b/drivers/sensor/tsic_xx6/tsic_xx6.c @@ -277,8 +277,8 @@ static int tsic_xx6_init(const struct device *dev) .data_bits = DT_INST_PROP(n, data_bits), \ }; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, &tsic_xx6_init, NULL, &tsic_xx6_data_##n, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, &tsic_xx6_init, NULL, &tsic_xx6_data_##n, \ &tsic_xx6_config_##n, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &tsic_xx6_driver_api); + &tsic_xx6_driver_api); DT_INST_FOREACH_STATUS_OKAY(TSIC_XX6_DEVICE) diff --git a/drivers/sensor/veaa_x_3/veaa_x_3.c b/drivers/sensor/veaa_x_3/veaa_x_3.c index c5935942069e7..1a94e3e4b0b8c 100644 --- a/drivers/sensor/veaa_x_3/veaa_x_3.c +++ b/drivers/sensor/veaa_x_3/veaa_x_3.c @@ -210,8 +210,7 @@ static int veaa_x_3_init(const struct device *dev) .dac_resolution = DT_INST_PROP(n, dac_resolution), \ VEAA_X_3_TYPE_INIT(n)}; \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, veaa_x_3_init, NULL, &veaa_x_3_data_##n, \ - &veaa_x_3_cfg_##n, POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ - &veaa_x_3_api_funcs); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, veaa_x_3_init, NULL, &veaa_x_3_data_##n, \ + &veaa_x_3_cfg_##n, POST_KERNEL, &veaa_x_3_api_funcs); DT_INST_FOREACH_STATUS_OKAY(VEAA_X_3_INIT) diff --git a/drivers/sensor/vishay/vcnl36825t/vcnl36825t.c b/drivers/sensor/vishay/vcnl36825t/vcnl36825t.c index 8f3ffb17f45dd..39a2108369773 100644 --- a/drivers/sensor/vishay/vcnl36825t/vcnl36825t.c +++ b/drivers/sensor/vishay/vcnl36825t/vcnl36825t.c @@ -572,10 +572,10 @@ static const struct sensor_driver_api vcnl36825t_driver_api = { .int_proximity_count = DT_INST_PROP(inst, int_proximity_count), \ .int_smart_persistence = DT_INST_PROP(inst, int_smart_persistence)))}; \ IF_ENABLED(CONFIG_PM_DEVICE, (PM_DEVICE_DT_INST_DEFINE(inst, vcnl36825t_pm_action))); \ - SENSOR_DEVICE_DT_INST_DEFINE( \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST( \ inst, vcnl36825t_init, \ COND_CODE_1(CONFIG_PM_DEVICE, (PM_DEVICE_DT_INST_GET(inst)), (NULL)), \ &vcnl36825t_data_##inst, &vcnl36825t_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &vcnl36825t_driver_api); + &vcnl36825t_driver_api); DT_INST_FOREACH_STATUS_OKAY(VCNL36825T_DEFINE) diff --git a/drivers/sensor/vishay/vcnl4040/vcnl4040.c b/drivers/sensor/vishay/vcnl4040/vcnl4040.c index ffc39ca32bb96..5a624952b88e8 100644 --- a/drivers/sensor/vishay/vcnl4040/vcnl4040.c +++ b/drivers/sensor/vishay/vcnl4040/vcnl4040.c @@ -316,8 +316,8 @@ static const struct sensor_driver_api vcnl4040_driver_api = { \ PM_DEVICE_DT_INST_DEFINE(inst, vcnl4040_pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, vcnl4040_init, PM_DEVICE_DT_INST_GET(inst), \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, vcnl4040_init, PM_DEVICE_DT_INST_GET(inst), \ &vcnl4040_data_##inst, &vcnl4040_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &vcnl4040_driver_api); \ + &vcnl4040_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(VCNL4040_DEFINE) diff --git a/drivers/sensor/vishay/veml7700/veml7700.c b/drivers/sensor/vishay/veml7700/veml7700.c index 63e5da14adc3c..a1fe1d1c5a768 100644 --- a/drivers/sensor/vishay/veml7700/veml7700.c +++ b/drivers/sensor/vishay/veml7700/veml7700.c @@ -598,8 +598,8 @@ static const struct sensor_driver_api veml7700_api = {.sample_fetch = veml7700_s \ PM_DEVICE_DT_INST_DEFINE(n, veml7700_pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(n, veml7700_init, PM_DEVICE_DT_INST_GET(n), \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, veml7700_init, PM_DEVICE_DT_INST_GET(n), \ &veml7700_data_##n, &veml7700_config_##n, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &veml7700_api); + &veml7700_api); DT_INST_FOREACH_STATUS_OKAY(VEML7700_INIT) diff --git a/drivers/sensor/voltage_divider/voltage.c b/drivers/sensor/voltage_divider/voltage.c index b426f00145642..8b988b7b5e795 100644 --- a/drivers/sensor/voltage_divider/voltage.c +++ b/drivers/sensor/voltage_divider/voltage.c @@ -185,8 +185,8 @@ static int voltage_init(const struct device *dev) \ PM_DEVICE_DT_INST_DEFINE(inst, pm_action); \ \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, &voltage_init, PM_DEVICE_DT_INST_GET(inst), \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, &voltage_init, PM_DEVICE_DT_INST_GET(inst), \ &voltage_##inst##_data, &voltage_##inst##_config, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &voltage_api); + &voltage_api); DT_INST_FOREACH_STATUS_OKAY(VOLTAGE_INIT) diff --git a/drivers/sensor/wsen/wsen_hids_2525020210002/wsen_hids_2525020210002.c b/drivers/sensor/wsen/wsen_hids_2525020210002/wsen_hids_2525020210002.c index eb2157d3a57e2..b49554fefd9fc 100644 --- a/drivers/sensor/wsen/wsen_hids_2525020210002/wsen_hids_2525020210002.c +++ b/drivers/sensor/wsen/wsen_hids_2525020210002/wsen_hids_2525020210002.c @@ -240,9 +240,9 @@ static int hids_2525020210002_init(const struct device *dev) .precision = (hids_2525020210002_precision_t)(DT_INST_ENUM_IDX(inst, precision)), \ .heater = (hids_2525020210002_heater_t)(DT_INST_ENUM_IDX(inst, heater)), \ }; \ - SENSOR_DEVICE_DT_INST_DEFINE(inst, hids_2525020210002_init, NULL, \ + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, hids_2525020210002_init, NULL, \ &hids_2525020210002_data_##inst, \ &hids_2525020210002_config_##inst, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &hids_2525020210002_driver_api); + &hids_2525020210002_driver_api); DT_INST_FOREACH_STATUS_OKAY(HIDS_2525020210002_DEFINE) diff --git a/drivers/serial/leuart_gecko.c b/drivers/serial/leuart_gecko.c index 335e2285c1acc..1ead7cfc869e2 100644 --- a/drivers/serial/leuart_gecko.c +++ b/drivers/serial/leuart_gecko.c @@ -351,10 +351,9 @@ static const struct leuart_gecko_config leuart_gecko_0_config = { static struct leuart_gecko_data leuart_gecko_0_data; -DEVICE_DT_INST_DEFINE(0, &leuart_gecko_init, +DEVICE_INSTANCE_FROM_DT_INST(0, &leuart_gecko_init, NULL, &leuart_gecko_0_data, &leuart_gecko_0_config, PRE_KERNEL_1, - CONFIG_SERIAL_INIT_PRIORITY, &leuart_gecko_driver_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN @@ -404,10 +403,9 @@ static const struct leuart_gecko_config leuart_gecko_1_config = { static struct leuart_gecko_data leuart_gecko_1_data; -DEVICE_DT_INST_DEFINE(1, &leuart_gecko_init, +DEVICE_INSTANCE_FROM_DT_INST(1, &leuart_gecko_init, NULL, &leuart_gecko_1_data, &leuart_gecko_1_config, PRE_KERNEL_1, - CONFIG_SERIAL_INIT_PRIORITY, &leuart_gecko_driver_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN diff --git a/drivers/serial/serial_esp32_usb.c b/drivers/serial/serial_esp32_usb.c index bc4fc0421bf57..2d6ce58856140 100644 --- a/drivers/serial/serial_esp32_usb.c +++ b/drivers/serial/serial_esp32_usb.c @@ -281,6 +281,6 @@ static const DRAM_ATTR struct serial_esp32_usb_config serial_esp32_usb_cfg = { static struct serial_esp32_usb_data serial_esp32_usb_data_0; -DEVICE_DT_INST_DEFINE(0, serial_esp32_usb_init, NULL, &serial_esp32_usb_data_0, +DEVICE_INSTANCE_FROM_DT_INST(0, serial_esp32_usb_init, NULL, &serial_esp32_usb_data_0, &serial_esp32_usb_cfg, PRE_KERNEL_1, - CONFIG_SERIAL_INIT_PRIORITY, &serial_esp32_usb_api); + &serial_esp32_usb_api); diff --git a/drivers/serial/serial_test.c b/drivers/serial/serial_test.c index f04f5eee702cb..56bca08c7dac9 100644 --- a/drivers/serial/serial_test.c +++ b/drivers/serial/serial_test.c @@ -463,7 +463,7 @@ static const struct uart_driver_api serial_vnd_api = { #define VND_SERIAL_INIT(n) \ COND_CODE_1(DT_INST_NODE_HAS_PROP(n, buffer_size), (VND_SERIAL_DATA_BUFFER(n)), \ (VND_SERIAL_DATA(n))) \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, &serial_vnd_data_##n, NULL, POST_KERNEL, \ - CONFIG_SERIAL_INIT_PRIORITY, &serial_vnd_api); + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, &serial_vnd_data_##n, NULL, POST_KERNEL, \ + &serial_vnd_api); DT_INST_FOREACH_STATUS_OKAY(VND_SERIAL_INIT) diff --git a/drivers/serial/uart_altera.c b/drivers/serial/uart_altera.c index 6d67d7c39c08a..c864a1b23a804 100644 --- a/drivers/serial/uart_altera.c +++ b/drivers/serial/uart_altera.c @@ -979,13 +979,12 @@ static const struct uart_altera_device_config uart_altera_dev_cfg_##n = { \ UART_ALTERA_IRQ_CONFIG_INIT(n) \ }; \ \ -DEVICE_DT_INST_DEFINE(n, \ - uart_altera_init, \ - NULL, \ - &uart_altera_dev_data_##n, \ - &uart_altera_dev_cfg_##n, \ - PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ +DEVICE_INSTANCE_FROM_DT_INST(n, \ + uart_altera_init, \ + NULL, \ + &uart_altera_dev_data_##n, \ + &uart_altera_dev_cfg_##n, \ + PRE_KERNEL_1, \ &uart_altera_driver_api); DT_INST_FOREACH_STATUS_OKAY(UART_ALTERA_DEVICE_INIT) diff --git a/drivers/serial/uart_altera_jtag.c b/drivers/serial/uart_altera_jtag.c index 18e4af3aa00d7..847933d2d8f88 100644 --- a/drivers/serial/uart_altera_jtag.c +++ b/drivers/serial/uart_altera_jtag.c @@ -538,8 +538,7 @@ static const struct uart_driver_api uart_altera_jtag_driver_api = { #ifdef CONFIG_UART_ALTERA_JTAG_HAL #define UART_ALTERA_JTAG_DEVICE_INIT(n) \ -DEVICE_DT_INST_DEFINE(n, uart_altera_jtag_init, NULL, NULL, NULL, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ +DEVICE_INSTANCE_FROM_DT_INST(n, uart_altera_jtag_init, NULL, NULL, NULL, PRE_KERNEL_1,\ &uart_altera_jtag_driver_api); #else @@ -575,13 +574,12 @@ static const struct uart_altera_jtag_device_config uart_altera_jtag_dev_cfg_##n .base = DT_INST_REG_ADDR(n), \ UART_ALTERA_JTAG_CONFIG_INIT(n) \ }; \ -DEVICE_DT_INST_DEFINE(n, \ - uart_altera_jtag_init, \ - NULL, \ - &uart_altera_jtag_device_data_##n, \ - &uart_altera_jtag_dev_cfg_##n, \ - PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ +DEVICE_INSTANCE_FROM_DT_INST(n, \ + uart_altera_jtag_init, \ + NULL, \ + &uart_altera_jtag_device_data_##n, \ + &uart_altera_jtag_dev_cfg_##n, \ + PRE_KERNEL_1, \ &uart_altera_jtag_driver_api); #endif /* CONFIG_UART_ALTERA_JTAG_HAL */ diff --git a/drivers/serial/uart_apbuart.c b/drivers/serial/uart_apbuart.c index a50fb126e0a70..9c261931542b8 100644 --- a/drivers/serial/uart_apbuart.c +++ b/drivers/serial/uart_apbuart.c @@ -552,13 +552,12 @@ static const struct uart_driver_api apbuart_driver_api = { .usefifo = 0, \ }; \ \ - DEVICE_DT_INST_DEFINE(index, \ + DEVICE_INSTANCE_FROM_DT_INST(index, \ &apbuart_init, \ NULL, \ &apbuart##index##_data, \ &apbuart##index##_config, \ PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &apbuart_driver_api); DT_INST_FOREACH_STATUS_OKAY(APBUART_INIT) diff --git a/drivers/serial/uart_b91.c b/drivers/serial/uart_b91.c index e2502f4fd9b0e..aa81471dca5d6 100644 --- a/drivers/serial/uart_b91.c +++ b/drivers/serial/uart_b91.c @@ -565,13 +565,12 @@ static const struct uart_driver_api uart_b91_driver_api = { \ static struct uart_b91_data uart_b91_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, uart_b91_driver_init, \ - NULL, \ - &uart_b91_data_##n, \ - &uart_b91_cfg_##n, \ - PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ - (void *)&uart_b91_driver_api); \ + DEVICE_INSTANCE_FROM_DT_INST(n, uart_b91_driver_init, \ + NULL, \ + &uart_b91_data_##n, \ + &uart_b91_cfg_##n, \ + PRE_KERNEL_1, \ + (void *)&uart_b91_driver_api); \ \ static void uart_b91_irq_connect_##n(void) \ { \ diff --git a/drivers/serial/uart_bcm2711.c b/drivers/serial/uart_bcm2711.c index 2d501f05f5a40..7acaac52a7cb5 100644 --- a/drivers/serial/uart_bcm2711.c +++ b/drivers/serial/uart_bcm2711.c @@ -321,9 +321,9 @@ static const struct uart_driver_api uart_bcm2711_driver_api = { \ static const struct bcm2711_uart_config bcm2711_uart_##n##_config; \ \ - DEVICE_DT_INST_DEFINE(n, &uart_bcm2711_init, NULL, &bcm2711_uart_##n##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &uart_bcm2711_init, NULL, &bcm2711_uart_##n##_data, \ &bcm2711_uart_##n##_config, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, &uart_bcm2711_driver_api); \ + &uart_bcm2711_driver_api); \ \ UART_CONFIG_FUNC(n) \ \ diff --git a/drivers/serial/uart_bt.c b/drivers/serial/uart_bt.c index b90fb1bc5bb86..08c8a6c364b94 100644 --- a/drivers/serial/uart_bt.c +++ b/drivers/serial/uart_bt.c @@ -364,9 +364,8 @@ static int uart_bt_init(const struct device *dev) }, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, uart_bt_init, NULL, &uart_bt_data_##n, \ - NULL, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(n, uart_bt_init, NULL, &uart_bt_data_##n, \ + NULL, PRE_KERNEL_1, \ &uart_bt_driver_api); DT_INST_FOREACH_STATUS_OKAY(UART_BT_INIT) diff --git a/drivers/serial/uart_cc13xx_cc26xx.c b/drivers/serial/uart_cc13xx_cc26xx.c index ae74e74d8ce7f..a36aee4b47d6b 100644 --- a/drivers/serial/uart_cc13xx_cc26xx.c +++ b/drivers/serial/uart_cc13xx_cc26xx.c @@ -572,12 +572,11 @@ static const struct uart_driver_api uart_cc13xx_cc26xx_driver_api = { #define UART_CC13XX_CC26XX_DEVICE_DEFINE(n) \ PM_DEVICE_DT_INST_DEFINE(n, uart_cc13xx_cc26xx_pm_action); \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ uart_cc13xx_cc26xx_init_##n, \ PM_DEVICE_DT_INST_GET(n), \ - &uart_cc13xx_cc26xx_data_##n, &uart_cc13xx_cc26xx_config_##n,\ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &uart_cc13xx_cc26xx_driver_api) + &uart_cc13xx_cc26xx_data_##n, &uart_cc13xx_cc26xx_config_##n, \ + PRE_KERNEL_1, &uart_cc13xx_cc26xx_driver_api) #define UART_CC13XX_CC26XX_INIT_FUNC(n) \ static int uart_cc13xx_cc26xx_init_##n(const struct device *dev) \ diff --git a/drivers/serial/uart_cc32xx.c b/drivers/serial/uart_cc32xx.c index 9427e0a625ed7..f7f8f8664587f 100644 --- a/drivers/serial/uart_cc32xx.c +++ b/drivers/serial/uart_cc32xx.c @@ -337,10 +337,9 @@ static struct uart_cc32xx_dev_data_t uart_cc32xx_dev_data_##idx = { \ .baud_rate = DT_INST_PROP(idx, current_speed), \ IF_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN, (.cb = NULL,)) \ }; \ -DEVICE_DT_INST_DEFINE(idx, uart_cc32xx_init, \ - NULL, &uart_cc32xx_dev_data_##idx, \ - &uart_cc32xx_dev_cfg_##idx, \ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - (void *)&uart_cc32xx_driver_api); \ +DEVICE_INSTANCE_FROM_DT_INST(idx, uart_cc32xx_init,\ + NULL, &uart_cc32xx_dev_data_##idx, \ + &uart_cc32xx_dev_cfg_##idx, \ + PRE_KERNEL_1, (void *)&uart_cc32xx_driver_api);\ DT_INST_FOREACH_STATUS_OKAY(UART_32XX_DEVICE); diff --git a/drivers/serial/uart_cdns.c b/drivers/serial/uart_cdns.c index 9e50052a9d866..f13de4248b7e0 100644 --- a/drivers/serial/uart_cdns.c +++ b/drivers/serial/uart_cdns.c @@ -300,8 +300,8 @@ static int uart_cdns_init(const struct device *dev) .parity = CDNS_PARTITY_MAP(DT_ENUM_IDX(DT_DRV_INST(n), parity)), \ UART_CDNS_IRQ_CFG_FUNC_INIT(n)}; \ \ - DEVICE_DT_INST_DEFINE(n, uart_cdns_init, NULL, &uart_cdns_data_##n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, uart_cdns_init, NULL, &uart_cdns_data_##n, \ &uart_cdns_dev_cfg_##n, PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &uart_cdns_driver_api); + &uart_cdns_driver_api); DT_INST_FOREACH_STATUS_OKAY(UART_CDNS_INIT) diff --git a/drivers/serial/uart_cmsdk_apb.c b/drivers/serial/uart_cmsdk_apb.c index e4ceb883bd624..aab8211eed1b3 100644 --- a/drivers/serial/uart_cmsdk_apb.c +++ b/drivers/serial/uart_cmsdk_apb.c @@ -499,12 +499,11 @@ static struct uart_cmsdk_apb_dev_data uart_cmsdk_apb_dev_data_0 = { .device = DT_INST_REG_ADDR(0),}, }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, uart_cmsdk_apb_init, NULL, &uart_cmsdk_apb_dev_data_0, &uart_cmsdk_apb_dev_cfg_0, PRE_KERNEL_1, - CONFIG_SERIAL_INIT_PRIORITY, &uart_cmsdk_apb_driver_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN @@ -564,12 +563,11 @@ static struct uart_cmsdk_apb_dev_data uart_cmsdk_apb_dev_data_1 = { .device = DT_INST_REG_ADDR(1),}, }; -DEVICE_DT_INST_DEFINE(1, +DEVICE_INSTANCE_FROM_DT_INST(1, uart_cmsdk_apb_init, NULL, &uart_cmsdk_apb_dev_data_1, &uart_cmsdk_apb_dev_cfg_1, PRE_KERNEL_1, - CONFIG_SERIAL_INIT_PRIORITY, &uart_cmsdk_apb_driver_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN @@ -629,12 +627,11 @@ static struct uart_cmsdk_apb_dev_data uart_cmsdk_apb_dev_data_2 = { .device = DT_INST_REG_ADDR(2),}, }; -DEVICE_DT_INST_DEFINE(2, +DEVICE_INSTANCE_FROM_DT_INST(2, uart_cmsdk_apb_init, NULL, &uart_cmsdk_apb_dev_data_2, &uart_cmsdk_apb_dev_cfg_2, PRE_KERNEL_1, - CONFIG_SERIAL_INIT_PRIORITY, &uart_cmsdk_apb_driver_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN @@ -694,12 +691,11 @@ static struct uart_cmsdk_apb_dev_data uart_cmsdk_apb_dev_data_3 = { .device = DT_INST_REG_ADDR(3),}, }; -DEVICE_DT_INST_DEFINE(3, +DEVICE_INSTANCE_FROM_DT_INST(3, uart_cmsdk_apb_init, NULL, &uart_cmsdk_apb_dev_data_3, &uart_cmsdk_apb_dev_cfg_3, PRE_KERNEL_1, - CONFIG_SERIAL_INIT_PRIORITY, &uart_cmsdk_apb_driver_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN @@ -759,12 +755,11 @@ static struct uart_cmsdk_apb_dev_data uart_cmsdk_apb_dev_data_4 = { .device = DT_INST_REG_ADDR(4),}, }; -DEVICE_DT_INST_DEFINE(4, +DEVICE_INSTANCE_FROM_DT_INST(4, uart_cmsdk_apb_init, NULL, &uart_cmsdk_apb_dev_data_4, &uart_cmsdk_apb_dev_cfg_4, PRE_KERNEL_1, - CONFIG_SERIAL_INIT_PRIORITY, &uart_cmsdk_apb_driver_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN diff --git a/drivers/serial/uart_efinix_sapphire.c b/drivers/serial/uart_efinix_sapphire.c index 06ce999538a55..2aa2fd5b912c3 100644 --- a/drivers/serial/uart_efinix_sapphire.c +++ b/drivers/serial/uart_efinix_sapphire.c @@ -86,5 +86,5 @@ static int uart_efinix_sapphire_init(const struct device *dev) } /* Device tree instance 0 init */ -DEVICE_DT_INST_DEFINE(0, uart_efinix_sapphire_init, NULL, NULL, &uart_efinix_sapphire_cfg_0, - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, (void *)&uart_efinix_sapphire_api); +DEVICE_INSTANCE_FROM_DT_INST(0, uart_efinix_sapphire_init, NULL, NULL, &uart_efinix_sapphire_cfg_0, + PRE_KERNEL_1, (void *)&uart_efinix_sapphire_api); diff --git a/drivers/serial/uart_emul.c b/drivers/serial/uart_emul.c index a00f10486b129..06ea3550ebfec 100644 --- a/drivers/serial/uart_emul.c +++ b/drivers/serial/uart_emul.c @@ -1050,7 +1050,7 @@ int uart_emul_register(const struct device *dev, struct uart_emul *emul) } \ SYS_INIT(uart_emul_post_init_##inst, POST_KERNEL, CONFIG_UART_EMUL_DEVICE_INIT_PRIORITY); \ \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &uart_emul_data_##inst, &uart_emul_cfg_##inst, \ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, &uart_emul_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &uart_emul_data_##inst, &uart_emul_cfg_##inst,\ + PRE_KERNEL_1, &uart_emul_api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_UART_EMUL) diff --git a/drivers/serial/uart_ene_kb1200.c b/drivers/serial/uart_ene_kb1200.c index 5496d6a60dabd..f92a4f2ab8157 100644 --- a/drivers/serial/uart_ene_kb1200.c +++ b/drivers/serial/uart_ene_kb1200.c @@ -373,8 +373,7 @@ static void kb1200_uart_irq_init(void) IF_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN, (.irq_cfg_func = kb1200_uart_irq_init,)) \ .ser = (struct serial_regs *)DT_INST_REG_ADDR(n), \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n)}; \ - DEVICE_DT_INST_DEFINE(n, kb1200_uart_init, NULL, &kb1200_uart_data_##n, \ - &kb1200_uart_config_##n, PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &kb1200_uart_api); + DEVICE_INSTANCE_FROM_DT_INST(n, kb1200_uart_init, NULL, &kb1200_uart_data_##n, \ + &kb1200_uart_config_##n, PRE_KERNEL_1, &kb1200_uart_api); DT_INST_FOREACH_STATUS_OKAY(KB1200_UART_INIT) diff --git a/drivers/serial/uart_esp32.c b/drivers/serial/uart_esp32.c index da2cfdb876b4e..40b8f3285ad15 100644 --- a/drivers/serial/uart_esp32.c +++ b/drivers/serial/uart_esp32.c @@ -1045,8 +1045,8 @@ static const DRAM_ATTR struct uart_driver_api uart_esp32_api = { }, \ ESP_UART_UHCI_INIT(idx)}; \ \ - DEVICE_DT_INST_DEFINE(idx, uart_esp32_init, NULL, &uart_esp32_data_##idx, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, uart_esp32_init, NULL, &uart_esp32_data_##idx, \ &uart_esp32_cfg_port_##idx, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, &uart_esp32_api); + &uart_esp32_api); DT_INST_FOREACH_STATUS_OKAY(ESP32_UART_INIT); diff --git a/drivers/serial/uart_gecko.c b/drivers/serial/uart_gecko.c index 32d3c71c910c1..16556d1b06542 100644 --- a/drivers/serial/uart_gecko.c +++ b/drivers/serial/uart_gecko.c @@ -670,11 +670,10 @@ static const struct uart_driver_api uart_gecko_driver_api = { \ static struct uart_gecko_data uart_gecko_data_##idx; \ \ - DEVICE_DT_INST_DEFINE(idx, uart_gecko_init, \ - NULL, &uart_gecko_data_##idx, \ - &uart_gecko_cfg_##idx, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ - &uart_gecko_driver_api); \ + DEVICE_INSTANCE_FROM_DT_INST(idx, uart_gecko_init, \ + NULL, &uart_gecko_data_##idx, \ + &uart_gecko_cfg_##idx, PRE_KERNEL_1, \ + &uart_gecko_driver_api); \ \ \ GECKO_UART_IRQ_HANDLER(idx) @@ -724,11 +723,10 @@ DT_INST_FOREACH_STATUS_OKAY(GECKO_UART_INIT) \ static struct uart_gecko_data usart_gecko_data_##idx; \ \ - DEVICE_DT_INST_DEFINE(idx, uart_gecko_init, PM_DEVICE_DT_INST_GET(idx),\ - &usart_gecko_data_##idx, \ - &usart_gecko_cfg_##idx, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ - &uart_gecko_driver_api); \ + DEVICE_INSTANCE_FROM_DT_INST(idx, uart_gecko_init, PM_DEVICE_DT_INST_GET(idx),\ + &usart_gecko_data_##idx, \ + &usart_gecko_cfg_##idx, PRE_KERNEL_1, \ + &uart_gecko_driver_api); \ \ GECKO_USART_IRQ_HANDLER(idx) #else @@ -753,11 +751,10 @@ DT_INST_FOREACH_STATUS_OKAY(GECKO_UART_INIT) \ static struct uart_gecko_data usart_gecko_data_##idx; \ \ - DEVICE_DT_INST_DEFINE(idx, uart_gecko_init, PM_DEVICE_DT_INST_GET(idx),\ - &usart_gecko_data_##idx, \ - &usart_gecko_cfg_##idx, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ - &uart_gecko_driver_api); \ + DEVICE_INSTANCE_FROM_DT_INST(idx, uart_gecko_init, PM_DEVICE_DT_INST_GET(idx),\ + &usart_gecko_data_##idx, \ + &usart_gecko_cfg_##idx, PRE_KERNEL_1, \ + &uart_gecko_driver_api); \ \ GECKO_USART_IRQ_HANDLER(idx) #endif diff --git a/drivers/serial/uart_hostlink.c b/drivers/serial/uart_hostlink.c index 396422b6e1903..c0dfa0cd2cf45 100644 --- a/drivers/serial/uart_hostlink.c +++ b/drivers/serial/uart_hostlink.c @@ -399,5 +399,5 @@ static const struct uart_driver_api uart_hostlink_driver_api = { .poll_out = uart_hostlink_poll_out, }; -DEVICE_DT_DEFINE(DT_NODELABEL(hostlink), NULL, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_SERIAL_INIT_PRIORITY, &uart_hostlink_driver_api); +DEVICE_INSTANCE(DT_NODELABEL(hostlink), NULL, NULL, NULL, NULL, PRE_KERNEL_1, + &uart_hostlink_driver_api); diff --git a/drivers/serial/uart_hvc_xen.c b/drivers/serial/uart_hvc_xen.c index 800603fc25850..6ceda0b0ae8bb 100644 --- a/drivers/serial/uart_hvc_xen.c +++ b/drivers/serial/uart_hvc_xen.c @@ -264,9 +264,8 @@ int xen_console_init(const struct device *dev) return 0; } -DEVICE_DT_DEFINE(DT_NODELABEL(xen_hvc), xen_console_init, NULL, &xen_hvc_data, - NULL, PRE_KERNEL_1, CONFIG_XEN_HVC_INIT_PRIORITY, - &xen_hvc_api); +DEVICE_INSTANCE(DT_NODELABEL(xen_hvc), xen_console_init, NULL, &xen_hvc_data, + NULL, PRE_KERNEL_1, &xen_hvc_api); #ifdef CONFIG_XEN_EARLY_CONSOLEIO int xen_consoleio_putc(int c) diff --git a/drivers/serial/uart_hvc_xen_consoleio.c b/drivers/serial/uart_hvc_xen_consoleio.c index 97e411a93063f..c34fdd42398e8 100644 --- a/drivers/serial/uart_hvc_xen_consoleio.c +++ b/drivers/serial/uart_hvc_xen_consoleio.c @@ -52,6 +52,5 @@ static int xen_consoleio_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, xen_consoleio_init, NULL, NULL, - NULL, PRE_KERNEL_1, CONFIG_XEN_HVC_INIT_PRIORITY, - &xen_consoleio_hvc_api); +DEVICE_INSTANCE_FROM_DT_INST(0, xen_consoleio_init, NULL, NULL, + NULL, PRE_KERNEL_1, &xen_consoleio_hvc_api); diff --git a/drivers/serial/uart_ifx_cat1.c b/drivers/serial/uart_ifx_cat1.c index dd0f01b14e5c5..271ab5c75bf62 100644 --- a/drivers/serial/uart_ifx_cat1.c +++ b/drivers/serial/uart_ifx_cat1.c @@ -525,11 +525,10 @@ static const struct uart_driver_api ifx_cat1_uart_driver_api = { .irq_priority = DT_INST_IRQ(n, priority) \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ ifx_cat1_uart_init, NULL, \ &ifx_cat1_uart##n##_data, \ &ifx_cat1_uart##n##_cfg, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &ifx_cat1_uart_driver_api); DT_INST_FOREACH_STATUS_OKAY(INFINEON_CAT1_UART_INIT) diff --git a/drivers/serial/uart_imx.c b/drivers/serial/uart_imx.c index 08eb870363b00..9ea04ca9ebb21 100644 --- a/drivers/serial/uart_imx.c +++ b/drivers/serial/uart_imx.c @@ -326,10 +326,9 @@ static const struct uart_driver_api uart_imx_driver_api = { \ PINCTRL_DT_INST_DEFINE(n); \ \ - DEVICE_DT_INST_DEFINE(n, uart_imx_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, uart_imx_init, NULL, \ &imx_uart_##n##_data, &imx_uart_##n##_config, \ PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &uart_imx_driver_api); \ \ UART_IMX_CONFIG_FUNC(n) \ diff --git a/drivers/serial/uart_intel_lw.c b/drivers/serial/uart_intel_lw.c index 67f2a829778e1..fd658171386df 100644 --- a/drivers/serial/uart_intel_lw.c +++ b/drivers/serial/uart_intel_lw.c @@ -1013,13 +1013,12 @@ static const struct uart_intel_lw_device_config uart_intel_lw_dev_cfg_##n = { UART_INTEL_LW_IRQ_CONFIG_INIT(n) \ }; \ \ -DEVICE_DT_INST_DEFINE(n, \ +DEVICE_INSTANCE_FROM_DT_INST(n, \ uart_intel_lw_init, \ NULL, \ &uart_intel_lw_dev_data_##n, \ &uart_intel_lw_dev_cfg_##n, \ PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &uart_intel_lw_driver_api); DT_INST_FOREACH_STATUS_OKAY(UART_INTEL_LW_DEVICE_INIT) diff --git a/drivers/serial/uart_ite_it8xxx2.c b/drivers/serial/uart_ite_it8xxx2.c index edce029a901b9..c858dce20b19d 100644 --- a/drivers/serial/uart_ite_it8xxx2.c +++ b/drivers/serial/uart_ite_it8xxx2.c @@ -198,12 +198,11 @@ static int uart_it8xxx2_init(const struct device *dev) static struct uart_it8xxx2_data uart_it8xxx2_data_##inst; \ \ PM_DEVICE_DT_INST_DEFINE(inst, uart_it8xxx2_pm_action); \ - DEVICE_DT_INST_DEFINE(inst, uart_it8xxx2_init, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, uart_it8xxx2_init, \ PM_DEVICE_DT_INST_GET(inst), \ &uart_it8xxx2_data_##inst, \ &uart_it8xxx2_cfg_##inst, \ PRE_KERNEL_1, \ - CONFIG_UART_ITE_IT8XXX2_INIT_PRIORITY, \ NULL); DT_INST_FOREACH_STATUS_OKAY(UART_ITE_IT8XXX2_INIT) diff --git a/drivers/serial/uart_litex.c b/drivers/serial/uart_litex.c index 99cbcbe659494..42005e939191b 100644 --- a/drivers/serial/uart_litex.c +++ b/drivers/serial/uart_litex.c @@ -366,8 +366,7 @@ static int uart_litex_init(const struct device *dev) .baud_rate = DT_INST_PROP(n, current_speed), \ IF_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN, (.config_func = uart_irq_config##n,))}; \ \ - DEVICE_DT_INST_DEFINE(n, uart_litex_init, NULL, &uart_litex_data_##n, \ - &uart_litex_dev_cfg_##n, PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - (void *)&uart_litex_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, uart_litex_init, NULL, &uart_litex_data_##n, \ + &uart_litex_dev_cfg_##n, PRE_KERNEL_1, (void *)&uart_litex_driver_api); DT_INST_FOREACH_STATUS_OKAY(LITEX_UART_INIT) diff --git a/drivers/serial/uart_lpc11u6x.c b/drivers/serial/uart_lpc11u6x.c index 3a13850429fd5..d6662e5b316b4 100644 --- a/drivers/serial/uart_lpc11u6x.c +++ b/drivers/serial/uart_lpc11u6x.c @@ -425,12 +425,11 @@ static const struct uart_driver_api uart0_api = { static struct lpc11u6x_uart0_data uart0_data; -DEVICE_DT_DEFINE(DT_NODELABEL(uart0), +DEVICE_INSTANCE(DT_NODELABEL(uart0), &lpc11u6x_uart0_init, NULL, &uart0_data, &uart0_config, - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, - &uart0_api); + PRE_KERNEL_1, &uart0_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void lpc11u6x_uart0_isr_config(const struct device *dev) @@ -870,11 +869,10 @@ static const struct lpc11u6x_uartx_config uart_cfg_##idx = { \ \ static struct lpc11u6x_uartx_data uart_data_##idx; \ \ -DEVICE_DT_DEFINE(DT_NODELABEL(uart##idx), \ - &lpc11u6x_uartx_init, NULL, \ - &uart_data_##idx, &uart_cfg_##idx, \ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &uartx_api) +DEVICE_INSTANCE(DT_NODELABEL(uart##idx), \ + &lpc11u6x_uartx_init, NULL, \ + &uart_data_##idx, &uart_cfg_##idx, \ + PRE_KERNEL_1, &uartx_api) #if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(uart1)) LPC11U6X_UARTX_INIT(1); diff --git a/drivers/serial/uart_max32.c b/drivers/serial/uart_max32.c index 48b90dc26a431..88d27f3b00a2f 100644 --- a/drivers/serial/uart_max32.c +++ b/drivers/serial/uart_max32.c @@ -448,8 +448,8 @@ static const struct uart_driver_api uart_max32_driver_api = { (.irq_config_func = uart_max32_irq_init_##_num,))}; \ static struct max32_uart_data max32_uart_data##_num = { \ IF_ENABLED(CONFIG_UART_INTERRUPT_DRIVEN, (.cb = NULL,))}; \ - DEVICE_DT_INST_DEFINE(_num, uart_max32_init, NULL, &max32_uart_data##_num, \ + DEVICE_INSTANCE_FROM_DT_INST(_num, uart_max32_init, NULL, &max32_uart_data##_num, \ &max32_uart_config_##_num, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, (void *)&uart_max32_driver_api); + (void *)&uart_max32_driver_api); DT_INST_FOREACH_STATUS_OKAY(MAX32_UART_INIT) diff --git a/drivers/serial/uart_mchp_xec.c b/drivers/serial/uart_mchp_xec.c index 5b37d0aa7c8eb..a2c0d0c07b6af 100644 --- a/drivers/serial/uart_mchp_xec.c +++ b/drivers/serial/uart_mchp_xec.c @@ -1102,12 +1102,11 @@ static const struct uart_driver_api uart_xec_driver_api = { .uart_config.flow_ctrl = DEV_DATA_FLOW_CTRL(n), \ }; \ PM_DEVICE_DT_INST_DEFINE(n, uart_xec_pm_action); \ - DEVICE_DT_INST_DEFINE(n, uart_xec_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, uart_xec_init, \ PM_DEVICE_DT_INST_GET(n), \ &uart_xec_dev_data_##n, \ &uart_xec_dev_cfg_##n, \ PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &uart_xec_driver_api); \ UART_XEC_IRQ_FUNC_DEFINE(n) diff --git a/drivers/serial/uart_mcux.c b/drivers/serial/uart_mcux.c index 07b0a0e44e255..539a65ea39dc1 100644 --- a/drivers/serial/uart_mcux.c +++ b/drivers/serial/uart_mcux.c @@ -451,13 +451,12 @@ static const struct uart_mcux_config uart_mcux_##n##_config = { \ static const struct uart_mcux_config uart_mcux_##n##_config; \ PM_DEVICE_DT_INST_DEFINE(n, uart_mcux_pm_action);\ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ uart_mcux_init, \ PM_DEVICE_DT_INST_GET(n), \ &uart_mcux_##n##_data, \ &uart_mcux_##n##_config, \ PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &uart_mcux_driver_api); \ \ UART_MCUX_CONFIG_FUNC(n) \ diff --git a/drivers/serial/uart_mcux_flexcomm.c b/drivers/serial/uart_mcux_flexcomm.c index b39a3a48f11a8..31f04d379a7e5 100644 --- a/drivers/serial/uart_mcux_flexcomm.c +++ b/drivers/serial/uart_mcux_flexcomm.c @@ -1202,13 +1202,12 @@ static const struct mcux_flexcomm_config mcux_flexcomm_##n##_config = { \ \ static const struct mcux_flexcomm_config mcux_flexcomm_##n##_config; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ mcux_flexcomm_init, \ NULL, \ &mcux_flexcomm_##n##_data, \ &mcux_flexcomm_##n##_config, \ PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &mcux_flexcomm_driver_api); \ \ UART_MCUX_FLEXCOMM_IRQ_CFG_FUNC(n) \ diff --git a/drivers/serial/uart_mcux_iuart.c b/drivers/serial/uart_mcux_iuart.c index d067f7f622050..276b247709d2c 100644 --- a/drivers/serial/uart_mcux_iuart.c +++ b/drivers/serial/uart_mcux_iuart.c @@ -340,13 +340,12 @@ static const struct mcux_iuart_config mcux_iuart_##n##_config = { \ \ static const struct mcux_iuart_config mcux_iuart_##n##_config;\ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ mcux_iuart_init, \ NULL, \ &mcux_iuart_##n##_data, \ &mcux_iuart_##n##_config, \ PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &mcux_iuart_driver_api); \ \ PINCTRL_DT_INST_DEFINE(n); \ diff --git a/drivers/serial/uart_mcux_lpsci.c b/drivers/serial/uart_mcux_lpsci.c index 6a87ef217d7c0..e6c75c7bdc57b 100644 --- a/drivers/serial/uart_mcux_lpsci.c +++ b/drivers/serial/uart_mcux_lpsci.c @@ -330,13 +330,12 @@ static const struct mcux_lpsci_config mcux_lpsci_##n##_config = { \ \ static const struct mcux_lpsci_config mcux_lpsci_##n##_config; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ mcux_lpsci_init, \ NULL, \ &mcux_lpsci_##n##_data, \ &mcux_lpsci_##n##_config, \ PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &mcux_lpsci_driver_api); \ \ MCUX_LPSCI_CONFIG_FUNC(n) \ diff --git a/drivers/serial/uart_mcux_lpuart.c b/drivers/serial/uart_mcux_lpuart.c index 67fc33fef3164..7aa6acfddf1c6 100644 --- a/drivers/serial/uart_mcux_lpuart.c +++ b/drivers/serial/uart_mcux_lpuart.c @@ -1389,13 +1389,12 @@ static const struct mcux_lpuart_config mcux_lpuart_##n##_config = { \ \ LPUART_MCUX_DECLARE_CFG(n) \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ mcux_lpuart_init, \ NULL, \ &mcux_lpuart_##n##_data, \ &mcux_lpuart_##n##_config, \ PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &mcux_lpuart_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(LPUART_MCUX_INIT) diff --git a/drivers/serial/uart_miv.c b/drivers/serial/uart_miv.c index d1b5cfb0e2666..be1fea5ba162a 100644 --- a/drivers/serial/uart_miv.c +++ b/drivers/serial/uart_miv.c @@ -405,10 +405,9 @@ static const struct uart_miv_device_config uart_miv_dev_cfg_0 = { #endif }; -DEVICE_DT_INST_DEFINE(0, uart_miv_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, uart_miv_init, NULL, &uart_miv_data_0, &uart_miv_dev_cfg_0, - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, - (void *)&uart_miv_driver_api); + PRE_KERNEL_1, (void *)&uart_miv_driver_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_miv_irq_cfg_func_0(const struct device *dev) diff --git a/drivers/serial/uart_msp432p4xx.c b/drivers/serial/uart_msp432p4xx.c index bbdacfbab0e7e..4974fadee9eed 100644 --- a/drivers/serial/uart_msp432p4xx.c +++ b/drivers/serial/uart_msp432p4xx.c @@ -348,9 +348,8 @@ static const struct uart_driver_api uart_msp432p4xx_driver_api = { #endif /* CONFIG_UART_INTERRUPT_DRIVEN */ }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, uart_msp432p4xx_init, NULL, &uart_msp432p4xx_dev_data_0, &uart_msp432p4xx_dev_cfg_0, - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, - (void *)&uart_msp432p4xx_driver_api); + PRE_KERNEL_1, (void *)&uart_msp432p4xx_driver_api); diff --git a/drivers/serial/uart_native_ptty.c b/drivers/serial/uart_native_ptty.c index 2409ee3c24451..136f531d584de 100644 --- a/drivers/serial/uart_native_ptty.c +++ b/drivers/serial/uart_native_ptty.c @@ -202,18 +202,16 @@ static int np_uart_tty_poll_in(const struct device *dev, return 0; } -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, np_uart_0_init, NULL, (void *)&native_uart_status_0, NULL, - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, - &np_uart_driver_api_0); + PRE_KERNEL_1, &np_uart_driver_api_0); #if defined(CONFIG_UART_NATIVE_POSIX_PORT_1_ENABLE) -DEVICE_DT_INST_DEFINE(1, +DEVICE_INSTANCE_FROM_DT_INST(1, np_uart_1_init, NULL, (void *)&native_uart_status_1, NULL, - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, - &np_uart_driver_api_1); + PRE_KERNEL_1, &np_uart_driver_api_1); #endif /* CONFIG_UART_NATIVE_POSIX_PORT_1_ENABLE */ static void auto_attach_cmd_cb(char *argv, int offset) diff --git a/drivers/serial/uart_native_tty.c b/drivers/serial/uart_native_tty.c index 4f2acc50b340b..5b6be4e6216de 100644 --- a/drivers/serial/uart_native_tty.c +++ b/drivers/serial/uart_native_tty.c @@ -404,9 +404,8 @@ static struct uart_driver_api native_tty_uart_driver_api = { .serial_port = DT_INST_PROP_OR(inst, serial_port, NULL), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, native_tty_serial_init, NULL, &native_tty_##inst##_data, \ - &native_tty_##inst##_cfg, NATIVE_TTY_INIT_LEVEL, 55, \ - &native_tty_uart_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, native_tty_serial_init, NULL, &native_tty_##inst##_data,\ + &native_tty_##inst##_cfg, NATIVE_TTY_INIT_LEVEL, &native_tty_uart_driver_api); DT_INST_FOREACH_STATUS_OKAY(NATIVE_TTY_INSTANCE); diff --git a/drivers/serial/uart_neorv32.c b/drivers/serial/uart_neorv32.c index 5c14b18060e4b..d1700f10f41bc 100644 --- a/drivers/serial/uart_neorv32.c +++ b/drivers/serial/uart_neorv32.c @@ -510,12 +510,11 @@ static const struct uart_driver_api neorv32_uart_driver_api = { \ PM_DEVICE_DT_DEFINE(node_id, neorv32_uart_pm_action); \ \ - DEVICE_DT_DEFINE(node_id, &neorv32_uart_init, \ + DEVICE_INSTANCE(node_id, &neorv32_uart_init, \ PM_DEVICE_DT_GET(node_id), \ &neorv32_uart_##n##_data, \ &neorv32_uart_##n##_config, \ PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &neorv32_uart_driver_api) #if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(uart0), DT_DRV_COMPAT, okay) diff --git a/drivers/serial/uart_npcx.c b/drivers/serial/uart_npcx.c index cc3e9962e2edd..fea9a3cca6f7e 100644 --- a/drivers/serial/uart_npcx.c +++ b/drivers/serial/uart_npcx.c @@ -1147,8 +1147,8 @@ static int uart_npcx_init(const struct device *dev) .baud_rate = DT_INST_PROP(i, current_speed), \ }; \ \ - DEVICE_DT_INST_DEFINE(i, uart_npcx_init, NULL, &uart_npcx_data_##i, &uart_npcx_cfg_##i, \ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, &uart_npcx_driver_api); \ + DEVICE_INSTANCE_FROM_DT_INST(i, uart_npcx_init, NULL, &uart_npcx_data_##i, &uart_npcx_cfg_##i,\ + PRE_KERNEL_1, &uart_npcx_driver_api); \ \ NPCX_UART_IRQ_CONFIG_FUNC(i) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 91f3430e8b6dd..63f8bd06dbd04 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -2421,13 +2421,12 @@ static int uarte_instance_init(const struct device *dev, PM_DEVICE_DT_DEFINE(UARTE(idx), uarte_nrfx_pm_action, \ PM_DEVICE_ISR_SAFE); \ \ - DEVICE_DT_DEFINE(UARTE(idx), \ - uarte_##idx##_init, \ - PM_DEVICE_DT_GET(UARTE(idx)), \ - &uarte_##idx##_data, \ - &uarte_##idx##z_config, \ - PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ + DEVICE_INSTANCE(UARTE(idx), \ + uarte_##idx##_init, \ + PM_DEVICE_DT_GET(UARTE(idx)), \ + &uarte_##idx##_data, \ + &uarte_##idx##z_config, \ + PRE_KERNEL_1, \ &uart_nrfx_uarte_driver_api) #define UARTE_INT_DRIVEN(idx) \ diff --git a/drivers/serial/uart_nrfx_uarte2.c b/drivers/serial/uart_nrfx_uarte2.c index ae25334f03fee..a9dae8fd4cb44 100644 --- a/drivers/serial/uart_nrfx_uarte2.c +++ b/drivers/serial/uart_nrfx_uarte2.c @@ -1059,13 +1059,12 @@ static int uarte_nrfx_pm_action(const struct device *dev, return uarte_nrfx_init(dev); \ } \ PM_DEVICE_DT_DEFINE(UARTE(idx), uarte_nrfx_pm_action); \ - DEVICE_DT_DEFINE(UARTE(idx), \ + DEVICE_INSTANCE(UARTE(idx), \ uarte_init_##idx, \ PM_DEVICE_DT_GET(UARTE(idx)), \ &uarte_data_##idx, \ &uarte_config_##idx, \ PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &uart_nrfx_uarte_driver_api) /* Macro creates device instance if it is enabled in devicetree. */ diff --git a/drivers/serial/uart_ns16550.c b/drivers/serial/uart_ns16550.c index a7a7df1f21a96..e951b23225f51 100644 --- a/drivers/serial/uart_ns16550.c +++ b/drivers/serial/uart_ns16550.c @@ -1975,10 +1975,9 @@ static const struct uart_driver_api uart_ns16550_driver_api = { static struct uart_ns16550_dev_data uart_ns16550_dev_data_##n = { \ UART_NS16550_COMMON_DEV_DATA_INITIALIZER(n) \ }; \ - DEVICE_DT_INST_DEFINE(n, uart_ns16550_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, uart_ns16550_init, NULL, \ &uart_ns16550_dev_data_##n, &uart_ns16550_dev_cfg_##n, \ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &uart_ns16550_driver_api); \ + PRE_KERNEL_1, &uart_ns16550_driver_api); \ UART_NS16550_IRQ_FUNC_DEFINE(n) #define UART_NS16550_DEVICE_PCIE_INIT(n) \ @@ -1993,10 +1992,9 @@ static const struct uart_driver_api uart_ns16550_driver_api = { static struct uart_ns16550_dev_data uart_ns16550_dev_data_##n = { \ UART_NS16550_COMMON_DEV_DATA_INITIALIZER(n) \ }; \ - DEVICE_DT_INST_DEFINE(n, uart_ns16550_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, uart_ns16550_init, NULL, \ &uart_ns16550_dev_data_##n, &uart_ns16550_dev_cfg_##n, \ - PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ + PRE_KERNEL_1, \ &uart_ns16550_driver_api); \ UART_NS16550_PCIE_IRQ_FUNC_DEFINE(n) diff --git a/drivers/serial/uart_numaker.c b/drivers/serial/uart_numaker.c index 4952753188d58..dd5c6d7e026ed 100644 --- a/drivers/serial/uart_numaker.c +++ b/drivers/serial/uart_numaker.c @@ -442,8 +442,7 @@ static const struct uart_driver_api uart_numaker_driver_api = { }, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, uart_numaker_init, NULL, &uart_numaker_data_##inst, \ - &uart_numaker_cfg_##inst, PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &uart_numaker_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, uart_numaker_init, NULL, &uart_numaker_data_##inst, \ + &uart_numaker_cfg_##inst, PRE_KERNEL_1, &uart_numaker_driver_api); DT_INST_FOREACH_STATUS_OKAY(NUMAKER_UART_INIT) diff --git a/drivers/serial/uart_numicro.c b/drivers/serial/uart_numicro.c index 8b9d1e02ee21c..1d1ce565dbd35 100644 --- a/drivers/serial/uart_numicro.c +++ b/drivers/serial/uart_numicro.c @@ -199,12 +199,11 @@ static struct uart_numicro_data uart_numicro_data_##index = { \ }, \ }; \ \ -DEVICE_DT_INST_DEFINE(index, \ +DEVICE_INSTANCE_FROM_DT_INST(index, \ uart_numicro_init, \ NULL, \ &uart_numicro_data_##index, \ &uart_numicro_cfg_##index, \ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &uart_numicro_driver_api); + PRE_KERNEL_1, &uart_numicro_driver_api); DT_INST_FOREACH_STATUS_OKAY(NUMICRO_INIT) diff --git a/drivers/serial/uart_opentitan.c b/drivers/serial/uart_opentitan.c index 0d27c7a3d0410..af38a90dba49d 100644 --- a/drivers/serial/uart_opentitan.c +++ b/drivers/serial/uart_opentitan.c @@ -112,9 +112,8 @@ static const struct uart_driver_api uart_opentitan_driver_api = { DT_INST_PROP(n, clock_frequency)), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, uart_opentitan_init, NULL, NULL, \ - &uart_opentitan_config_##n, \ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &uart_opentitan_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, uart_opentitan_init, NULL, NULL,\ + &uart_opentitan_config_##n, \ + PRE_KERNEL_1, &uart_opentitan_driver_api); DT_INST_FOREACH_STATUS_OKAY(UART_OPENTITAN_INIT) diff --git a/drivers/serial/uart_pl011.c b/drivers/serial/uart_pl011.c index 130d4e95957bc..420e0d9b09f4c 100644 --- a/drivers/serial/uart_pl011.c +++ b/drivers/serial/uart_pl011.c @@ -681,9 +681,8 @@ void pl011_isr(const struct device *dev) (DT_INST_PROP_BY_PHANDLE(n, clocks, clock_frequency)), (0)), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, pl011_init, PM_INST_GET(n), &pl011_data_port_##n, \ - &pl011_cfg_port_##n, PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &pl011_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, pl011_init, PM_INST_GET(n), &pl011_data_port_##n,\ + &pl011_cfg_port_##n, PRE_KERNEL_1, &pl011_driver_api); DT_INST_FOREACH_STATUS_OKAY(PL011_INIT) @@ -718,12 +717,11 @@ DT_INST_FOREACH_STATUS_OKAY(PL011_INIT) .sbsa = true, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, pl011_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, pl011_init, \ NULL, \ &pl011_data_sbsa_##n, \ &pl011_cfg_sbsa_##n, \ PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &pl011_driver_api); DT_INST_FOREACH_STATUS_OKAY(PL011_SBSA_INIT) diff --git a/drivers/serial/uart_psoc6.c b/drivers/serial/uart_psoc6.c index d0482c46a3a51..d4166b85983d1 100644 --- a/drivers/serial/uart_psoc6.c +++ b/drivers/serial/uart_psoc6.c @@ -355,10 +355,9 @@ static const struct uart_driver_api uart_psoc6_driver_api = { \ CY_PSOC6_UART_IRQ_SET_FUNC(n) \ }; \ - DEVICE_DT_INST_DEFINE(n, &uart_psoc6_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &uart_psoc6_init, NULL, \ CY_PSOC6_UART_DECL_DATA_PTR(n), \ &cy_psoc6_uart##n##_config, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &uart_psoc6_driver_api); DT_INST_FOREACH_STATUS_OKAY(CY_PSOC6_UART_INIT) diff --git a/drivers/serial/uart_ql_usbserialport_s3b.c b/drivers/serial/uart_ql_usbserialport_s3b.c index 48b698e15fe5f..171b76c56d097 100644 --- a/drivers/serial/uart_ql_usbserialport_s3b.c +++ b/drivers/serial/uart_ql_usbserialport_s3b.c @@ -81,6 +81,5 @@ static const struct uart_driver_api uart_usbserial_driver_api = { .poll_out = uart_usbserial_poll_out, }; -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_SERIAL_INIT_PRIORITY, +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, NULL, PRE_KERNEL_1, (void *)&uart_usbserial_driver_api); diff --git a/drivers/serial/uart_rcar.c b/drivers/serial/uart_rcar.c index c330f0f4f960b..2c1c552f5dfdd 100644 --- a/drivers/serial/uart_rcar.c +++ b/drivers/serial/uart_rcar.c @@ -589,13 +589,12 @@ static const struct uart_driver_api uart_rcar_driver_api = { \ static const struct uart_rcar_cfg uart_rcar_cfg_##compat##n; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ uart_rcar_init, \ NULL, \ &uart_rcar_data_##compat##n, \ &uart_rcar_cfg_##compat##n, \ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &uart_rcar_driver_api); \ + PRE_KERNEL_1, &uart_rcar_driver_api); \ \ UART_RCAR_CONFIG_FUNC(n, compat) \ \ diff --git a/drivers/serial/uart_renesas_ra.c b/drivers/serial/uart_renesas_ra.c index 269a26a59f515..45e5d825f7ec2 100644 --- a/drivers/serial/uart_renesas_ra.c +++ b/drivers/serial/uart_renesas_ra.c @@ -727,7 +727,7 @@ err_txi: }, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, uart_ra_init, NULL, &uart_ra_data_##n, &uart_ra_cfg_##n, \ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, &uart_ra_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, uart_ra_init, NULL, &uart_ra_data_##n, &uart_ra_cfg_##n, \ + PRE_KERNEL_1, &uart_ra_driver_api); DT_INST_FOREACH_STATUS_OKAY(UART_RA_INIT) diff --git a/drivers/serial/uart_renesas_ra8_sci_b.c b/drivers/serial/uart_renesas_ra8_sci_b.c index 78b870e3f08e8..02b5cb8880bf1 100644 --- a/drivers/serial/uart_renesas_ra8_sci_b.c +++ b/drivers/serial/uart_renesas_ra8_sci_b.c @@ -1155,9 +1155,8 @@ static void uart_ra_sci_b_eri_isr(const struct device *dev) return 0; \ } \ \ - DEVICE_DT_INST_DEFINE(index, uart_ra_sci_b_init_##index, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(index, uart_ra_sci_b_init_##index, NULL, \ &uart_ra_sci_b_data_##index, &uart_ra_sci_b_config_##index, \ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &uart_ra_sci_b_driver_api); + PRE_KERNEL_1, &uart_ra_sci_b_driver_api); DT_INST_FOREACH_STATUS_OKAY(UART_RA_SCI_B_INIT) diff --git a/drivers/serial/uart_renesas_ra_sci.c b/drivers/serial/uart_renesas_ra_sci.c index 0e9f927a357a2..ee6bd6741fb59 100644 --- a/drivers/serial/uart_renesas_ra_sci.c +++ b/drivers/serial/uart_renesas_ra_sci.c @@ -1211,8 +1211,8 @@ static void uart_ra_sci_eri_isr(const struct device *dev) } \ return 0; \ } \ - DEVICE_DT_INST_DEFINE(index, uart_ra_sci_init##index, NULL, &uart_ra_sci_data_##index, \ + DEVICE_INSTANCE_FROM_DT_INST(index, uart_ra_sci_init##index, NULL, &uart_ra_sci_data_##index,\ &uart_ra_sci_config_##index, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, &uart_ra_sci_driver_api); + &uart_ra_sci_driver_api); DT_INST_FOREACH_STATUS_OKAY(UART_RA_SCI_INIT) diff --git a/drivers/serial/uart_rpi_pico_pio.c b/drivers/serial/uart_rpi_pico_pio.c index 30ca3a40e253b..649bcb1ba67a2 100644 --- a/drivers/serial/uart_rpi_pico_pio.c +++ b/drivers/serial/uart_rpi_pico_pio.c @@ -192,9 +192,8 @@ static const struct uart_driver_api pio_uart_driver_api = { }; \ static struct pio_uart_data pio_uart##idx##_data; \ \ - DEVICE_DT_INST_DEFINE(idx, pio_uart_init, NULL, &pio_uart##idx##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, pio_uart_init, NULL, &pio_uart##idx##_data, \ &pio_uart##idx##_config, POST_KERNEL, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &pio_uart_driver_api); DT_INST_FOREACH_STATUS_OKAY(PIO_UART_INIT) diff --git a/drivers/serial/uart_rtt.c b/drivers/serial/uart_rtt.c index 7ed234329b80d..80b1db2347273 100644 --- a/drivers/serial/uart_rtt.c +++ b/drivers/serial/uart_rtt.c @@ -194,10 +194,9 @@ static const struct uart_driver_api uart_rtt_driver_api = { #define UART_RTT_INIT(idx, config) \ struct uart_rtt_data uart_rtt##idx##_data; \ \ - DEVICE_DT_DEFINE(UART_RTT(idx), uart_rtt_init, NULL, \ - &uart_rtt##idx##_data, config, \ - PRE_KERNEL_2, CONFIG_SERIAL_INIT_PRIORITY, \ - &uart_rtt_driver_api) + DEVICE_INSTANCE(UART_RTT(idx), uart_rtt_init, NULL, \ + &uart_rtt##idx##_data, config, \ + PRE_KERNEL_2, &uart_rtt_driver_api) #ifdef CONFIG_UART_RTT_0 UART_RTT_INIT(0, NULL); diff --git a/drivers/serial/uart_rv32m1_lpuart.c b/drivers/serial/uart_rv32m1_lpuart.c index 603a1cd061754..b0064c5dcee19 100644 --- a/drivers/serial/uart_rv32m1_lpuart.c +++ b/drivers/serial/uart_rv32m1_lpuart.c @@ -344,13 +344,12 @@ static const struct uart_driver_api rv32m1_lpuart_driver_api = { \ static const struct rv32m1_lpuart_config rv32m1_lpuart_##n##_cfg;\ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ rv32m1_lpuart_init, \ NULL, \ &rv32m1_lpuart_##n##_data, \ &rv32m1_lpuart_##n##_cfg, \ PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &rv32m1_lpuart_driver_api); \ \ RV32M1_LPUART_CONFIG_FUNC(n) \ diff --git a/drivers/serial/uart_rzt2m.c b/drivers/serial/uart_rzt2m.c index ae8a90a454699..ff64abc5750f5 100644 --- a/drivers/serial/uart_rzt2m.c +++ b/drivers/serial/uart_rzt2m.c @@ -439,8 +439,7 @@ static void uart_rzt2m_isr(const struct device *dev) .base = DT_INST_REG_ADDR(n), \ .irq_config_func = uart##n##_rzt2m_irq_config, \ .pin_config = PINCTRL_DT_INST_DEV_CONFIG_GET(n)}; \ - DEVICE_DT_INST_DEFINE(n, rzt2m_uart_init, NULL, &rzt2m_uart_##n##data, \ - &rzt2m_uart_##n##_config, PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &rzt2m_uart_api); + DEVICE_INSTANCE_FROM_DT_INST(n, rzt2m_uart_init, NULL, &rzt2m_uart_##n##data, \ + &rzt2m_uart_##n##_config, PRE_KERNEL_1, &rzt2m_uart_api); DT_INST_FOREACH_STATUS_OKAY(UART_RZT2M_INIT) diff --git a/drivers/serial/uart_sam.c b/drivers/serial/uart_sam.c index 81c059ac1ea36..d3dd88a6813b0 100644 --- a/drivers/serial/uart_sam.c +++ b/drivers/serial/uart_sam.c @@ -482,10 +482,9 @@ static const struct uart_driver_api uart_sam_driver_api = { \ static const struct uart_sam_dev_cfg uart##n##_sam_config; \ \ - DEVICE_DT_INST_DEFINE(n, uart_sam_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, uart_sam_init, \ NULL, &uart##n##_sam_data, \ &uart##n##_sam_config, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &uart_sam_driver_api); \ \ UART_SAM_CONFIG_FUNC(n) \ diff --git a/drivers/serial/uart_sam0.c b/drivers/serial/uart_sam0.c index 35931fe5a17a0..2b2d311585c5a 100644 --- a/drivers/serial/uart_sam0.c +++ b/drivers/serial/uart_sam0.c @@ -1306,10 +1306,9 @@ PINCTRL_DT_INST_DEFINE(n); \ static struct uart_sam0_dev_data uart_sam0_data_##n; \ UART_SAM0_IRQ_HANDLER_DECL(n); \ UART_SAM0_CONFIG_DEFN(n); \ -DEVICE_DT_INST_DEFINE(n, uart_sam0_init, NULL, \ +DEVICE_INSTANCE_FROM_DT_INST(n, uart_sam0_init, NULL, \ &uart_sam0_data_##n, \ &uart_sam0_config_##n, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &uart_sam0_driver_api); \ UART_SAM0_IRQ_HANDLER(n) diff --git a/drivers/serial/uart_sedi.c b/drivers/serial/uart_sedi.c index 74fcc4a504036..1360b473c334d 100644 --- a/drivers/serial/uart_sedi.c +++ b/drivers/serial/uart_sedi.c @@ -65,12 +65,12 @@ static void uart_sedi_cb(struct device *port); static struct uart_sedi_drv_data drv_data_##n; \ PM_DEVICE_DT_DEFINE(DT_NODELABEL(uart##n), \ uart_sedi_pm_action); \ - DEVICE_DT_DEFINE(DT_NODELABEL(uart##n), \ - &uart_sedi_init, \ - PM_DEVICE_DT_GET(DT_NODELABEL(uart##n)), \ - &drv_data_##n, &config_info_##n, \ - PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, &api); \ + DEVICE_INSTANCE(DT_NODELABEL(uart##n), \ + &uart_sedi_init, \ + PM_DEVICE_DT_GET(DT_NODELABEL(uart##n)), \ + &drv_data_##n, &config_info_##n, \ + PRE_KERNEL_1, \ + &api); \ UART_IRQ_HANDLER_DEFINE(n) diff --git a/drivers/serial/uart_si32_usart.c b/drivers/serial/uart_si32_usart.c index a51513188037d..524249b6bbca8 100644 --- a/drivers/serial/uart_si32_usart.c +++ b/drivers/serial/uart_si32_usart.c @@ -386,9 +386,8 @@ static int usart_si32_init(const struct device *dev) .baud_rate = DT_INST_PROP(index, current_speed), \ }; \ \ - DEVICE_DT_INST_DEFINE(index, &usart_si32_init, NULL, &usart_si32_data_##index, \ - &usart_si32_cfg_##index, PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &usart_si32_driver_api); \ + DEVICE_INSTANCE_FROM_DT_INST(index, &usart_si32_init, NULL, &usart_si32_data_##index, \ + &usart_si32_cfg_##index, PRE_KERNEL_1, &usart_si32_driver_api); \ \ SI32_USART_IRQ_HANDLER(index) diff --git a/drivers/serial/uart_sifive.c b/drivers/serial/uart_sifive.c index f0fa3d501ff5e..ded34cd3acdc1 100644 --- a/drivers/serial/uart_sifive.c +++ b/drivers/serial/uart_sifive.c @@ -398,12 +398,11 @@ static const struct uart_sifive_device_config uart_sifive_dev_cfg_0 = { #endif }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, uart_sifive_init, NULL, &uart_sifive_data_0, &uart_sifive_dev_cfg_0, - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, - (void *)&uart_sifive_driver_api); + PRE_KERNEL_1, (void *)&uart_sifive_driver_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN @@ -441,12 +440,11 @@ static const struct uart_sifive_device_config uart_sifive_dev_cfg_1 = { #endif }; -DEVICE_DT_INST_DEFINE(1, +DEVICE_INSTANCE_FROM_DT_INST(1, uart_sifive_init, NULL, &uart_sifive_data_1, &uart_sifive_dev_cfg_1, - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, - (void *)&uart_sifive_driver_api); + PRE_KERNEL_1, (void *)&uart_sifive_driver_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void uart_sifive_irq_cfg_func_1(void) diff --git a/drivers/serial/uart_smartbond.c b/drivers/serial/uart_smartbond.c index 6adb0650a5d45..9d68acee6b8a0 100644 --- a/drivers/serial/uart_smartbond.c +++ b/drivers/serial/uart_smartbond.c @@ -804,12 +804,11 @@ static const struct uart_driver_api uart_smartbond_driver_api = { return uart_smartbond_init(dev); \ } \ PM_DEVICE_DT_INST_DEFINE(id, uart_smartbond_pm_action); \ - DEVICE_DT_INST_DEFINE(id, \ + DEVICE_INSTANCE_FROM_DT_INST(id, \ uart_smartbond_##id##_init, \ PM_DEVICE_DT_INST_GET(id), \ &uart_smartbond_##id##_data, \ &uart_smartbond_##id##_cfg, \ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &uart_smartbond_driver_api); \ + PRE_KERNEL_1, &uart_smartbond_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(UART_SMARTBOND_DEVICE) diff --git a/drivers/serial/uart_stellaris.c b/drivers/serial/uart_stellaris.c index 731ea8a3c09d2..8a0896a7b39fd 100644 --- a/drivers/serial/uart_stellaris.c +++ b/drivers/serial/uart_stellaris.c @@ -592,12 +592,11 @@ static struct uart_stellaris_dev_data_t uart_stellaris_dev_data_0 = { .baud_rate = DT_INST_PROP(0, current_speed), }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, uart_stellaris_init, NULL, &uart_stellaris_dev_data_0, &uart_stellaris_dev_cfg_0, - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, - &uart_stellaris_driver_api); + PRE_KERNEL_1, &uart_stellaris_driver_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void irq_config_func_0(const struct device *dev) @@ -631,12 +630,11 @@ static struct uart_stellaris_dev_data_t uart_stellaris_dev_data_1 = { .baud_rate = DT_INST_PROP(1, current_speed), }; -DEVICE_DT_INST_DEFINE(1, +DEVICE_INSTANCE_FROM_DT_INST(1, uart_stellaris_init, NULL, &uart_stellaris_dev_data_1, &uart_stellaris_dev_cfg_1, - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, - &uart_stellaris_driver_api); + PRE_KERNEL_1, &uart_stellaris_driver_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void irq_config_func_1(const struct device *dev) @@ -670,12 +668,11 @@ static struct uart_stellaris_dev_data_t uart_stellaris_dev_data_2 = { .baud_rate = DT_INST_PROP(2, current_speed), }; -DEVICE_DT_INST_DEFINE(2, +DEVICE_INSTANCE_FROM_DT_INST(2, uart_stellaris_init, NULL, &uart_stellaris_dev_data_2, &uart_stellaris_dev_cfg_2, - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, - &uart_stellaris_driver_api); + PRE_KERNEL_1, &uart_stellaris_driver_api); #ifdef CONFIG_UART_INTERRUPT_DRIVEN static void irq_config_func_2(const struct device *dev) diff --git a/drivers/serial/uart_stm32.c b/drivers/serial/uart_stm32.c index 97c0bbdf85314..6e0338d77dfa4 100644 --- a/drivers/serial/uart_stm32.c +++ b/drivers/serial/uart_stm32.c @@ -2448,12 +2448,11 @@ static struct uart_stm32_data uart_stm32_data_##index = { \ \ PM_DEVICE_DT_INST_DEFINE(index, uart_stm32_pm_action); \ \ -DEVICE_DT_INST_DEFINE(index, \ +DEVICE_INSTANCE_FROM_DT_INST(index, \ uart_stm32_init, \ PM_DEVICE_DT_INST_GET(index), \ &uart_stm32_data_##index, &uart_stm32_cfg_##index, \ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &uart_stm32_driver_api); \ + PRE_KERNEL_1, &uart_stm32_driver_api); \ \ STM32_UART_IRQ_HANDLER(index) \ \ diff --git a/drivers/serial/uart_sy1xx.c b/drivers/serial/uart_sy1xx.c index b0552719b52c5..05c1719af66e4 100644 --- a/drivers/serial/uart_sy1xx.c +++ b/drivers/serial/uart_sy1xx.c @@ -316,8 +316,7 @@ static const struct uart_driver_api sy1xx_uart_driver_api = { \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &sy1xx_uart_init, NULL, &sy1xx_uart_##n##_data, \ - &sy1xx_uart_##n##_cfg, PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &sy1xx_uart_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &sy1xx_uart_init, NULL, &sy1xx_uart_##n##_data, \ + &sy1xx_uart_##n##_cfg, PRE_KERNEL_1, &sy1xx_uart_driver_api); DT_INST_FOREACH_STATUS_OKAY(SYS1XX_UART_INIT) diff --git a/drivers/serial/uart_wch_usart.c b/drivers/serial/uart_wch_usart.c index edd65ca9ea772..7df806167eec3 100644 --- a/drivers/serial/uart_wch_usart.c +++ b/drivers/serial/uart_wch_usart.c @@ -133,8 +133,8 @@ static const struct uart_driver_api usart_wch_driver_api = { .clock_id = DT_INST_CLOCKS_CELL(idx, id), \ .pin_cfg = PINCTRL_DT_INST_DEV_CONFIG_GET(idx), \ }; \ - DEVICE_DT_INST_DEFINE(idx, &usart_wch_init, NULL, &usart_wch_##idx##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, &usart_wch_init, NULL, &usart_wch_##idx##_data, \ &usart_wch_##idx##_config, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, &usart_wch_driver_api); + &usart_wch_driver_api); DT_INST_FOREACH_STATUS_OKAY(USART_WCH_INIT) diff --git a/drivers/serial/uart_xlnx_ps.c b/drivers/serial/uart_xlnx_ps.c index 68b3a7baabda1..73fe16e3b99b4 100644 --- a/drivers/serial/uart_xlnx_ps.c +++ b/drivers/serial/uart_xlnx_ps.c @@ -1164,13 +1164,12 @@ static struct uart_xlnx_ps_dev_config uart_xlnx_ps_dev_cfg_##port = { \ } #define UART_XLNX_PS_INIT(port) \ -DEVICE_DT_INST_DEFINE(port, \ - uart_xlnx_ps_init, \ - NULL, \ - &uart_xlnx_ps_dev_data_##port, \ - &uart_xlnx_ps_dev_cfg_##port, \ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &uart_xlnx_ps_driver_api) +DEVICE_INSTANCE_FROM_DT_INST(port,\ + uart_xlnx_ps_init, \ + NULL, \ + &uart_xlnx_ps_dev_data_##port,\ + &uart_xlnx_ps_dev_cfg_##port,\ + PRE_KERNEL_1, &uart_xlnx_ps_driver_api) #define UART_XLNX_INSTANTIATE(inst) \ UART_XLNX_PS_PINCTRL_DEFINE(inst) \ diff --git a/drivers/serial/uart_xlnx_uartlite.c b/drivers/serial/uart_xlnx_uartlite.c index 1a4b045649468..8492ce2b5874b 100644 --- a/drivers/serial/uart_xlnx_uartlite.c +++ b/drivers/serial/uart_xlnx_uartlite.c @@ -413,13 +413,12 @@ static const struct xlnx_uartlite_config xlnx_uartlite_##n##_config = { \ \ static const struct xlnx_uartlite_config xlnx_uartlite_##n##_config;\ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ &xlnx_uartlite_init, \ NULL, \ &xlnx_uartlite_##n##_data, \ &xlnx_uartlite_##n##_config, \ PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &xlnx_uartlite_driver_api); \ \ XLNX_UARTLITE_CONFIG_FUNC(n) \ diff --git a/drivers/serial/uart_xmc4xxx.c b/drivers/serial/uart_xmc4xxx.c index f797e27a11ecd..34ca5a24fb2af 100644 --- a/drivers/serial/uart_xmc4xxx.c +++ b/drivers/serial/uart_xmc4xxx.c @@ -1032,11 +1032,10 @@ XMC4XXX_IRQ_STRUCT_INIT(index) \ .fifo_rx_size = DT_INST_ENUM_IDX(index, fifo_rx_size), \ }; \ \ - DEVICE_DT_INST_DEFINE(index, uart_xmc4xxx_init, \ + DEVICE_INSTANCE_FROM_DT_INST(index, uart_xmc4xxx_init, \ NULL, \ &xmc4xxx_data_##index, \ &xmc4xxx_config_##index, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &uart_xmc4xxx_driver_api); DT_INST_FOREACH_STATUS_OKAY(XMC4XXX_INIT) diff --git a/drivers/serial/usart_gd32.c b/drivers/serial/usart_gd32.c index 4e5ac37a230e9..41f70280f61c0 100644 --- a/drivers/serial/usart_gd32.c +++ b/drivers/serial/usart_gd32.c @@ -338,11 +338,10 @@ static const struct uart_driver_api usart_gd32_driver_api = { .parity = DT_INST_ENUM_IDX_OR(n, parity, UART_CFG_PARITY_NONE), \ GD32_USART_IRQ_HANDLER_FUNC_INIT(n) \ }; \ - DEVICE_DT_INST_DEFINE(n, usart_gd32_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, usart_gd32_init, \ NULL, \ &usart_gd32_data_##n, \ &usart_gd32_config_##n, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &usart_gd32_driver_api); DT_INST_FOREACH_STATUS_OKAY(GD32_USART_INIT) diff --git a/drivers/serial/usart_sam.c b/drivers/serial/usart_sam.c index 43ba14c8fa08f..54429663de91b 100644 --- a/drivers/serial/usart_sam.c +++ b/drivers/serial/usart_sam.c @@ -578,11 +578,10 @@ static const struct uart_driver_api usart_sam_driver_api = { \ static const struct usart_sam_dev_cfg usart##n##_sam_config; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ usart_sam_init, NULL, \ &usart##n##_sam_data, \ &usart##n##_sam_config, PRE_KERNEL_1, \ - CONFIG_SERIAL_INIT_PRIORITY, \ &usart_sam_driver_api); \ \ USART_SAM_CONFIG_FUNC(n) \ diff --git a/drivers/sip_svc/sip_smc_intel_socfpga.c b/drivers/sip_svc/sip_smc_intel_socfpga.c index 09d351798e312..04ab06440bb29 100644 --- a/drivers/sip_svc/sip_smc_intel_socfpga.c +++ b/drivers/sip_svc/sip_smc_intel_socfpga.c @@ -233,7 +233,7 @@ SIP_SVC_CONTROLLER_DEFINE(0, DT_PROP(DT_SIP_SMC, method), DEVICE_DT_GET(DT_SIP_S CONFIG_ARM_SIP_SVC_EL3_MAX_ALLOWED_TRANSACTIONS, CONFIG_ARM_SIP_SVC_EL3_MAILBOX_RESPONSE_SIZE); -DEVICE_DT_DEFINE(DT_SIP_SMC, arm_sip_smc_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_ARM_SIP_SVC_DRIVER_INIT_PRIORITY, &api); +DEVICE_INSTANCE(DT_SIP_SMC, arm_sip_smc_init, NULL, NULL, NULL, POST_KERNEL, + &api); #endif diff --git a/drivers/smbus/intel_pch_smbus.c b/drivers/smbus/intel_pch_smbus.c index 9452efecf224d..150529052ba28 100644 --- a/drivers/smbus/intel_pch_smbus.c +++ b/drivers/smbus/intel_pch_smbus.c @@ -1018,10 +1018,9 @@ static void smbus_isr(const struct device *dev) .config_func = pch_config_##n, \ }; \ static struct pch_data smbus_##n##_data; \ - SMBUS_DEVICE_DT_INST_DEFINE(n, pch_smbus_init, NULL, \ + SMBUS_DEVICE_INSTANCE_FROM_DT_INST(n, pch_smbus_init, NULL, \ &smbus_##n##_data, &pch_config_data_##n, \ - POST_KERNEL, CONFIG_SMBUS_INIT_PRIORITY, \ - &funcs); \ + POST_KERNEL, &funcs); \ SMBUS_IRQ_CONFIG(n); DT_INST_FOREACH_STATUS_OKAY(SMBUS_DEVICE_INIT) diff --git a/drivers/smbus/smbus_stm32.c b/drivers/smbus/smbus_stm32.c index 56636cc84bff0..9647346f64e52 100644 --- a/drivers/smbus/smbus_stm32.c +++ b/drivers/smbus/smbus_stm32.c @@ -283,8 +283,8 @@ static const struct smbus_driver_api smbus_stm32_api = { \ static struct smbus_stm32_data smbus_stm32_data_##n; \ \ - SMBUS_DEVICE_DT_INST_DEFINE(n, smbus_stm32_init, NULL, &smbus_stm32_data_##n, \ + SMBUS_DEVICE_INSTANCE_FROM_DT_INST(n, smbus_stm32_init, NULL, &smbus_stm32_data_##n, \ &smbus_stm32_config_##n, POST_KERNEL, \ - CONFIG_SMBUS_INIT_PRIORITY, &smbus_stm32_api); + &smbus_stm32_api); DT_INST_FOREACH_STATUS_OKAY(SMBUS_STM32_DEVICE_INIT) diff --git a/drivers/spi/spi_ambiq_bleif.c b/drivers/spi/spi_ambiq_bleif.c index 4478d2e674e86..933b2aa736201 100644 --- a/drivers/spi/spi_ambiq_bleif.c +++ b/drivers/spi/spi_ambiq_bleif.c @@ -213,7 +213,7 @@ static int spi_ambiq_init(const struct device *dev) .size = DT_INST_REG_SIZE(n), \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ .pwr_func = pwr_on_ambiq_spi_##n}; \ - DEVICE_DT_INST_DEFINE(n, spi_ambiq_init, NULL, &spi_ambiq_data##n, &spi_ambiq_config##n, \ - POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, &spi_ambiq_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, spi_ambiq_init, NULL, &spi_ambiq_data##n, &spi_ambiq_config##n,\ + POST_KERNEL, &spi_ambiq_driver_api); DT_INST_FOREACH_STATUS_OKAY(AMBIQ_SPI_BLEIF_INIT) diff --git a/drivers/spi/spi_ambiq_spic.c b/drivers/spi/spi_ambiq_spic.c index 2511c852b23c1..c811060d548bf 100644 --- a/drivers/spi/spi_ambiq_spic.c +++ b/drivers/spi/spi_ambiq_spic.c @@ -517,8 +517,7 @@ static int spi_ambiq_pm_action(const struct device *dev, enum pm_device_action a .irq_config_func = spi_irq_config_func_##n, \ .pwr_func = pwr_on_ambiq_spi_##n}; \ PM_DEVICE_DT_INST_DEFINE(n, spi_ambiq_pm_action); \ - DEVICE_DT_INST_DEFINE(n, spi_ambiq_init, PM_DEVICE_DT_INST_GET(n), &spi_ambiq_data##n, \ - &spi_ambiq_config##n, POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_ambiq_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, spi_ambiq_init, PM_DEVICE_DT_INST_GET(n), &spi_ambiq_data##n,\ + &spi_ambiq_config##n, POST_KERNEL, &spi_ambiq_driver_api); DT_INST_FOREACH_STATUS_OKAY(AMBIQ_SPI_INIT) diff --git a/drivers/spi/spi_ambiq_spid.c b/drivers/spi/spi_ambiq_spid.c index 6ccc6e7819a79..b0118103da479 100644 --- a/drivers/spi/spi_ambiq_spid.c +++ b/drivers/spi/spi_ambiq_spid.c @@ -423,8 +423,7 @@ static int spi_ambiq_pm_action(const struct device *dev, enum pm_device_action a .irq_config_func = spi_irq_config_func_##n, \ .pwr_func = pwr_on_ambiq_spi_##n}; \ PM_DEVICE_DT_INST_DEFINE(n, spi_ambiq_pm_action); \ - DEVICE_DT_INST_DEFINE(n, spi_ambiq_init, PM_DEVICE_DT_INST_GET(n), &spi_ambiq_data##n, \ - &spi_ambiq_config##n, POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_ambiq_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, spi_ambiq_init, PM_DEVICE_DT_INST_GET(n), &spi_ambiq_data##n,\ + &spi_ambiq_config##n, POST_KERNEL, &spi_ambiq_driver_api); DT_INST_FOREACH_STATUS_OKAY(AMBIQ_SPID_INIT) diff --git a/drivers/spi/spi_andes_atcspi200.c b/drivers/spi/spi_andes_atcspi200.c index 1d9af7e210e49..a00f36c31b013 100644 --- a/drivers/spi/spi_andes_atcspi200.c +++ b/drivers/spi/spi_andes_atcspi200.c @@ -957,13 +957,12 @@ static void spi_atcspi200_irq_handler(void *arg) .xip = SPI_ROM_CFG_XIP(DT_DRV_INST(n)), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ spi_atcspi200_init, \ NULL, \ &spi_atcspi200_dev_data_##n, \ &spi_atcspi200_dev_cfg_##n, \ POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ &spi_atcspi200_api); \ \ static void spi_atcspi200_cfg_##n(void) \ diff --git a/drivers/spi/spi_b91.c b/drivers/spi/spi_b91.c index 044478ecd8cc7..66bada06a06e6 100644 --- a/drivers/spi/spi_b91.c +++ b/drivers/spi/spi_b91.c @@ -483,12 +483,11 @@ static const struct spi_driver_api spi_b91_api = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, spi_b91_init, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, spi_b91_init, \ NULL, \ &spi_b91_data_##inst, \ &spi_b91_cfg_##inst, \ POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ &spi_b91_api); DT_INST_FOREACH_STATUS_OKAY(SPI_B91_INIT) diff --git a/drivers/spi/spi_b_renesas_ra8.c b/drivers/spi/spi_b_renesas_ra8.c index 3fa55fafcb0ce..db63544e8a8fc 100644 --- a/drivers/spi/spi_b_renesas_ra8.c +++ b/drivers/spi/spi_b_renesas_ra8.c @@ -766,8 +766,8 @@ static void ra_spi_eri_isr(const struct device *dev) return 0; \ } \ \ - DEVICE_DT_INST_DEFINE(index, spi_b_ra_init##index, PM_DEVICE_DT_INST_GET(index), \ + DEVICE_INSTANCE_FROM_DT_INST(index, spi_b_ra_init##index, PM_DEVICE_DT_INST_GET(index), \ &ra_spi_data_##index, &ra_spi_config_##index, POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, &ra_spi_driver_api); + &ra_spi_driver_api); DT_INST_FOREACH_STATUS_OKAY(RA_SPI_INIT) diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index a7b409557f1c0..d4f2d2f03d1cd 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c @@ -325,13 +325,12 @@ int spi_bitbang_init(const struct device *dev) SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(inst), ctx) \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ spi_bitbang_init, \ NULL, \ &spi_bitbang_data_##inst, \ &spi_bitbang_config_##inst, \ POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ &spi_bitbang_api); DT_INST_FOREACH_STATUS_OKAY(SPI_BITBANG_INIT) diff --git a/drivers/spi/spi_cc13xx_cc26xx.c b/drivers/spi/spi_cc13xx_cc26xx.c index 795d802cedccf..80ddeaee3012e 100644 --- a/drivers/spi/spi_cc13xx_cc26xx.c +++ b/drivers/spi/spi_cc13xx_cc26xx.c @@ -291,12 +291,11 @@ static const struct spi_driver_api spi_cc13xx_cc26xx_driver_api = { #define SPI_CC13XX_CC26XX_DEVICE_INIT(n) \ PM_DEVICE_DT_INST_DEFINE(n, spi_cc13xx_cc26xx_pm_action); \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ spi_cc13xx_cc26xx_init_##n, \ PM_DEVICE_DT_INST_GET(n), \ - &spi_cc13xx_cc26xx_data_##n, &spi_cc13xx_cc26xx_config_##n, \ - POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_cc13xx_cc26xx_driver_api) + &spi_cc13xx_cc26xx_data_##n, &spi_cc13xx_cc26xx_config_##n, \ + POST_KERNEL, &spi_cc13xx_cc26xx_driver_api) #define SPI_CC13XX_CC26XX_INIT_FUNC(n) \ static int spi_cc13xx_cc26xx_init_##n(const struct device *dev) \ diff --git a/drivers/spi/spi_dw.c b/drivers/spi/spi_dw.c index 649a13aca0186..37bae92bdf855 100644 --- a/drivers/spi/spi_dw.c +++ b/drivers/spi/spi_dw.c @@ -660,13 +660,12 @@ COND_CODE_1(IS_EQ(DT_NUM_IRQS(DT_DRV_INST(inst)), 1), \ .clear_bit_func = reg_clear_bit, \ .test_bit_func = reg_test_bit,)) \ }; \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ spi_dw_init, \ NULL, \ &spi_dw_data_##inst, \ &spi_dw_config_##inst, \ POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ &dw_spi_api); DT_INST_FOREACH_STATUS_OKAY(SPI_DW_INIT) diff --git a/drivers/spi/spi_emul.c b/drivers/spi/spi_emul.c index 89c21009dd40f..da8bd629e305b 100644 --- a/drivers/spi/spi_emul.c +++ b/drivers/spi/spi_emul.c @@ -151,7 +151,7 @@ static const struct spi_driver_api spi_emul_api = { .num_children = ARRAY_SIZE(emuls_##n), \ }; \ static struct spi_emul_data spi_emul_data_##n; \ - DEVICE_DT_INST_DEFINE(n, spi_emul_init, NULL, &spi_emul_data_##n, &spi_emul_cfg_##n, \ - POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, &spi_emul_api); + DEVICE_INSTANCE_FROM_DT_INST(n, spi_emul_init, NULL, &spi_emul_data_##n, &spi_emul_cfg_##n,\ + POST_KERNEL, &spi_emul_api); DT_INST_FOREACH_STATUS_OKAY(SPI_EMUL_INIT) diff --git a/drivers/spi/spi_esp32_spim.c b/drivers/spi/spi_esp32_spim.c index 360d996a8fc88..a8e45de5292f7 100644 --- a/drivers/spi/spi_esp32_spim.c +++ b/drivers/spi/spi_esp32_spim.c @@ -559,9 +559,9 @@ static const struct spi_driver_api spi_api = { .clock_source = SPI_CLK_SRC_DEFAULT, \ }; \ \ - DEVICE_DT_INST_DEFINE(idx, spi_esp32_init, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, spi_esp32_init,\ NULL, &spi_data_##idx, \ - &spi_config_##idx, POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, &spi_api); + &spi_config_##idx, POST_KERNEL,\ + &spi_api); DT_INST_FOREACH_STATUS_OKAY(ESP32_SPI_INIT) diff --git a/drivers/spi/spi_gd32.c b/drivers/spi/spi_gd32.c index 0876511d4bbec..3b97d8413f81a 100644 --- a/drivers/spi/spi_gd32.c +++ b/drivers/spi/spi_gd32.c @@ -683,9 +683,8 @@ int spi_gd32_init(const struct device *dev) IF_ENABLED(CONFIG_SPI_GD32_DMA, (.dma = DMAS_DECL(idx),)) \ IF_ENABLED(CONFIG_SPI_GD32_INTERRUPT, \ (.irq_configure = spi_gd32_irq_configure_##idx)) }; \ - DEVICE_DT_INST_DEFINE(idx, spi_gd32_init, NULL, \ - &spi_gd32_data_##idx, &spi_gd32_config_##idx, \ - POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_gd32_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(idx, spi_gd32_init, NULL, \ + &spi_gd32_data_##idx, &spi_gd32_config_##idx, \ + POST_KERNEL, &spi_gd32_driver_api); DT_INST_FOREACH_STATUS_OKAY(GD32_SPI_INIT) diff --git a/drivers/spi/spi_gecko_eusart.c b/drivers/spi/spi_gecko_eusart.c index 66413c548a228..5487393209f68 100644 --- a/drivers/spi/spi_gecko_eusart.c +++ b/drivers/spi/spi_gecko_eusart.c @@ -312,8 +312,7 @@ static const struct spi_driver_api spi_gecko_eusart_api = { .clock_cfg = SILABS_DT_INST_CLOCK_CFG(n), \ .clock_frequency = DT_INST_PROP_OR(n, clock_frequency, 1000000) \ }; \ - DEVICE_DT_INST_DEFINE(n, spi_gecko_eusart_init, NULL, &spi_gecko_eusart_data_##n, \ - &spi_gecko_eusart_cfg_##n, POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_gecko_eusart_api); + DEVICE_INSTANCE_FROM_DT_INST(n, spi_gecko_eusart_init, NULL, &spi_gecko_eusart_data_##n,\ + &spi_gecko_eusart_cfg_##n, POST_KERNEL, &spi_gecko_eusart_api); DT_INST_FOREACH_STATUS_OKAY(SPI_INIT) diff --git a/drivers/spi/spi_gecko_usart.c b/drivers/spi/spi_gecko_usart.c index 009f429d7ed51..455f781bdbd6d 100644 --- a/drivers/spi/spi_gecko_usart.c +++ b/drivers/spi/spi_gecko_usart.c @@ -443,13 +443,12 @@ static const struct spi_driver_api spi_gecko_api = { GET_GECKO_USART_CLOCK(n) \ .clock_frequency = DT_INST_PROP_OR(n, clock_frequency, 1000000) \ }; \ - DEVICE_DT_INST_DEFINE(n, \ - spi_gecko_init, \ - NULL, \ - &spi_gecko_data_##n, \ - &spi_gecko_cfg_##n, \ - POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(n,\ + spi_gecko_init,\ + NULL, \ + &spi_gecko_data_##n,\ + &spi_gecko_cfg_##n,\ + POST_KERNEL,\ &spi_gecko_api); #else #define SPI_INIT(n) \ @@ -476,13 +475,12 @@ static const struct spi_driver_api spi_gecko_api = { .loc_tx = DT_INST_PROP_BY_IDX(n, location_tx, 0), \ .loc_clk = DT_INST_PROP_BY_IDX(n, location_clk, 0), \ }; \ - DEVICE_DT_INST_DEFINE(n, \ - spi_gecko_init, \ - NULL, \ - &spi_gecko_data_##n, \ - &spi_gecko_cfg_##n, \ - POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(n,\ + spi_gecko_init,\ + NULL, \ + &spi_gecko_data_##n,\ + &spi_gecko_cfg_##n,\ + POST_KERNEL,\ &spi_gecko_api); #endif /* CONFIG_PINCTRL */ diff --git a/drivers/spi/spi_grlib_spimctrl.c b/drivers/spi/spi_grlib_spimctrl.c index eab20757d7cda..7f4003dee2a64 100644 --- a/drivers/spi/spi_grlib_spimctrl.c +++ b/drivers/spi/spi_grlib_spimctrl.c @@ -236,13 +236,12 @@ static struct spi_driver_api api = { SPI_CONTEXT_INIT_LOCK(data_##n, ctx), \ SPI_CONTEXT_INIT_SYNC(data_##n, ctx), \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ init, \ NULL, \ &data_##n, \ &cfg_##n, \ POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ &api); DT_INST_FOREACH_STATUS_OKAY(SPI_INIT) diff --git a/drivers/spi/spi_ifx_cat1.c b/drivers/spi/spi_ifx_cat1.c index ef428cf21399a..561e6b2b7b374 100644 --- a/drivers/spi/spi_ifx_cat1.c +++ b/drivers/spi/spi_ifx_cat1.c @@ -344,8 +344,8 @@ static int ifx_cat1_spi_init(const struct device *dev) }, \ .irq_priority = DT_INST_IRQ(n, priority), \ }; \ - DEVICE_DT_INST_DEFINE(n, ifx_cat1_spi_init, NULL, &spi_cat1_data_##n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, ifx_cat1_spi_init, NULL, &spi_cat1_data_##n, \ &spi_cat1_config_##n, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &ifx_cat1_spi_api); + &ifx_cat1_spi_api); DT_INST_FOREACH_STATUS_OKAY(IFX_CAT1_SPI_INIT) diff --git a/drivers/spi/spi_it8xxx2.c b/drivers/spi/spi_it8xxx2.c index 7bdd3ea3aa4aa..9ae30a25abbd5 100644 --- a/drivers/spi/spi_it8xxx2.c +++ b/drivers/spi/spi_it8xxx2.c @@ -524,8 +524,8 @@ static const struct spi_driver_api spi_it8xxx2_driver_api = { SPI_CONTEXT_INIT_SYNC(spi_it8xxx2_data_##n, ctx), \ SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx)}; \ \ - DEVICE_DT_INST_DEFINE(n, &spi_it8xxx2_init, NULL, &spi_it8xxx2_data_##n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &spi_it8xxx2_init, NULL, &spi_it8xxx2_data_##n, \ &spi_it8xxx2_cfg_##n, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &spi_it8xxx2_driver_api); + &spi_it8xxx2_driver_api); DT_INST_FOREACH_STATUS_OKAY(SPI_IT8XXX2_INIT) diff --git a/drivers/spi/spi_litex.c b/drivers/spi/spi_litex.c index f13805082138a..6d46739188f37 100644 --- a/drivers/spi/spi_litex.c +++ b/drivers/spi/spi_litex.c @@ -251,13 +251,12 @@ static const struct spi_driver_api spi_litex_api = { .data_width = DT_INST_PROP(n, data_width), \ .max_cs = DT_INST_PROP(n, max_cs), \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ NULL, \ NULL, \ &spi_litex_data_##n, \ &spi_litex_cfg_##n, \ POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ &spi_litex_api); DT_INST_FOREACH_STATUS_OKAY(SPI_INIT) diff --git a/drivers/spi/spi_litex_litespi.c b/drivers/spi/spi_litex_litespi.c index c15aaed991746..4f65e3010fe8b 100644 --- a/drivers/spi/spi_litex_litespi.c +++ b/drivers/spi/spi_litex_litespi.c @@ -273,7 +273,7 @@ static const struct spi_driver_api spi_litex_api = { .phy_clk_divisor_addr = DT_INST_REG_ADDR_BY_NAME_OR(n, phy_clk_divisor, 0) \ \ }; \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, &spi_litex_data_##n, &spi_litex_cfg_##n, POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, &spi_litex_api); + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, &spi_litex_data_##n, &spi_litex_cfg_##n, POST_KERNEL,\ + &spi_litex_api); DT_INST_FOREACH_STATUS_OKAY(SPI_INIT) diff --git a/drivers/spi/spi_ll_stm32.c b/drivers/spi/spi_ll_stm32.c index a2d682267e897..704c948122082 100644 --- a/drivers/spi/spi_ll_stm32.c +++ b/drivers/spi/spi_ll_stm32.c @@ -1396,10 +1396,9 @@ static struct spi_stm32_data spi_stm32_dev_data_##id = { \ \ PM_DEVICE_DT_INST_DEFINE(id, spi_stm32_pm_action); \ \ -DEVICE_DT_INST_DEFINE(id, spi_stm32_init, PM_DEVICE_DT_INST_GET(id), \ +DEVICE_INSTANCE_FROM_DT_INST(id, spi_stm32_init, PM_DEVICE_DT_INST_GET(id),\ &spi_stm32_dev_data_##id, &spi_stm32_cfg_##id, \ - POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &api_funcs); \ + POST_KERNEL, &api_funcs); \ \ STM32_SPI_IRQ_HANDLER(id) diff --git a/drivers/spi/spi_max32.c b/drivers/spi/spi_max32.c index efa1024761e4a..aae6f92d5f264 100644 --- a/drivers/spi/spi_max32.c +++ b/drivers/spi/spi_max32.c @@ -965,8 +965,7 @@ static const struct spi_driver_api spi_max32_api = { SPI_CONTEXT_INIT_SYNC(max32_spi_data_##_num, ctx), \ SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(_num), ctx) \ IF_ENABLED(CONFIG_SPI_RTIO, (.rtio_ctx = &max32_spi_rtio_##_num))}; \ - DEVICE_DT_INST_DEFINE(_num, spi_max32_init, NULL, &max32_spi_data_##_num, \ - &max32_spi_config_##_num, PRE_KERNEL_2, CONFIG_SPI_INIT_PRIORITY, \ - &spi_max32_api); + DEVICE_INSTANCE_FROM_DT_INST(_num, spi_max32_init, NULL, &max32_spi_data_##_num, \ + &max32_spi_config_##_num, PRE_KERNEL_2, &spi_max32_api); DT_INST_FOREACH_STATUS_OKAY(DEFINE_SPI_MAX32) diff --git a/drivers/spi/spi_mchp_mss.c b/drivers/spi/spi_mchp_mss.c index 7b552972c81ee..064f99f35bdca 100644 --- a/drivers/spi/spi_mchp_mss.c +++ b/drivers/spi/spi_mchp_mss.c @@ -477,8 +477,7 @@ static const struct spi_driver_api mss_spi_driver_api = { SPI_CONTEXT_INIT_SYNC(mss_spi_data_##n, ctx), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, mss_spi_init_##n, NULL, &mss_spi_data_##n, &mss_spi_config_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &mss_spi_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, mss_spi_init_##n, NULL, &mss_spi_data_##n, &mss_spi_config_##n,\ + POST_KERNEL, &mss_spi_driver_api); DT_INST_FOREACH_STATUS_OKAY(MSS_SPI_INIT) diff --git a/drivers/spi/spi_mchp_mss_qspi.c b/drivers/spi/spi_mchp_mss_qspi.c index 6f552096c5461..c93ebcec60069 100644 --- a/drivers/spi/spi_mchp_mss_qspi.c +++ b/drivers/spi/spi_mchp_mss_qspi.c @@ -594,11 +594,10 @@ static const struct spi_driver_api mss_qspi_driver_api = { SPI_CONTEXT_INIT_SYNC(mss_qspi_data_##n, ctx), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, mss_qspi_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, mss_qspi_init, \ NULL, \ - &mss_qspi_data_##n, \ - &mss_qspi_config_##n, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ + &mss_qspi_data_##n, \ + &mss_qspi_config_##n, POST_KERNEL, \ &mss_qspi_driver_api); \ \ static void mss_qspi_config_func_##n(const struct device *dev) \ diff --git a/drivers/spi/spi_mcux_dspi.c b/drivers/spi/spi_mcux_dspi.c index 745d2c7dd4e78..421bbbd2bde7c 100644 --- a/drivers/spi/spi_mcux_dspi.c +++ b/drivers/spi/spi_mcux_dspi.c @@ -916,13 +916,12 @@ static const struct spi_driver_api spi_mcux_driver_api = { DT_INST_PROP(id, nxp_rx_tx_chn_share), \ .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(id), \ }; \ - DEVICE_DT_INST_DEFINE(id, \ + DEVICE_INSTANCE_FROM_DT_INST(id, \ spi_mcux_init, \ NULL, \ &spi_mcux_data_##id, \ &spi_mcux_config_##id, \ POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ &spi_mcux_driver_api); \ static void spi_mcux_config_func_##id(const struct device *dev) \ { \ diff --git a/drivers/spi/spi_mcux_ecspi.c b/drivers/spi/spi_mcux_ecspi.c index dfdfbcb4f670d..aa6ee03aafd27 100644 --- a/drivers/spi/spi_mcux_ecspi.c +++ b/drivers/spi/spi_mcux_ecspi.c @@ -331,10 +331,9 @@ static const struct spi_driver_api spi_mcux_driver_api = { SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx) \ }; \ \ - DEVICE_DT_INST_DEFINE(n, spi_mcux_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, spi_mcux_init, NULL, \ &spi_mcux_data_##n, &spi_mcux_config_##n, \ - POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_mcux_driver_api); \ + POST_KERNEL, &spi_mcux_driver_api); \ \ static void spi_mcux_config_func_##n(const struct device *dev) \ { \ diff --git a/drivers/spi/spi_mcux_flexcomm.c b/drivers/spi/spi_mcux_flexcomm.c index 3624cd334c12c..0dafb71cf6b06 100644 --- a/drivers/spi/spi_mcux_flexcomm.c +++ b/drivers/spi/spi_mcux_flexcomm.c @@ -901,13 +901,12 @@ static void spi_mcux_config_func_##id(const struct device *dev) \ SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(id), ctx) \ SPI_DMA_CHANNELS(id) \ }; \ - DEVICE_DT_INST_DEFINE(id, \ + DEVICE_INSTANCE_FROM_DT_INST(id, \ spi_mcux_init, \ NULL, \ &spi_mcux_data_##id, \ &spi_mcux_config_##id, \ POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ &spi_mcux_driver_api); \ \ SPI_MCUX_FLEXCOMM_IRQ_HANDLER(id) diff --git a/drivers/spi/spi_mcux_flexio.c b/drivers/spi/spi_mcux_flexio.c index a071b16e53407..bda1d14c6aee2 100644 --- a/drivers/spi/spi_mcux_flexio.c +++ b/drivers/spi/spi_mcux_flexio.c @@ -439,10 +439,9 @@ static const struct spi_driver_api spi_mcux_driver_api = { SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx) \ }; \ \ - DEVICE_DT_INST_DEFINE(n, spi_mcux_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, spi_mcux_init, NULL, \ &spi_mcux_flexio_data_##n, \ - &spi_mcux_flexio_config_##n, POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ + &spi_mcux_flexio_config_##n, POST_KERNEL,\ &spi_mcux_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(SPI_MCUX_FLEXIO_SPI_INIT) diff --git a/drivers/spi/spi_mcux_lpspi.c b/drivers/spi/spi_mcux_lpspi.c index 11deabce1d30d..5c829fcc99d1f 100644 --- a/drivers/spi/spi_mcux_lpspi.c +++ b/drivers/spi/spi_mcux_lpspi.c @@ -895,8 +895,8 @@ static const struct spi_driver_api spi_mcux_driver_api = { \ }; \ \ - DEVICE_DT_INST_DEFINE(n, spi_mcux_init, NULL, &spi_mcux_data_##n, &spi_mcux_config_##n, \ - POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, &spi_mcux_driver_api); \ + DEVICE_INSTANCE_FROM_DT_INST(n, spi_mcux_init, NULL, &spi_mcux_data_##n, &spi_mcux_config_##n,\ + POST_KERNEL, &spi_mcux_driver_api); \ \ static void spi_mcux_config_func_##n(const struct device *dev) \ { \ diff --git a/drivers/spi/spi_npcx_spip.c b/drivers/spi/spi_npcx_spip.c index 06db6d11aa153..428b263d7dc6b 100644 --- a/drivers/spi/spi_npcx_spip.c +++ b/drivers/spi/spi_npcx_spip.c @@ -443,8 +443,7 @@ static struct spi_driver_api spi_npcx_spip_api = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ NPCX_SPIP_IRQ_HANDLER_FUNC(n)}; \ \ - DEVICE_DT_INST_DEFINE(n, spi_npcx_spip_init, NULL, &spi_npcx_spip_data_##n, \ - &spi_npcx_spip_cfg_##n, POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_npcx_spip_api); + DEVICE_INSTANCE_FROM_DT_INST(n, spi_npcx_spip_init, NULL, &spi_npcx_spip_data_##n, \ + &spi_npcx_spip_cfg_##n, POST_KERNEL, &spi_npcx_spip_api); DT_INST_FOREACH_STATUS_OKAY(NPCX_SPI_INIT) diff --git a/drivers/spi/spi_nrfx_spi.c b/drivers/spi/spi_nrfx_spi.c index 019cd481ea9e7..0c9c034ef1b62 100644 --- a/drivers/spi/spi_nrfx_spi.c +++ b/drivers/spi/spi_nrfx_spi.c @@ -456,13 +456,12 @@ static int spi_nrfx_init(const struct device *dev) !(DT_GPIO_FLAGS(SPI(idx), wake_gpios) & GPIO_ACTIVE_LOW), \ "WAKE line must be configured as active high"); \ PM_DEVICE_DT_DEFINE(SPI(idx), spi_nrfx_pm_action); \ - DEVICE_DT_DEFINE(SPI(idx), \ - spi_nrfx_init, \ - PM_DEVICE_DT_GET(SPI(idx)), \ - &spi_##idx##_data, \ - &spi_##idx##z_config, \ - POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_nrfx_driver_api) + DEVICE_INSTANCE(SPI(idx), \ + spi_nrfx_init, \ + PM_DEVICE_DT_GET(SPI(idx)), \ + &spi_##idx##_data, \ + &spi_##idx##z_config, \ + POST_KERNEL, &spi_nrfx_driver_api) #ifdef CONFIG_HAS_HW_NRF_SPI0 SPI_NRFX_SPI_DEFINE(0); diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 3de9f82709c5d..c5f1b81ead140 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -729,13 +729,12 @@ static int spi_nrfx_init(const struct device *dev) !(DT_GPIO_FLAGS(SPIM(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ "WAKE line must be configured as active high"); \ PM_DEVICE_DT_DEFINE(SPIM(idx), spim_nrfx_pm_action); \ - DEVICE_DT_DEFINE(SPIM(idx), \ - spi_nrfx_init, \ - PM_DEVICE_DT_GET(SPIM(idx)), \ - &spi_##idx##_data, \ - &spi_##idx##z_config, \ - POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_nrfx_driver_api) + DEVICE_INSTANCE(SPIM(idx), \ + spi_nrfx_init, \ + PM_DEVICE_DT_GET(SPIM(idx)), \ + &spi_##idx##_data, \ + &spi_##idx##z_config, \ + POST_KERNEL, &spi_nrfx_driver_api) #define SPIM_MEMORY_SECTION(idx) \ COND_CODE_1(SPIM_HAS_PROP(idx, memory_regions), \ diff --git a/drivers/spi/spi_nrfx_spis.c b/drivers/spi/spi_nrfx_spis.c index 9a5fc3a0e6730..bea0bbc2e4aad 100644 --- a/drivers/spi/spi_nrfx_spis.c +++ b/drivers/spi/spi_nrfx_spis.c @@ -394,13 +394,12 @@ static int spi_nrfx_init(const struct device *dev) BUILD_ASSERT(!DT_NODE_HAS_PROP(SPIS(idx), wake_gpios) || \ !(DT_GPIO_FLAGS(SPIS(idx), wake_gpios) & GPIO_ACTIVE_LOW),\ "WAKE line must be configured as active high"); \ - DEVICE_DT_DEFINE(SPIS(idx), \ - spi_nrfx_init, \ - NULL, \ - &spi_##idx##_data, \ - &spi_##idx##z_config, \ - POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ + DEVICE_INSTANCE(SPIS(idx), \ + spi_nrfx_init, \ + NULL, \ + &spi_##idx##_data, \ + &spi_##idx##z_config, \ + POST_KERNEL, \ &spi_nrfx_driver_api) /* Macro creates device instance if it is enabled in devicetree. */ diff --git a/drivers/spi/spi_numaker.c b/drivers/spi/spi_numaker.c index 65ef4bfda4456..a3b13109aef56 100644 --- a/drivers/spi/spi_numaker.c +++ b/drivers/spi/spi_numaker.c @@ -360,8 +360,7 @@ static int spi_numaker_init(const struct device *dev) .clk_dev = DEVICE_DT_GET(DT_PARENT(DT_INST_CLOCKS_CTLR(inst))), \ .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \ }; \ - DEVICE_DT_INST_DEFINE(inst, spi_numaker_init, NULL, &spi_numaker_data_##inst, \ - &spi_numaker_config_##inst, POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_numaker_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, spi_numaker_init, NULL, &spi_numaker_data_##inst, \ + &spi_numaker_config_##inst, POST_KERNEL, &spi_numaker_driver_api); DT_INST_FOREACH_STATUS_OKAY(NUMAKER_SPI_INIT) diff --git a/drivers/spi/spi_nxp_s32.c b/drivers/spi/spi_nxp_s32.c index 2df61244ece26..567b8307260f4 100644 --- a/drivers/spi/spi_nxp_s32.c +++ b/drivers/spi/spi_nxp_s32.c @@ -703,10 +703,9 @@ static const struct spi_driver_api spi_nxp_s32_driver_api = { SPI_CONTEXT_INIT_SYNC(spi_nxp_s32_data_##n, ctx), \ SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx) \ }; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ spi_nxp_s32_init, NULL, \ &spi_nxp_s32_data_##n, &spi_nxp_s32_config_##n, \ - POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_nxp_s32_driver_api); + POST_KERNEL, &spi_nxp_s32_driver_api); DT_INST_FOREACH_STATUS_OKAY(SPI_NXP_S32_DEVICE) diff --git a/drivers/spi/spi_oc_simple.c b/drivers/spi/spi_oc_simple.c index 603bba60deaa3..3020f80318671 100644 --- a/drivers/spi/spi_oc_simple.c +++ b/drivers/spi/spi_oc_simple.c @@ -231,13 +231,12 @@ int spi_oc_simple_init(const struct device *dev) SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(inst), ctx) \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ spi_oc_simple_init, \ NULL, \ &spi_oc_simple_data_##inst, \ &spi_oc_simple_cfg_##inst, \ POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ &spi_oc_simple_api); DT_INST_FOREACH_STATUS_OKAY(SPI_OC_INIT) diff --git a/drivers/spi/spi_opentitan.c b/drivers/spi/spi_opentitan.c index 46cc059592f18..2d5cc756a2664 100644 --- a/drivers/spi/spi_opentitan.c +++ b/drivers/spi/spi_opentitan.c @@ -323,13 +323,12 @@ static const struct spi_driver_api spi_opentitan_api = { .base = DT_INST_REG_ADDR(n), \ .f_input = DT_INST_PROP(n, clock_frequency), \ }; \ - DEVICE_DT_INST_DEFINE(n, \ - spi_opentitan_init, \ - NULL, \ - &spi_opentitan_data_##n, \ - &spi_opentitan_cfg_##n, \ - POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(n,\ + spi_opentitan_init,\ + NULL, \ + &spi_opentitan_data_##n,\ + &spi_opentitan_cfg_##n,\ + POST_KERNEL,\ &spi_opentitan_api); DT_INST_FOREACH_STATUS_OKAY(SPI_INIT) diff --git a/drivers/spi/spi_pl022.c b/drivers/spi/spi_pl022.c index 0b4f30f2db1ce..8b87443b259eb 100644 --- a/drivers/spi/spi_pl022.c +++ b/drivers/spi/spi_pl022.c @@ -1031,8 +1031,7 @@ static int spi_pl022_init(const struct device *dev) (.dma_enabled = false,)) \ IF_ENABLED(CONFIG_SPI_PL022_INTERRUPT, \ (.irq_config = spi_pl022_irq_config_##idx,))}; \ - DEVICE_DT_INST_DEFINE(idx, spi_pl022_init, NULL, &spi_pl022_data_##idx, \ - &spi_pl022_cfg_##idx, POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_pl022_api); + DEVICE_INSTANCE_FROM_DT_INST(idx, spi_pl022_init, NULL, &spi_pl022_data_##idx, \ + &spi_pl022_cfg_##idx, POST_KERNEL, &spi_pl022_api); DT_INST_FOREACH_STATUS_OKAY(SPI_PL022_INIT) diff --git a/drivers/spi/spi_psoc6.c b/drivers/spi/spi_psoc6.c index c37da3117548e..9b73f7dc27174 100644 --- a/drivers/spi/spi_psoc6.c +++ b/drivers/spi/spi_psoc6.c @@ -430,10 +430,9 @@ static const struct spi_driver_api spi_psoc6_driver_api = { SPI_CONTEXT_INIT_SYNC(spi_psoc6_dev_data_##n, ctx), \ SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx) \ }; \ - DEVICE_DT_INST_DEFINE(n, spi_psoc6_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, spi_psoc6_init, NULL, \ &spi_psoc6_dev_data_##n, \ &spi_psoc6_config_##n, POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ &spi_psoc6_driver_api); \ static void spi_psoc6_spi##n##_irq_cfg(const struct device *port) \ { \ diff --git a/drivers/spi/spi_pw.c b/drivers/spi/spi_pw.c index 72268f5885234..9e0b140124ae0 100644 --- a/drivers/spi/spi_pw.c +++ b/drivers/spi/spi_pw.c @@ -871,10 +871,9 @@ static int spi_pw_init(const struct device *dev) .clock_freq = DT_INST_PROP(n, clock_frequency), \ INIT_PCIE(n) \ }; \ - DEVICE_DT_INST_DEFINE(n, spi_pw_init, NULL, \ - &spi_##n##_data, &spi_##n##_config, \ - POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &pw_spi_api); + DEVICE_INSTANCE_FROM_DT_INST(n, spi_pw_init, NULL, \ + &spi_##n##_data, &spi_##n##_config, \ + POST_KERNEL, &pw_spi_api); #else #define SPI_PW_DEV_INIT(n) \ @@ -891,10 +890,9 @@ static int spi_pw_init(const struct device *dev) .clock_freq = DT_INST_PROP(n, clock_frequency), \ INIT_PCIE(n) \ }; \ - DEVICE_DT_INST_DEFINE(n, spi_pw_init, NULL, \ - &spi_##n##_data, &spi_##n##_config, \ - POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &pw_spi_api); + DEVICE_INSTANCE_FROM_DT_INST(n, spi_pw_init, NULL, \ + &spi_##n##_data, &spi_##n##_config, \ + POST_KERNEL, &pw_spi_api); #endif diff --git a/drivers/spi/spi_renesas_ra.c b/drivers/spi/spi_renesas_ra.c index 75d830c737ca5..41c021ad5ec3a 100644 --- a/drivers/spi/spi_renesas_ra.c +++ b/drivers/spi/spi_renesas_ra.c @@ -819,8 +819,8 @@ static void ra_spi_eri_isr(const struct device *dev) return 0; \ } \ \ - DEVICE_DT_INST_DEFINE(index, spi_ra_init##index, PM_DEVICE_DT_INST_GET(index), \ + DEVICE_INSTANCE_FROM_DT_INST(index, spi_ra_init##index, PM_DEVICE_DT_INST_GET(index), \ &ra_spi_data_##index, &ra_spi_config_##index, PRE_KERNEL_1, \ - CONFIG_SPI_INIT_PRIORITY, &ra_spi_driver_api); + &ra_spi_driver_api); DT_INST_FOREACH_STATUS_OKAY(RA_SPI_INIT) diff --git a/drivers/spi/spi_rpi_pico_pio.c b/drivers/spi/spi_rpi_pico_pio.c index 951ac4c7936dd..3d74586bc7d82 100644 --- a/drivers/spi/spi_rpi_pico_pio.c +++ b/drivers/spi/spi_rpi_pico_pio.c @@ -759,9 +759,8 @@ int spi_pico_pio_init(const struct device *dev) SPI_CONTEXT_INIT_LOCK(spi_pico_pio_data_##inst, spi_ctx), \ SPI_CONTEXT_INIT_SYNC(spi_pico_pio_data_##inst, spi_ctx), \ SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(inst), spi_ctx)}; \ - DEVICE_DT_INST_DEFINE(inst, spi_pico_pio_init, NULL, &spi_pico_pio_data_##inst, \ - &spi_pico_pio_config_##inst, POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_pico_pio_api); \ + DEVICE_INSTANCE_FROM_DT_INST(inst, spi_pico_pio_init, NULL, &spi_pico_pio_data_##inst, \ + &spi_pico_pio_config_##inst, POST_KERNEL, &spi_pico_pio_api); \ BUILD_ASSERT(DT_INST_NODE_HAS_PROP(inst, clk_gpios), "Missing clock GPIO"); \ BUILD_ASSERT(((DT_INST_NODE_HAS_PROP(inst, mosi_gpios) || \ DT_INST_NODE_HAS_PROP(inst, miso_gpios)) && \ diff --git a/drivers/spi/spi_rv32m1_lpspi.c b/drivers/spi/spi_rv32m1_lpspi.c index d17da8906d933..81298f1514f3d 100644 --- a/drivers/spi/spi_rv32m1_lpspi.c +++ b/drivers/spi/spi_rv32m1_lpspi.c @@ -330,11 +330,10 @@ static const struct spi_driver_api spi_mcux_driver_api = { SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx) \ }; \ \ - DEVICE_DT_INST_DEFINE(n, spi_mcux_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, spi_mcux_init, NULL, \ &spi_mcux_data_##n, \ &spi_mcux_config_##n, \ POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ &spi_mcux_driver_api); \ \ static void spi_mcux_config_func_##n(const struct device *dev) \ diff --git a/drivers/spi/spi_sam.c b/drivers/spi/spi_sam.c index 94120906de5b6..6cbb765e6c839 100644 --- a/drivers/spi/spi_sam.c +++ b/drivers/spi/spi_sam.c @@ -890,9 +890,9 @@ static const struct spi_driver_api spi_sam_driver_api = { SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx) \ IF_ENABLED(CONFIG_SPI_RTIO, (.rtio_ctx = &spi_sam_rtio_##n)) \ }; \ - DEVICE_DT_INST_DEFINE(n, &spi_sam_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &spi_sam_init, NULL, \ &spi_sam_dev_data_##n, \ &spi_sam_config_##n, POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, &spi_sam_driver_api); + &spi_sam_driver_api); DT_INST_FOREACH_STATUS_OKAY(SPI_SAM_DEVICE_INIT) diff --git a/drivers/spi/spi_sam0.c b/drivers/spi/spi_sam0.c index b0da362ea86f6..610b274eb0da0 100644 --- a/drivers/spi/spi_sam0.c +++ b/drivers/spi/spi_sam0.c @@ -748,10 +748,9 @@ static const struct spi_sam0_config spi_sam0_config_##n = { \ SPI_CONTEXT_INIT_SYNC(spi_sam0_dev_data_##n, ctx), \ SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx) \ }; \ - DEVICE_DT_INST_DEFINE(n, spi_sam0_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, spi_sam0_init, NULL, \ &spi_sam0_dev_data_##n, \ &spi_sam0_config_##n, POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ &spi_sam0_driver_api); DT_INST_FOREACH_STATUS_OKAY(SPI_SAM0_DEVICE_INIT) diff --git a/drivers/spi/spi_sedi.c b/drivers/spi/spi_sedi.c index 3c859a7dbf94c..b686a7ff06075 100644 --- a/drivers/spi/spi_sedi.c +++ b/drivers/spi/spi_sedi.c @@ -407,13 +407,12 @@ static int spi_sedi_device_ctrl(const struct device *dev, .spi_device = num, .irq_config = spi_##num##_irq_init, \ }; \ PM_DEVICE_DEFINE(spi_##num, spi_sedi_device_ctrl); \ - DEVICE_DT_INST_DEFINE(num, \ - spi_sedi_init, \ - PM_DEVICE_GET(spi_##num), \ - &spi_##num##_data, \ - &spi_##num##_config, \ - POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(num, \ + spi_sedi_init, \ + PM_DEVICE_GET(spi_##num), \ + &spi_##num##_data, \ + &spi_##num##_config, \ + POST_KERNEL, \ &sedi_spi_api); DT_INST_FOREACH_STATUS_OKAY(CREATE_SEDI_SPI_INSTANCE) diff --git a/drivers/spi/spi_sifive.c b/drivers/spi/spi_sifive.c index ebbc9ea42f329..22bcde08209c9 100644 --- a/drivers/spi/spi_sifive.c +++ b/drivers/spi/spi_sifive.c @@ -292,13 +292,12 @@ static const struct spi_driver_api spi_sifive_api = { .f_sys = SIFIVE_PERIPHERAL_CLOCK_FREQUENCY, \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ }; \ - DEVICE_DT_INST_DEFINE(n, \ - spi_sifive_init, \ - NULL, \ - &spi_sifive_data_##n, \ - &spi_sifive_cfg_##n, \ - POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(n,\ + spi_sifive_init,\ + NULL, \ + &spi_sifive_data_##n,\ + &spi_sifive_cfg_##n,\ + POST_KERNEL,\ &spi_sifive_api); DT_INST_FOREACH_STATUS_OKAY(SPI_INIT) diff --git a/drivers/spi/spi_smartbond.c b/drivers/spi/spi_smartbond.c index 7a2be279e986b..ee949cb97021c 100644 --- a/drivers/spi/spi_smartbond.c +++ b/drivers/spi/spi_smartbond.c @@ -1328,12 +1328,11 @@ static int spi_smartbond_init(const struct device *dev) SPI_CONTEXT_INIT_SYNC(spi_smartbond_##id##_data, ctx), \ SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(id), ctx)}; \ PM_DEVICE_DT_INST_DEFINE(id, spi_smartbond_pm_action); \ - DEVICE_DT_INST_DEFINE(id, \ + DEVICE_INSTANCE_FROM_DT_INST(id, \ spi_smartbond_init, \ PM_DEVICE_DT_INST_GET(id), \ &spi_smartbond_##id##_data, \ &spi_smartbond_##id##_cfg, \ - POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_smartbond_driver_api); + POST_KERNEL, &spi_smartbond_driver_api); DT_INST_FOREACH_STATUS_OKAY(SPI_SMARTBOND_DEVICE) diff --git a/drivers/spi/spi_test.c b/drivers/spi/spi_test.c index 21274aa7d2c96..156d5fd450fe7 100644 --- a/drivers/spi/spi_test.c +++ b/drivers/spi/spi_test.c @@ -53,8 +53,7 @@ static const struct spi_driver_api vnd_spi_api = { }; #define VND_SPI_INIT(n) \ - DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ + DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, NULL, NULL, POST_KERNEL,\ &vnd_spi_api); DT_INST_FOREACH_STATUS_OKAY(VND_SPI_INIT) diff --git a/drivers/spi/spi_xec_qmspi.c b/drivers/spi/spi_xec_qmspi.c index 02cd34d259f95..55ffbc35b68da 100644 --- a/drivers/spi/spi_xec_qmspi.c +++ b/drivers/spi/spi_xec_qmspi.c @@ -703,9 +703,9 @@ static struct spi_qmspi_data spi_qmspi_0_dev_data = { SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(0), ctx) }; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, qmspi_init, NULL, &spi_qmspi_0_dev_data, &spi_qmspi_0_config, POST_KERNEL, - CONFIG_SPI_INIT_PRIORITY, &spi_qmspi_driver_api); + &spi_qmspi_driver_api); #endif /* DT_NODE_HAS_STATUS_OKAY(DT_INST(0, microchip_xec_qmspi)) */ diff --git a/drivers/spi/spi_xec_qmspi_ldma.c b/drivers/spi/spi_xec_qmspi_ldma.c index 9705c7ea99d79..772359f32cd72 100644 --- a/drivers/spi/spi_xec_qmspi_ldma.c +++ b/drivers/spi/spi_xec_qmspi_ldma.c @@ -1071,10 +1071,9 @@ static const struct spi_driver_api spi_qmspi_xec_driver_api = { .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(i), \ }; \ PM_DEVICE_DT_INST_DEFINE(i, qmspi_xec_pm_action); \ - DEVICE_DT_INST_DEFINE(i, qmspi_xec_init, \ + DEVICE_INSTANCE_FROM_DT_INST(i, qmspi_xec_init, \ PM_DEVICE_DT_INST_GET(i), \ &qmspi_xec_data_##i, &qmspi_xec_config_##i, \ - POST_KERNEL, CONFIG_SPI_INIT_PRIORITY, \ - &spi_qmspi_xec_driver_api); + POST_KERNEL, &spi_qmspi_xec_driver_api); DT_INST_FOREACH_STATUS_OKAY(QMSPI_XEC_DEVICE) diff --git a/drivers/spi/spi_xlnx_axi_quadspi.c b/drivers/spi/spi_xlnx_axi_quadspi.c index 969b6a0845ef1..58803400dda55 100644 --- a/drivers/spi/spi_xlnx_axi_quadspi.c +++ b/drivers/spi/spi_xlnx_axi_quadspi.c @@ -620,11 +620,10 @@ static const struct spi_driver_api xlnx_quadspi_driver_api = { SPI_CONTEXT_CS_GPIOS_INITIALIZE(DT_DRV_INST(n), ctx) \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &xlnx_quadspi_init, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &xlnx_quadspi_init, \ NULL, \ &xlnx_quadspi_data_##n, \ &xlnx_quadspi_config_##n, POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, \ &xlnx_quadspi_driver_api); \ \ static void xlnx_quadspi_config_func_##n(const struct device *dev) \ diff --git a/drivers/spi/spi_xmc4xxx.c b/drivers/spi/spi_xmc4xxx.c index 54214d22cdc36..f2e63770ed8ab 100644 --- a/drivers/spi/spi_xmc4xxx.c +++ b/drivers/spi/spi_xmc4xxx.c @@ -688,8 +688,8 @@ static const struct spi_driver_api spi_xmc4xxx_driver_api = { XMC4XXX_IRQ_HANDLER_STRUCT_INIT(index) \ XMC4XXX_IRQ_DMA_STRUCT_INIT(index)}; \ \ - DEVICE_DT_INST_DEFINE(index, spi_xmc4xxx_init, NULL, &xmc4xxx_data_##index, \ + DEVICE_INSTANCE_FROM_DT_INST(index, spi_xmc4xxx_init, NULL, &xmc4xxx_data_##index, \ &xmc4xxx_config_##index, POST_KERNEL, \ - CONFIG_SPI_INIT_PRIORITY, &spi_xmc4xxx_driver_api); + &spi_xmc4xxx_driver_api); DT_INST_FOREACH_STATUS_OKAY(XMC4XXX_INIT) diff --git a/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c b/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c index 68d943fff9da5..9ea9c8d426784 100644 --- a/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c +++ b/drivers/stepper/adi_tmc/adi_tmc5041_stepper_controller.c @@ -735,9 +735,9 @@ static int tmc5041_stepper_init(const struct device *dev) .set_event_callback = tmc5041_stepper_set_event_callback, }; #define TMC5041_STEPPER_DEFINE(child) \ - DEVICE_DT_DEFINE(child, tmc5041_stepper_init, NULL, &tmc5041_stepper_data_##child, \ + DEVICE_INSTANCE(child, tmc5041_stepper_init, NULL, &tmc5041_stepper_data_##child, \ &tmc5041_stepper_config_##child, POST_KERNEL, \ - CONFIG_STEPPER_INIT_PRIORITY, &tmc5041_stepper_api_##child); + &tmc5041_stepper_api_##child); #define TMC5041_DEFINE(inst) \ BUILD_ASSERT(DT_INST_CHILD_NUM(inst) <= 2, "tmc5041 can drive two steppers at max"); \ @@ -757,8 +757,7 @@ static int tmc5041_stepper_init(const struct device *dev) DT_INST_FOREACH_CHILD(inst, TMC5041_STEPPER_DATA_DEFINE); \ DT_INST_FOREACH_CHILD(inst, TMC5041_STEPPER_API_DEFINE); \ DT_INST_FOREACH_CHILD(inst, TMC5041_STEPPER_DEFINE); \ - DEVICE_DT_INST_DEFINE(inst, tmc5041_init, NULL, &tmc5041_data_##inst, \ - &tmc5041_config_##inst, POST_KERNEL, CONFIG_STEPPER_INIT_PRIORITY,\ - NULL); + DEVICE_INSTANCE_FROM_DT_INST(inst, tmc5041_init, NULL, &tmc5041_data_##inst, \ + &tmc5041_config_##inst, POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(TMC5041_DEFINE) diff --git a/drivers/stepper/fake_stepper_controller.c b/drivers/stepper/fake_stepper_controller.c index 09af68b9c5cd2..fc407e6a0770e 100644 --- a/drivers/stepper/fake_stepper_controller.c +++ b/drivers/stepper/fake_stepper_controller.c @@ -142,8 +142,7 @@ static const struct stepper_driver_api fake_stepper_driver_api = { \ static struct fake_stepper_data fake_stepper_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, fake_stepper_init, NULL, &fake_stepper_data_##inst, NULL, \ - POST_KERNEL, CONFIG_STEPPER_INIT_PRIORITY, \ - &fake_stepper_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, fake_stepper_init, NULL, &fake_stepper_data_##inst, NULL,\ + POST_KERNEL, &fake_stepper_driver_api); DT_INST_FOREACH_STATUS_OKAY(FAKE_STEPPER_INIT) diff --git a/drivers/stepper/gpio_stepper_controller.c b/drivers/stepper/gpio_stepper_controller.c index c3e635cb03643..7592a205728a1 100644 --- a/drivers/stepper/gpio_stepper_controller.c +++ b/drivers/stepper/gpio_stepper_controller.c @@ -380,8 +380,8 @@ static const struct stepper_driver_api gpio_stepper_api = { }; \ BUILD_ASSERT(DT_INST_PROP(inst, micro_step_res) <= STEPPER_MICRO_STEP_2, \ "gpio_stepper_controller driver supports up to 2 micro steps"); \ - DEVICE_DT_INST_DEFINE(inst, gpio_stepper_init, NULL, &gpio_stepper_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, gpio_stepper_init, NULL, &gpio_stepper_data_##inst, \ &gpio_stepper_config_##inst, POST_KERNEL, \ - CONFIG_STEPPER_INIT_PRIORITY, &gpio_stepper_api); + &gpio_stepper_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_STEPPER_DEFINE) diff --git a/drivers/syscon/syscon.c b/drivers/syscon/syscon.c index 2b880f9f5744e..1b2a6750febe4 100644 --- a/drivers/syscon/syscon.c +++ b/drivers/syscon/syscon.c @@ -143,8 +143,8 @@ static int syscon_generic_init(const struct device *dev) static struct syscon_generic_data syscon_generic_data_##inst = { \ .size = DT_INST_REG_SIZE(inst), \ }; \ - DEVICE_DT_INST_DEFINE(inst, syscon_generic_init, NULL, &syscon_generic_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, syscon_generic_init, NULL, &syscon_generic_data_##inst, \ &syscon_generic_config_##inst, PRE_KERNEL_1, \ - CONFIG_SYSCON_INIT_PRIORITY, &syscon_generic_driver_api); + &syscon_generic_driver_api); DT_INST_FOREACH_STATUS_OKAY(SYSCON_INIT); diff --git a/drivers/tee/optee/optee.c b/drivers/tee/optee/optee.c index 1b1a3fb8d9207..c02a1aa9de9d8 100644 --- a/drivers/tee/optee/optee.c +++ b/drivers/tee/optee/optee.c @@ -1288,9 +1288,8 @@ static const struct tee_driver_api optee_driver_api = { .notif_bitmap = ¬if_bitmap_##inst \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, optee_init, NULL, &optee_data_##inst, \ - &optee_config_##inst, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &optee_driver_api); \ + DEVICE_INSTANCE_FROM_DT_INST(inst, optee_init, NULL, &optee_data_##inst,\ + &optee_config_##inst, POST_KERNEL, \ + &optee_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(OPTEE_DT_DEVICE_INIT) diff --git a/drivers/usb/bc12/bc12_pi3usb9201.c b/drivers/usb/bc12/bc12_pi3usb9201.c index 8ca53b20c8a41..5fd577820d173 100644 --- a/drivers/usb/bc12/bc12_pi3usb9201.c +++ b/drivers/usb/bc12/bc12_pi3usb9201.c @@ -615,8 +615,8 @@ static int pi3usb9201_init(const struct device *dev) .charging_mode = DT_INST_STRING_UPPER_TOKEN(inst, charging_mode), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, pi3usb9201_init, NULL, &pi3usb9201_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, pi3usb9201_init, NULL, &pi3usb9201_data_##inst, \ &pi3usb9201_config_##inst, POST_KERNEL, \ - CONFIG_APPLICATION_INIT_PRIORITY, &pi3usb9201_driver_api); + &pi3usb9201_driver_api); DT_INST_FOREACH_STATUS_OKAY(PI2USB9201_DEFINE) diff --git a/drivers/usb/device/usb_dc_it82xx2.c b/drivers/usb/device/usb_dc_it82xx2.c index ee69712026e63..fe5332684795f 100644 --- a/drivers/usb/device/usb_dc_it82xx2.c +++ b/drivers/usb/device/usb_dc_it82xx2.c @@ -1609,10 +1609,9 @@ static int it82xx2_usb_dc_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, &it82xx2_usb_dc_init, NULL, &udata0, &ucfg0, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - NULL); + POST_KERNEL, NULL); diff --git a/drivers/usb/device/usb_dc_numaker.c b/drivers/usb/device/usb_dc_numaker.c index 0f52b165a1349..df1a86be37fcf 100644 --- a/drivers/usb/device/usb_dc_numaker.c +++ b/drivers/usb/device/usb_dc_numaker.c @@ -1994,9 +1994,9 @@ static int numaker_udbd_init(const struct device *dev) BUILD_ASSERT(DT_INST_PROP(inst, num_bidir_endpoints) <= NUMAKER_USBD_EP_MAXNUM, \ "num_bidir_endpoints exceeds support limit by USBD driver"); \ \ - DEVICE_DT_INST_DEFINE(inst, numaker_udbd_init, NULL, &numaker_usbd_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, numaker_udbd_init, NULL, &numaker_usbd_data_##inst, \ &numaker_usbd_config_##inst, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, NULL); + NULL); USB_DC_NUMAKER_INIT(0); diff --git a/drivers/usb/udc/udc_ambiq.c b/drivers/usb/udc/udc_ambiq.c index 887cb64cf6b3c..038a5c8d71597 100644 --- a/drivers/usb/udc/udc_ambiq.c +++ b/drivers/usb/udc/udc_ambiq.c @@ -961,8 +961,8 @@ static const struct udc_api udc_ambiq_api = { .priv = &udc_priv_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, udc_ambiq_driver_init, NULL, &udc_data_##n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, udc_ambiq_driver_init, NULL, &udc_data_##n, \ &udc_ambiq_config_##n, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &udc_ambiq_api); + &udc_ambiq_api); DT_INST_FOREACH_STATUS_OKAY(UDC_AMBIQ_DEVICE_DEFINE) diff --git a/drivers/usb/udc/udc_dwc2.c b/drivers/usb/udc/udc_dwc2.c index 7e716201d3c2a..17d62a2662f49 100644 --- a/drivers/usb/udc/udc_dwc2.c +++ b/drivers/usb/udc/udc_dwc2.c @@ -3067,9 +3067,8 @@ static const struct udc_api udc_dwc2_api = { .priv = &udc_priv_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, dwc2_driver_preinit, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, dwc2_driver_preinit, NULL, \ &udc_data_##n, &udc_dwc2_config_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &udc_dwc2_api); + POST_KERNEL, &udc_dwc2_api); DT_INST_FOREACH_STATUS_OKAY(UDC_DWC2_DEVICE_DEFINE) diff --git a/drivers/usb/udc/udc_it82xx2.c b/drivers/usb/udc/udc_it82xx2.c index 6affd349e7226..0ffb4e260a86e 100644 --- a/drivers/usb/udc/udc_it82xx2.c +++ b/drivers/usb/udc/udc_it82xx2.c @@ -1639,7 +1639,7 @@ static int it82xx2_usb_driver_preinit(const struct device *dev) .priv = &priv_data_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, it82xx2_usb_driver_preinit, NULL, &udc_data_##n, &udc_cfg_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &it82xx2_api); + DEVICE_INSTANCE_FROM_DT_INST(n, it82xx2_usb_driver_preinit, NULL, &udc_data_##n, &udc_cfg_##n,\ + POST_KERNEL, &it82xx2_api); DT_INST_FOREACH_STATUS_OKAY(IT82xx2_USB_DEVICE_DEFINE) diff --git a/drivers/usb/udc/udc_kinetis.c b/drivers/usb/udc/udc_kinetis.c index c471fb15ebda6..af3c0ed4c66c9 100644 --- a/drivers/usb/udc/udc_kinetis.c +++ b/drivers/usb/udc/udc_kinetis.c @@ -1196,9 +1196,8 @@ static const struct udc_api usbfsotg_api = { .priv = &priv_data_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, usbfsotg_driver_preinit, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, usbfsotg_driver_preinit, NULL, \ &udc_data_##n, &priv_config_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &usbfsotg_api); + POST_KERNEL, &usbfsotg_api); DT_INST_FOREACH_STATUS_OKAY(USBFSOTG_DEVICE_DEFINE) diff --git a/drivers/usb/udc/udc_mcux_ehci.c b/drivers/usb/udc/udc_mcux_ehci.c index 3379a3b88e0b7..0c25f4e7b2d41 100644 --- a/drivers/usb/udc/udc_mcux_ehci.c +++ b/drivers/usb/udc/udc_mcux_ehci.c @@ -912,9 +912,8 @@ static usb_phy_config_struct_t phy_config_##n = { \ .priv = &priv_data_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, udc_mcux_driver_preinit, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, udc_mcux_driver_preinit, NULL, \ &udc_data_##n, &priv_config_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &udc_mcux_api); + POST_KERNEL, &udc_mcux_api); DT_INST_FOREACH_STATUS_OKAY(USB_MCUX_EHCI_DEVICE_DEFINE) diff --git a/drivers/usb/udc/udc_mcux_ip3511.c b/drivers/usb/udc/udc_mcux_ip3511.c index d30438319b0e7..3097a7d5903ac 100644 --- a/drivers/usb/udc/udc_mcux_ip3511.c +++ b/drivers/usb/udc/udc_mcux_ip3511.c @@ -935,9 +935,8 @@ static usb_phy_config_struct_t phy_config_##n = { \ .priv = &priv_data_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, udc_mcux_driver_preinit, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, udc_mcux_driver_preinit, NULL, \ &udc_data_##n, &priv_config_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &udc_mcux_api); + POST_KERNEL, &udc_mcux_api); DT_INST_FOREACH_STATUS_OKAY(USB_MCUX_IP3511_DEVICE_DEFINE) diff --git a/drivers/usb/udc/udc_nrf.c b/drivers/usb/udc/udc_nrf.c index e72291744633f..52c914bc93894 100644 --- a/drivers/usb/udc/udc_nrf.c +++ b/drivers/usb/udc/udc_nrf.c @@ -965,7 +965,6 @@ static const struct udc_api udc_nrf_api = { .ep_dequeue = udc_nrf_ep_dequeue, }; -DEVICE_DT_INST_DEFINE(0, udc_nrf_driver_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, udc_nrf_driver_init, NULL, &udc_nrf_data, &udc_nrf_cfg, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &udc_nrf_api); + POST_KERNEL, &udc_nrf_api); diff --git a/drivers/usb/udc/udc_numaker.c b/drivers/usb/udc/udc_numaker.c index 2fba252371f4e..fe83ca528d63a 100644 --- a/drivers/usb/udc/udc_numaker.c +++ b/drivers/usb/udc/udc_numaker.c @@ -1798,8 +1798,8 @@ static const struct udc_api udc_numaker_api = { .priv = &udc_priv_##inst, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, udc_numaker_driver_preinit, NULL, &udc_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, udc_numaker_driver_preinit, NULL, &udc_data_##inst, \ &udc_numaker_config_##inst, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &udc_numaker_api); + &udc_numaker_api); DT_INST_FOREACH_STATUS_OKAY(UDC_NUMAKER_DEVICE_DEFINE) diff --git a/drivers/usb/udc/udc_rpi_pico.c b/drivers/usb/udc/udc_rpi_pico.c index f109418baa98a..dbcf2a83ba968 100644 --- a/drivers/usb/udc/udc_rpi_pico.c +++ b/drivers/usb/udc/udc_rpi_pico.c @@ -1149,9 +1149,8 @@ static const struct udc_api udc_rpi_pico_api = { .priv = &udc_priv_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, udc_rpi_pico_driver_preinit, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, udc_rpi_pico_driver_preinit, NULL, \ &udc_data_##n, &rpi_pico_config_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &udc_rpi_pico_api); + POST_KERNEL, &udc_rpi_pico_api); DT_INST_FOREACH_STATUS_OKAY(UDC_RPI_PICO_DEVICE_DEFINE) diff --git a/drivers/usb/udc/udc_skeleton.c b/drivers/usb/udc/udc_skeleton.c index f8870c87f58be..5952f54c540d2 100644 --- a/drivers/usb/udc/udc_skeleton.c +++ b/drivers/usb/udc/udc_skeleton.c @@ -406,9 +406,8 @@ static const struct udc_api udc_skeleton_api = { .priv = &udc_priv_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, udc_skeleton_driver_preinit, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, udc_skeleton_driver_preinit, NULL, \ &udc_data_##n, &udc_skeleton_config_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &udc_skeleton_api); + POST_KERNEL, &udc_skeleton_api); DT_INST_FOREACH_STATUS_OKAY(UDC_SKELETON_DEVICE_DEFINE) diff --git a/drivers/usb/udc/udc_smartbond.c b/drivers/usb/udc/udc_smartbond.c index 3a214e1b60f29..2e5d5c7e0c843 100644 --- a/drivers/usb/udc/udc_smartbond.c +++ b/drivers/usb/udc/udc_smartbond.c @@ -1773,8 +1773,8 @@ static const struct udc_api udc_smartbond_api = { return 0; \ } \ \ - DEVICE_DT_INST_DEFINE(n, udc_smartbond_driver_preinit_##n, NULL, &udc_data_##n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, udc_smartbond_driver_preinit_##n, NULL, &udc_data_##n, \ &udc_smartbond_cfg_##n, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &udc_smartbond_api); + &udc_smartbond_api); DT_INST_FOREACH_STATUS_OKAY(UDC_SMARTBOND_DEVICE_DEFINE) diff --git a/drivers/usb/udc/udc_stm32.c b/drivers/usb/udc/udc_stm32.c index 627d229975600..842081af540cd 100644 --- a/drivers/usb/udc/udc_stm32.c +++ b/drivers/usb/udc/udc_stm32.c @@ -1232,6 +1232,5 @@ static int udc_stm32_driver_init0(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, udc_stm32_driver_init0, NULL, &udc0_data, &udc0_cfg, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &udc_stm32_api); +DEVICE_INSTANCE_FROM_DT_INST(0, udc_stm32_driver_init0, NULL, &udc0_data, &udc0_cfg, + POST_KERNEL, &udc_stm32_api); diff --git a/drivers/usb/udc/udc_virtual.c b/drivers/usb/udc/udc_virtual.c index cc21649ad672e..c2d372b5cf910 100644 --- a/drivers/usb/udc/udc_virtual.c +++ b/drivers/usb/udc/udc_virtual.c @@ -696,9 +696,8 @@ static const struct udc_api udc_vrt_api = { .priv = &udc_priv_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, udc_vrt_driver_preinit, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, udc_vrt_driver_preinit, NULL, \ &udc_data_##n, &udc_vrt_config_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &udc_vrt_api); + POST_KERNEL, &udc_vrt_api); DT_INST_FOREACH_STATUS_OKAY(UDC_VRT_DEVICE_DEFINE) diff --git a/drivers/usb/uhc/uhc_max3421e.c b/drivers/usb/uhc/uhc_max3421e.c index ac9aa2a526dff..192b3608a8d47 100644 --- a/drivers/usb/uhc/uhc_max3421e.c +++ b/drivers/usb/uhc/uhc_max3421e.c @@ -1121,7 +1121,6 @@ static const struct max3421e_config max3421e_cfg = { .dt_rst = GPIO_DT_SPEC_INST_GET_OR(0, reset_gpios, {0}), }; -DEVICE_DT_INST_DEFINE(0, max3421e_driver_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, max3421e_driver_init, NULL, &max3421e_uhc_data, &max3421e_cfg, - POST_KERNEL, 99, - &max3421e_uhc_api); + POST_KERNEL, &max3421e_uhc_api); diff --git a/drivers/usb/uhc/uhc_virtual.c b/drivers/usb/uhc/uhc_virtual.c index 9e33f75557391..8003d077321ea 100644 --- a/drivers/usb/uhc/uhc_virtual.c +++ b/drivers/usb/uhc/uhc_virtual.c @@ -543,9 +543,8 @@ static const struct uhc_api uhc_vrt_api = { .priv = &uhc_priv_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, uhc_vrt_driver_preinit, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, uhc_vrt_driver_preinit, NULL, \ &uhc_data_##n, &uhc_vrt_config_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &uhc_vrt_api); + POST_KERNEL, &uhc_vrt_api); DT_INST_FOREACH_STATUS_OKAY(UHC_VRT_DEVICE_DEFINE) diff --git a/drivers/usb_c/ppc/nxp_nx20p3483.c b/drivers/usb_c/ppc/nxp_nx20p3483.c index 35d1db7079810..522aad8605b7a 100644 --- a/drivers/usb_c/ppc/nxp_nx20p3483.c +++ b/drivers/usb_c/ppc/nxp_nx20p3483.c @@ -450,8 +450,8 @@ static int nx20p3483_dev_init(const struct device *dev) NX20P3483_DRIVER_CFG_ASSERTS(DT_DRV_INST(inst)); \ static struct nx20p3483_cfg drv_cfg_nx20p3483##inst = \ NX20P3483_DRIVER_CFG_INIT(DT_DRV_INST(inst)); \ - DEVICE_DT_INST_DEFINE(inst, &nx20p3483_dev_init, NULL, &drv_data_nx20p3483##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &nx20p3483_dev_init, NULL, &drv_data_nx20p3483##inst, \ &drv_cfg_nx20p3483##inst, POST_KERNEL, \ - CONFIG_USBC_PPC_INIT_PRIORITY, &nx20p3483_driver_api); + &nx20p3483_driver_api); DT_INST_FOREACH_STATUS_OKAY(NX20P3483_DRIVER_INIT) diff --git a/drivers/usb_c/ppc/usbc_ppc_numaker.c b/drivers/usb_c/ppc/usbc_ppc_numaker.c index a55327c639e0d..602e7e7a5a9fa 100644 --- a/drivers/usb_c/ppc/usbc_ppc_numaker.c +++ b/drivers/usb_c/ppc/usbc_ppc_numaker.c @@ -218,8 +218,7 @@ static const struct usbc_ppc_driver_api numaker_ppc_driver_api = { .tcpc_dev = DEVICE_DT_GET(NUMAKER_TCPC(inst)), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, numaker_ppc_init, NULL, NULL, &numaker_ppc_config_##inst, \ - POST_KERNEL, CONFIG_USBC_PPC_INIT_PRIORITY, \ - &numaker_ppc_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, numaker_ppc_init, NULL, NULL, &numaker_ppc_config_##inst,\ + POST_KERNEL, &numaker_ppc_driver_api); DT_INST_FOREACH_STATUS_OKAY(PPC_NUMAKER_INIT); diff --git a/drivers/usb_c/tcpc/ps8xxx.c b/drivers/usb_c/tcpc/ps8xxx.c index 933764865e638..866988dd09e9a 100644 --- a/drivers/usb_c/tcpc/ps8xxx.c +++ b/drivers/usb_c/tcpc/ps8xxx.c @@ -744,8 +744,7 @@ static int ps8xxx_dev_init(const struct device *dev) static struct ps8xxx_data drv_data_ps8xxx##inst = \ PS8XXX_DRIVER_DATA_INIT(DT_DRV_INST(inst)); \ static struct ps8xxx_cfg drv_cfg_ps8xxx##inst = PS8XXX_DRIVER_CFG_INIT(DT_DRV_INST(inst)); \ - DEVICE_DT_INST_DEFINE(inst, &ps8xxx_dev_init, NULL, &drv_data_ps8xxx##inst, \ - &drv_cfg_ps8xxx##inst, POST_KERNEL, CONFIG_USBC_TCPC_INIT_PRIORITY, \ - &ps8xxx_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, &ps8xxx_dev_init, NULL, &drv_data_ps8xxx##inst, \ + &drv_cfg_ps8xxx##inst, POST_KERNEL, &ps8xxx_driver_api); DT_INST_FOREACH_STATUS_OKAY(PS8XXX_DRIVER_INIT) diff --git a/drivers/usb_c/tcpc/ucpd_numaker.c b/drivers/usb_c/tcpc/ucpd_numaker.c index c628b8604df1c..b1c3e5cb9a54c 100644 --- a/drivers/usb_c/tcpc/ucpd_numaker.c +++ b/drivers/usb_c/tcpc/ucpd_numaker.c @@ -2547,8 +2547,8 @@ static const struct tcpc_driver_api numaker_tcpc_driver_api = { \ static struct numaker_tcpc_data numaker_tcpc_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, numaker_tcpc_init_startup, NULL, &numaker_tcpc_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, numaker_tcpc_init_startup, NULL, &numaker_tcpc_data_##inst,\ &numaker_tcpc_config_##inst, POST_KERNEL, \ - CONFIG_USBC_TCPC_INIT_PRIORITY, &numaker_tcpc_driver_api); + &numaker_tcpc_driver_api); DT_INST_FOREACH_STATUS_OKAY(NUMAKER_TCPC_INIT); diff --git a/drivers/usb_c/tcpc/ucpd_stm32.c b/drivers/usb_c/tcpc/ucpd_stm32.c index 2fca84346fc5a..dccd0e95096dc 100644 --- a/drivers/usb_c/tcpc/ucpd_stm32.c +++ b/drivers/usb_c/tcpc/ucpd_stm32.c @@ -1473,13 +1473,12 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) > 0, .ucpd_params.HbitClockDiv = DT_INST_PROP(inst, hbitclkdiv) - 1, \ .ucpd_dead_battery = DT_INST_PROP(inst, dead_battery), \ }; \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &ucpd_init, \ NULL, \ &drv_data_##inst, \ &drv_config_##inst, \ POST_KERNEL, \ - CONFIG_USBC_TCPC_INIT_PRIORITY, \ &driver_api); DT_INST_FOREACH_STATUS_OKAY(TCPC_DRIVER_INIT) diff --git a/drivers/usb_c/vbus/usbc_vbus_adc.c b/drivers/usb_c/vbus/usbc_vbus_adc.c index 1b2d576a3ed96..d1cfdfa3658e7 100644 --- a/drivers/usb_c/vbus/usbc_vbus_adc.c +++ b/drivers/usb_c/vbus/usbc_vbus_adc.c @@ -210,13 +210,12 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) > 0, .discharge_gpios = GPIO_DT_SPEC_INST_GET_OR(inst, discharge_gpios, {}), \ .power_gpios = GPIO_DT_SPEC_INST_GET_OR(inst, power_gpios, {}), \ }; \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &adc_vbus_init, \ NULL, \ &drv_data_##inst, \ &drv_config_##inst, \ POST_KERNEL, \ - CONFIG_USBC_VBUS_INIT_PRIORITY, \ &driver_api); DT_INST_FOREACH_STATUS_OKAY(DRIVER_INIT) diff --git a/drivers/usb_c/vbus/usbc_vbus_numaker.c b/drivers/usb_c/vbus/usbc_vbus_numaker.c index f8e7d15c6c5bb..bb9c819cf9fdf 100644 --- a/drivers/usb_c/vbus/usbc_vbus_numaker.c +++ b/drivers/usb_c/vbus/usbc_vbus_numaker.c @@ -124,8 +124,7 @@ static const struct usbc_vbus_driver_api numaker_vbus_driver_api = { .tcpc_dev = DEVICE_DT_GET(NUMAKER_TCPC(inst)), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, numaker_vbus_init, NULL, NULL, &numaker_vbus_config_##inst, \ - POST_KERNEL, CONFIG_USBC_VBUS_INIT_PRIORITY, \ - &numaker_vbus_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, numaker_vbus_init, NULL, NULL, &numaker_vbus_config_##inst,\ + POST_KERNEL, &numaker_vbus_driver_api); DT_INST_FOREACH_STATUS_OKAY(VBUS_NUMAKER_INIT); diff --git a/drivers/usb_c/vbus/usbc_vbus_tcpci.c b/drivers/usb_c/vbus/usbc_vbus_tcpci.c index a4691efae4669..09e547c5d4099 100644 --- a/drivers/usb_c/vbus/usbc_vbus_tcpci.c +++ b/drivers/usb_c/vbus/usbc_vbus_tcpci.c @@ -101,7 +101,7 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) > 0, #define DRIVER_INIT(inst) \ static const struct vbus_tcpci_cfg drv_config_##inst = \ VBUS_TCPCI_INIT_CFG(DT_DRV_INST(inst)); \ - DEVICE_DT_INST_DEFINE(inst, &tcpci_init, NULL, NULL, &drv_config_##inst, POST_KERNEL, \ - CONFIG_USBC_VBUS_INIT_PRIORITY, &vbus_tcpci_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, &tcpci_init, NULL, NULL, &drv_config_##inst, POST_KERNEL,\ + &vbus_tcpci_api); DT_INST_FOREACH_STATUS_OKAY(DRIVER_INIT) diff --git a/drivers/video/gc2145.c b/drivers/video/gc2145.c index e68db0346bd00..d5afdb2efc9c5 100644 --- a/drivers/video/gc2145.c +++ b/drivers/video/gc2145.c @@ -1191,5 +1191,5 @@ static int gc2145_init_0(const struct device *dev) return gc2145_init(dev); } -DEVICE_DT_INST_DEFINE(0, &gc2145_init_0, NULL, &gc2145_data_0, &gc2145_cfg_0, POST_KERNEL, - CONFIG_VIDEO_INIT_PRIORITY, &gc2145_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &gc2145_init_0, NULL, &gc2145_data_0, &gc2145_cfg_0, POST_KERNEL, + &gc2145_driver_api); diff --git a/drivers/video/mt9m114.c b/drivers/video/mt9m114.c index 96f6673a96a94..535517a75e94f 100644 --- a/drivers/video/mt9m114.c +++ b/drivers/video/mt9m114.c @@ -537,6 +537,6 @@ static int mt9m114_init_0(const struct device *dev) return mt9m114_init(dev); } -DEVICE_DT_INST_DEFINE(0, &mt9m114_init_0, NULL, &mt9m114_data_0, &mt9m114_cfg_0, POST_KERNEL, - CONFIG_VIDEO_INIT_PRIORITY, &mt9m114_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &mt9m114_init_0, NULL, &mt9m114_data_0, &mt9m114_cfg_0, POST_KERNEL, + &mt9m114_driver_api); #endif diff --git a/drivers/video/ov2640.c b/drivers/video/ov2640.c index 3a8bdb3effdd8..195c7edaf68ec 100644 --- a/drivers/video/ov2640.c +++ b/drivers/video/ov2640.c @@ -1064,7 +1064,6 @@ static int ov2640_init_0(const struct device *dev) return ov2640_init(dev); } -DEVICE_DT_INST_DEFINE(0, &ov2640_init_0, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &ov2640_init_0, NULL, &ov2640_data_0, &ov2640_cfg_0, - POST_KERNEL, CONFIG_VIDEO_INIT_PRIORITY, - &ov2640_driver_api); + POST_KERNEL, &ov2640_driver_api); diff --git a/drivers/video/ov5640.c b/drivers/video/ov5640.c index 7766ae5917c68..98422ca900b24 100644 --- a/drivers/video/ov5640.c +++ b/drivers/video/ov5640.c @@ -1038,7 +1038,7 @@ static int ov5640_init(const struct device *dev) .powerdown_gpio = GPIO_DT_SPEC_INST_GET_OR(n, powerdown_gpios, {0}), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &ov5640_init, NULL, &ov5640_data_##n, &ov5640_cfg_##n, \ - POST_KERNEL, CONFIG_VIDEO_INIT_PRIORITY, &ov5640_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &ov5640_init, NULL, &ov5640_data_##n, &ov5640_cfg_##n, \ + POST_KERNEL, &ov5640_driver_api); DT_INST_FOREACH_STATUS_OKAY(OV5640_INIT) diff --git a/drivers/video/ov7670.c b/drivers/video/ov7670.c index 0369fdf8e1a64..f1b0239245cd7 100644 --- a/drivers/video/ov7670.c +++ b/drivers/video/ov7670.c @@ -571,7 +571,7 @@ static const struct video_driver_api ov7670_api = { OV7670_PWDN_GPIO(inst)}; \ struct ov7670_data ov7670_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, ov7670_init, NULL, &ov7670_data_##inst, &ov7670_config_##inst, \ - POST_KERNEL, CONFIG_VIDEO_INIT_PRIORITY, &ov7670_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, ov7670_init, NULL, &ov7670_data_##inst, &ov7670_config_##inst,\ + POST_KERNEL, &ov7670_api); DT_INST_FOREACH_STATUS_OKAY(OV7670_INIT) diff --git a/drivers/video/ov7725.c b/drivers/video/ov7725.c index 55f7bde751edf..99456236672be 100644 --- a/drivers/video/ov7725.c +++ b/drivers/video/ov7725.c @@ -641,7 +641,6 @@ static int ov7725_init_0(const struct device *dev) return ov7725_init(dev); } -DEVICE_DT_INST_DEFINE(0, &ov7725_init_0, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, &ov7725_init_0, NULL, &ov7725_data_0, &ov7725_cfg_0, - POST_KERNEL, CONFIG_VIDEO_INIT_PRIORITY, - &ov7725_driver_api); + POST_KERNEL, &ov7725_driver_api); diff --git a/drivers/video/video_esp32_dvp.c b/drivers/video/video_esp32_dvp.c index beba4de320c75..d2e731addf750 100644 --- a/drivers/video/video_esp32_dvp.c +++ b/drivers/video/video_esp32_dvp.c @@ -435,8 +435,8 @@ static const struct video_esp32_config esp32_config = { static struct video_esp32_data esp32_data = {0}; -DEVICE_DT_INST_DEFINE(0, video_esp32_init, NULL, &esp32_data, &esp32_config, POST_KERNEL, - CONFIG_VIDEO_INIT_PRIORITY, &esp32_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, video_esp32_init, NULL, &esp32_data, &esp32_config, POST_KERNEL, + &esp32_driver_api); static int video_esp32_cam_init_master_clock(void) { diff --git a/drivers/video/video_mcux_csi.c b/drivers/video/video_mcux_csi.c index 244dc61ab6a66..9192bff9d7a1b 100644 --- a/drivers/video/video_mcux_csi.c +++ b/drivers/video/video_mcux_csi.c @@ -521,7 +521,6 @@ static int video_mcux_csi_init_0(const struct device *dev) return video_mcux_csi_init(dev); } -DEVICE_DT_INST_DEFINE(0, &video_mcux_csi_init_0, NULL, &video_mcux_csi_data_0, - &video_mcux_csi_config_0, POST_KERNEL, CONFIG_VIDEO_MCUX_CSI_INIT_PRIORITY, - &video_mcux_csi_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, &video_mcux_csi_init_0, NULL, &video_mcux_csi_data_0, + &video_mcux_csi_config_0, POST_KERNEL, &video_mcux_csi_driver_api); #endif diff --git a/drivers/video/video_mcux_mipi_csi2rx.c b/drivers/video/video_mcux_mipi_csi2rx.c index a73c17efa07fe..57cfe7252539e 100644 --- a/drivers/video/video_mcux_mipi_csi2rx.c +++ b/drivers/video/video_mcux_mipi_csi2rx.c @@ -363,8 +363,7 @@ static int mipi_csi2rx_init(const struct device *dev) .sensor_dev = DEVICE_DT_INST_GET_SENSOR_DEV(n), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &mipi_csi2rx_init, NULL, &mipi_csi2rx_data_##n, \ - &mipi_csi2rx_config_##n, POST_KERNEL, CONFIG_VIDEO_INIT_PRIORITY, \ - &mipi_csi2rx_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &mipi_csi2rx_init, NULL, &mipi_csi2rx_data_##n, \ + &mipi_csi2rx_config_##n, POST_KERNEL, &mipi_csi2rx_driver_api); DT_INST_FOREACH_STATUS_OKAY(MIPI_CSI2RX_INIT) diff --git a/drivers/video/video_mcux_smartdma.c b/drivers/video/video_mcux_smartdma.c index 860ce1476b7eb..7404ae9baa35d 100644 --- a/drivers/video/video_mcux_smartdma.c +++ b/drivers/video/video_mcux_smartdma.c @@ -382,10 +382,9 @@ static const struct video_driver_api nxp_video_sdma_api = { .config = &sdma_config_##inst, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, nxp_video_sdma_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, nxp_video_sdma_init, NULL, \ &sdma_data_##inst, &sdma_config_##inst, \ POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &nxp_video_sdma_api); DT_INST_FOREACH_STATUS_OKAY(NXP_VIDEO_SDMA_INIT) diff --git a/drivers/video/video_stm32_dcmi.c b/drivers/video/video_stm32_dcmi.c index 2af5dc14b5a9c..a8257b2775e92 100644 --- a/drivers/video/video_stm32_dcmi.c +++ b/drivers/video/video_stm32_dcmi.c @@ -515,8 +515,7 @@ static int video_stm32_dcmi_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, &video_stm32_dcmi_init, +DEVICE_INSTANCE_FROM_DT_INST(0, &video_stm32_dcmi_init, NULL, &video_stm32_dcmi_data_0, &video_stm32_dcmi_config_0, - POST_KERNEL, CONFIG_VIDEO_INIT_PRIORITY, - &video_stm32_dcmi_driver_api); + POST_KERNEL, &video_stm32_dcmi_driver_api); diff --git a/drivers/video/video_sw_generator.c b/drivers/video/video_sw_generator.c index 845834d5a844c..98e27180a875e 100644 --- a/drivers/video/video_sw_generator.c +++ b/drivers/video/video_sw_generator.c @@ -375,6 +375,5 @@ static int video_sw_generator_init(const struct device *dev) return 0; } -DEVICE_DEFINE(video_sw_generator, "VIDEO_SW_GENERATOR", &video_sw_generator_init, NULL, - &video_sw_generator_data_0, NULL, POST_KERNEL, CONFIG_VIDEO_INIT_PRIORITY, - &video_sw_generator_driver_api); +DEVICE_INSTANCE(video_sw_generator, &video_sw_generator_init, NULL, + &video_sw_generator_data_0, NULL, POST_KERNEL, &video_sw_generator_driver_api); diff --git a/drivers/virtualization/virt_ivshmem.c b/drivers/virtualization/virt_ivshmem.c index bce1dd4c42885..e8442afd49545 100644 --- a/drivers/virtualization/virt_ivshmem.c +++ b/drivers/virtualization/virt_ivshmem.c @@ -586,10 +586,9 @@ static int ivshmem_init(const struct device *dev) { FOR_EACH_FIXED_ARG(IVSHMEM_INTX_INFO, (,), n, 0, 1, 2, 3) } \ }; \ )); \ - DEVICE_DT_INST_DEFINE(n, &ivshmem_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &ivshmem_init, NULL, \ &ivshmem_data_##n, \ COND_CODE_1(CONFIG_IVSHMEM_V2, (&ivshmem_cfg_##n), (NULL)), \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &ivshmem_api); + POST_KERNEL, &ivshmem_api); DT_INST_FOREACH_STATUS_OKAY(IVSHMEM_DEVICE_INIT) diff --git a/drivers/w1/w1_ds2482-800.c b/drivers/w1/w1_ds2482-800.c index 0ac7f92ffb3c9..b74e3e0859625 100644 --- a/drivers/w1/w1_ds2482-800.c +++ b/drivers/w1/w1_ds2482-800.c @@ -57,8 +57,8 @@ static int ds2482_init(const struct device *dev) .i2c_spec = I2C_DT_SPEC_INST_GET(inst), \ }; \ static struct ds2482_data inst_##inst##_data; \ - DEVICE_DT_INST_DEFINE(inst, ds2482_init, NULL, &inst_##inst##_data, &inst_##inst##_config, \ - POST_KERNEL, CONFIG_W1_INIT_PRIORITY, NULL); + DEVICE_INSTANCE_FROM_DT_INST(inst, ds2482_init, NULL, &inst_##inst##_data, &inst_##inst##_config,\ + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(DS2482_INIT) diff --git a/drivers/w1/w1_ds2482-800_channel.c b/drivers/w1/w1_ds2482-800_channel.c index 19363232116d8..3d4d76c8ad438 100644 --- a/drivers/w1/w1_ds2482-800_channel.c +++ b/drivers/w1/w1_ds2482-800_channel.c @@ -169,8 +169,8 @@ static const struct w1_driver_api ds2482_driver_api = { .reg_config = DT_INST_PROP(inst, active_pullup) << DEVICE_APU_pos, \ }; \ static struct ds2482_data inst_##inst##_data = {0}; \ - DEVICE_DT_INST_DEFINE(inst, ds2482_init, NULL, &inst_##inst##_data, &inst_##inst##_config, \ - POST_KERNEL, CONFIG_W1_INIT_PRIORITY, &ds2482_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, ds2482_init, NULL, &inst_##inst##_data, &inst_##inst##_config,\ + POST_KERNEL, &ds2482_driver_api); DT_INST_FOREACH_STATUS_OKAY(DS2482_CHANNEL_INIT) diff --git a/drivers/w1/w1_ds2484.c b/drivers/w1/w1_ds2484.c index 81d0dd1bbc466..e97b274802481 100644 --- a/drivers/w1/w1_ds2484.c +++ b/drivers/w1/w1_ds2484.c @@ -167,9 +167,8 @@ static const struct w1_driver_api ds2484_driver_api = { }; \ static struct ds2484_data inst_##inst##_data; \ PM_DEVICE_DT_INST_DEFINE(inst, ds2484_pm_control); \ - DEVICE_DT_INST_DEFINE(inst, ds2484_init, PM_DEVICE_DT_INST_GET(inst), &inst_##inst##_data, \ - &inst_##inst##_config, POST_KERNEL, CONFIG_W1_INIT_PRIORITY, \ - &ds2484_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, ds2484_init, PM_DEVICE_DT_INST_GET(inst), &inst_##inst##_data,\ + &inst_##inst##_config, POST_KERNEL, &ds2484_driver_api); DT_INST_FOREACH_STATUS_OKAY(DS2484_INIT) diff --git a/drivers/w1/w1_ds2485.c b/drivers/w1/w1_ds2485.c index dacfddae8befe..4ccf357883bf7 100644 --- a/drivers/w1/w1_ds2485.c +++ b/drivers/w1/w1_ds2485.c @@ -107,9 +107,9 @@ static const struct w1_driver_api w1_ds2485_driver_api = { ds2485_w1_script_cmd); \ \ static struct w1_ds2477_85_data w1_ds2477_85_data_##inst = {}; \ - DEVICE_DT_INST_DEFINE(inst, &w1_ds2485_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &w1_ds2485_init, NULL, \ &w1_ds2477_85_data_##inst, \ &w1_ds2477_85_cfg_##inst, POST_KERNEL, \ - CONFIG_W1_INIT_PRIORITY, &w1_ds2485_driver_api); + &w1_ds2485_driver_api); DT_INST_FOREACH_STATUS_OKAY(W1_DS2485_INIT) diff --git a/drivers/w1/w1_max32.c b/drivers/w1/w1_max32.c index 99651cc039362..99a755933c344 100644 --- a/drivers/w1/w1_max32.c +++ b/drivers/w1/w1_max32.c @@ -200,8 +200,7 @@ static const struct w1_driver_api w1_max32_driver_api = { .long_line_mode = DT_INST_PROP(_num, long_line_mode), \ }; \ static struct max32_w1_data max32_owm_data##_num; \ - DEVICE_DT_INST_DEFINE(_num, w1_max32_init, NULL, &max32_owm_data##_num, \ - &max32_w1_config_##_num, POST_KERNEL, CONFIG_W1_INIT_PRIORITY, \ - &w1_max32_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(_num, w1_max32_init, NULL, &max32_owm_data##_num, \ + &max32_w1_config_##_num, POST_KERNEL, &w1_max32_driver_api); DT_INST_FOREACH_STATUS_OKAY(MAX32_W1_INIT) diff --git a/drivers/w1/w1_test.c b/drivers/w1/w1_test.c index 82f307a6399ae..7dda2d8842cbd 100644 --- a/drivers/w1/w1_test.c +++ b/drivers/w1/w1_test.c @@ -67,8 +67,8 @@ static const struct w1_vnd_config w1_vnd_cfg_##inst = { \ .master_config.slave_count = W1_INST_SLAVE_COUNT(inst) \ }; \ static struct w1_vnd_data w1_vnd_data_##inst = {}; \ -DEVICE_DT_INST_DEFINE(n, NULL, NULL, &w1_vnd_data_##inst, \ +DEVICE_INSTANCE_FROM_DT_INST(n, NULL, NULL, &w1_vnd_data_##inst, \ &w1_vnd_cfg_##inst, POST_KERNEL, \ - CONFIG_W1_INIT_PRIORITY, &w1_vnd_api); + &w1_vnd_api); DT_INST_FOREACH_STATUS_OKAY(W1_VND_INIT) diff --git a/drivers/w1/w1_zephyr_gpio.c b/drivers/w1/w1_zephyr_gpio.c index ac42b446355f9..44f3edaa15128 100644 --- a/drivers/w1/w1_zephyr_gpio.c +++ b/drivers/w1/w1_zephyr_gpio.c @@ -321,8 +321,7 @@ static const struct w1_driver_api w1_gpio_driver_api = { .master_config.slave_count = W1_INST_SLAVE_COUNT(inst), \ .spec = GPIO_DT_SPEC_INST_GET(inst, gpios)}; \ static struct w1_gpio_data w1_gpio_data_##inst = {}; \ - DEVICE_DT_INST_DEFINE(inst, &w1_gpio_init, NULL, &w1_gpio_data_##inst, \ - &w1_gpio_cfg_##inst, POST_KERNEL, CONFIG_W1_INIT_PRIORITY, \ - &w1_gpio_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(inst, &w1_gpio_init, NULL, &w1_gpio_data_##inst, \ + &w1_gpio_cfg_##inst, POST_KERNEL, &w1_gpio_driver_api); DT_INST_FOREACH_STATUS_OKAY(W1_ZEPHYR_GPIO_INIT) diff --git a/drivers/w1/w1_zephyr_serial.c b/drivers/w1/w1_zephyr_serial.c index 341680805cbe1..9f607b90b07fc 100644 --- a/drivers/w1/w1_zephyr_serial.c +++ b/drivers/w1/w1_zephyr_serial.c @@ -280,8 +280,8 @@ static const struct w1_serial_config w1_serial_cfg_##inst = { \ .master_config.slave_count = W1_INST_SLAVE_COUNT(inst) \ }; \ static struct w1_serial_data w1_serial_data_##inst = {}; \ -DEVICE_DT_INST_DEFINE(inst, &w1_serial_init, NULL, &w1_serial_data_##inst, \ - &w1_serial_cfg_##inst, POST_KERNEL, \ - CONFIG_W1_INIT_PRIORITY, &w1_serial_driver_api); \ +DEVICE_INSTANCE_FROM_DT_INST(inst, &w1_serial_init, NULL, &w1_serial_data_##inst,\ + &w1_serial_cfg_##inst, POST_KERNEL, \ + &w1_serial_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(W1_ZEPHYR_SERIAL_INIT) diff --git a/drivers/watchdog/wdt_ambiq.c b/drivers/watchdog/wdt_ambiq.c index 91929c91e20ff..f1cfbe47ba7cc 100644 --- a/drivers/watchdog/wdt_ambiq.c +++ b/drivers/watchdog/wdt_ambiq.c @@ -187,8 +187,7 @@ static const struct wdt_driver_api wdt_ambiq_driver_api = { .irq_num = DT_INST_IRQN(n), \ .cfg_func = ambiq_wdt_cfg_func_##n}; \ \ - DEVICE_DT_INST_DEFINE(n, wdt_ambiq_init, NULL, &wdt_ambiq_data##n, &wdt_ambiq_config##n, \ - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &wdt_ambiq_driver_api); + DEVICE_INSTANCE_FROM_DT_INST(n, wdt_ambiq_init, NULL, &wdt_ambiq_data##n, &wdt_ambiq_config##n,\ + PRE_KERNEL_1, &wdt_ambiq_driver_api); DT_INST_FOREACH_STATUS_OKAY(AMBIQ_WDT_INIT) diff --git a/drivers/watchdog/wdt_andes_atcwdt200.c b/drivers/watchdog/wdt_andes_atcwdt200.c index b6e28f2fcbaf6..901667f316656 100644 --- a/drivers/watchdog/wdt_andes_atcwdt200.c +++ b/drivers/watchdog/wdt_andes_atcwdt200.c @@ -331,6 +331,6 @@ static const struct wdt_atcwdt200_config wdt_atcwdt200_cfg = { .base = DT_INST_REG_ADDR(0), }; -DEVICE_DT_INST_DEFINE(0, wdt_atcwdt200_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, wdt_atcwdt200_init, NULL, &wdt_atcwdt200_data, &wdt_atcwdt200_cfg, PRE_KERNEL_2, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &wdt_atcwdt200_api); + &wdt_atcwdt200_api); diff --git a/drivers/watchdog/wdt_cc13xx_cc26xx.c b/drivers/watchdog/wdt_cc13xx_cc26xx.c index 630292a728700..eeb7081e52dc2 100644 --- a/drivers/watchdog/wdt_cc13xx_cc26xx.c +++ b/drivers/watchdog/wdt_cc13xx_cc26xx.c @@ -242,11 +242,10 @@ static const struct wdt_driver_api wdt_cc13xx_cc26xx_api = { .irq_nmi = DT_INST_PROP(index, interrupt_nmi), \ .irq_cfg_func = wdt_cc13xx_cc26xx_irq_cfg_##index, \ }; \ - DEVICE_DT_INST_DEFINE(index, \ + DEVICE_INSTANCE_FROM_DT_INST(index, \ wdt_cc13xx_cc26xx_init, NULL, \ &wdt_cc13xx_cc26xx_data_##index, \ &wdt_cc13xx_cc26xx_cfg_##index, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ - &wdt_cc13xx_cc26xx_api); + POST_KERNEL, &wdt_cc13xx_cc26xx_api); DT_INST_FOREACH_STATUS_OKAY(CC13XX_CC26XX_WDT_INIT) diff --git a/drivers/watchdog/wdt_cc32xx.c b/drivers/watchdog/wdt_cc32xx.c index b26e5cac84e2b..565db4969e7ab 100644 --- a/drivers/watchdog/wdt_cc32xx.c +++ b/drivers/watchdog/wdt_cc32xx.c @@ -189,10 +189,9 @@ static const struct wdt_driver_api wdt_cc32xx_api = { .irq_cfg_func = wdt_cc32xx_irq_cfg_##index, \ }; \ \ - DEVICE_DT_INST_DEFINE(index, \ + DEVICE_INSTANCE_FROM_DT_INST(index, \ &wdt_cc32xx_init, NULL, \ &wdt_cc32xx_data_##index, &wdt_cc32xx_cfg_##index, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ - &wdt_cc32xx_api); + POST_KERNEL, &wdt_cc32xx_api); DT_INST_FOREACH_STATUS_OKAY(cc32xx_WDT_INIT) diff --git a/drivers/watchdog/wdt_cmsdk_apb.c b/drivers/watchdog/wdt_cmsdk_apb.c index 12132d0dbfdbf..2632c9b3e2a0b 100644 --- a/drivers/watchdog/wdt_cmsdk_apb.c +++ b/drivers/watchdog/wdt_cmsdk_apb.c @@ -210,9 +210,8 @@ static int wdog_cmsdk_apb_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, wdog_cmsdk_apb_init, NULL, NULL, NULL, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &wdog_cmsdk_apb_api); + PRE_KERNEL_1, &wdog_cmsdk_apb_api); diff --git a/drivers/watchdog/wdt_counter.c b/drivers/watchdog/wdt_counter.c index a58fd777f4e14..e00024b7fb27b 100644 --- a/drivers/watchdog/wdt_counter.c +++ b/drivers/watchdog/wdt_counter.c @@ -172,8 +172,7 @@ static int wdt_counter_init(const struct device *dev) return 0; } -DEVICE_DT_DEFINE(DT_WDT_COUNTER, wdt_counter_init, NULL, +DEVICE_INSTANCE(DT_WDT_COUNTER, wdt_counter_init, NULL, &wdt_data, &wdt_counter_config, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &wdt_counter_driver_api); diff --git a/drivers/watchdog/wdt_dw.c b/drivers/watchdog/wdt_dw.c index d65b5e315c907..7a435ba659f21 100644 --- a/drivers/watchdog/wdt_dw.c +++ b/drivers/watchdog/wdt_dw.c @@ -276,8 +276,8 @@ static void dw_wdt_isr(const struct device *dev) (.clk_freq = DT_INST_PROP_BY_PHANDLE(inst, clocks, clock_frequency))))), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &dw_wdt_init, NULL, &wdt_dw##inst##_data, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &dw_wdt_init, NULL, &wdt_dw##inst##_data, \ &wdt_dw##inst##_config, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &dw_wdt_api); + &dw_wdt_api); DT_INST_FOREACH_STATUS_OKAY(DW_WDT_INIT) diff --git a/drivers/watchdog/wdt_ene_kb1200.c b/drivers/watchdog/wdt_ene_kb1200.c index 26a20c00968ce..55a42346560bb 100644 --- a/drivers/watchdog/wdt_ene_kb1200.c +++ b/drivers/watchdog/wdt_ene_kb1200.c @@ -169,5 +169,5 @@ static const struct wdt_kb1200_config wdt_kb1200_config = { static struct wdt_kb1200_data wdt_kb1200_dev_data; -DEVICE_DT_INST_DEFINE(0, wdt_kb1200_init, NULL, &wdt_kb1200_dev_data, &wdt_kb1200_config, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &wdt_kb1200_api); +DEVICE_INSTANCE_FROM_DT_INST(0, wdt_kb1200_init, NULL, &wdt_kb1200_dev_data, &wdt_kb1200_config, + PRE_KERNEL_1, &wdt_kb1200_api); diff --git a/drivers/watchdog/wdt_esp32.c b/drivers/watchdog/wdt_esp32.c index fff42d651e63b..62a5aa291f050 100644 --- a/drivers/watchdog/wdt_esp32.c +++ b/drivers/watchdog/wdt_esp32.c @@ -204,13 +204,12 @@ static const struct wdt_driver_api wdt_api = { .clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(idx, offset), \ }; \ \ - DEVICE_DT_INST_DEFINE(idx, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, \ wdt_esp32_init, \ NULL, \ &wdt##idx##_data, \ &wdt_esp32_config##idx, \ - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &wdt_api) + PRE_KERNEL_1, &wdt_api) static void wdt_esp32_isr(void *arg) { diff --git a/drivers/watchdog/wdt_fwdgt_gd32.c b/drivers/watchdog/wdt_fwdgt_gd32.c index 2dec616b0ce28..c4497113f2113 100644 --- a/drivers/watchdog/wdt_fwdgt_gd32.c +++ b/drivers/watchdog/wdt_fwdgt_gd32.c @@ -173,5 +173,5 @@ static int gd32_fwdgt_init(const struct device *dev) return ret; } -DEVICE_DT_INST_DEFINE(0, gd32_fwdgt_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &fwdgt_gd32_api); +DEVICE_INSTANCE_FROM_DT_INST(0, gd32_fwdgt_init, NULL, NULL, NULL, POST_KERNEL, + &fwdgt_gd32_api); diff --git a/drivers/watchdog/wdt_gecko.c b/drivers/watchdog/wdt_gecko.c index ef124e41ecbbd..cf117204a5df2 100644 --- a/drivers/watchdog/wdt_gecko.c +++ b/drivers/watchdog/wdt_gecko.c @@ -290,11 +290,10 @@ static const struct wdt_driver_api wdt_gecko_driver_api = { }; \ static struct wdt_gecko_data wdt_gecko_data_##index; \ \ - DEVICE_DT_INST_DEFINE(index, \ + DEVICE_INSTANCE_FROM_DT_INST(index, \ &wdt_gecko_init, NULL, \ &wdt_gecko_data_##index, \ &wdt_gecko_cfg_##index, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ &wdt_gecko_driver_api); \ \ static void wdt_gecko_cfg_func_##index(void) \ diff --git a/drivers/watchdog/wdt_ifx_cat1.c b/drivers/watchdog/wdt_ifx_cat1.c index 7c68ee9a2971f..ab7307ca67496 100644 --- a/drivers/watchdog/wdt_ifx_cat1.c +++ b/drivers/watchdog/wdt_ifx_cat1.c @@ -139,5 +139,5 @@ static const struct wdt_driver_api ifx_cat1_wdt_api = { .feed = ifx_cat1_wdt_feed, }; -DEVICE_DT_INST_DEFINE(0, ifx_cat1_wdt_init, NULL, &wdt_data, NULL, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &ifx_cat1_wdt_api); +DEVICE_INSTANCE_FROM_DT_INST(0, ifx_cat1_wdt_init, NULL, &wdt_data, NULL, POST_KERNEL, + &ifx_cat1_wdt_api); diff --git a/drivers/watchdog/wdt_intel_adsp.c b/drivers/watchdog/wdt_intel_adsp.c index 9a30ea4f45bdf..7d0a216c085a6 100644 --- a/drivers/watchdog/wdt_intel_adsp.c +++ b/drivers/watchdog/wdt_intel_adsp.c @@ -237,5 +237,5 @@ static const struct intel_adsp_wdt_dev_cfg wdt_intel_adsp_config = { static struct intel_adsp_wdt_dev_data wdt_intel_adsp_data; -DEVICE_DT_DEFINE(DEV_NODE, &intel_adsp_wdt_init, NULL, &wdt_intel_adsp_data, &wdt_intel_adsp_config, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &intel_adsp_wdt_api); +DEVICE_INSTANCE(DEV_NODE, &intel_adsp_wdt_init, NULL, &wdt_intel_adsp_data, &wdt_intel_adsp_config, + POST_KERNEL, &intel_adsp_wdt_api); diff --git a/drivers/watchdog/wdt_ite_it8xxx2.c b/drivers/watchdog/wdt_ite_it8xxx2.c index b3362d2f3f8ef..4b3fb746e5cb0 100644 --- a/drivers/watchdog/wdt_ite_it8xxx2.c +++ b/drivers/watchdog/wdt_ite_it8xxx2.c @@ -279,7 +279,6 @@ static const struct wdt_it8xxx2_config wdt_it8xxx2_cfg_0 = { static struct wdt_it8xxx2_data wdt_it8xxx2_dev_data; -DEVICE_DT_INST_DEFINE(0, wdt_it8xxx2_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, wdt_it8xxx2_init, NULL, &wdt_it8xxx2_dev_data, &wdt_it8xxx2_cfg_0, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &wdt_it8xxx2_api); + PRE_KERNEL_1, &wdt_it8xxx2_api); diff --git a/drivers/watchdog/wdt_iwdg_stm32.c b/drivers/watchdog/wdt_iwdg_stm32.c index 6c6846abf61fa..0a8d40a691ff4 100644 --- a/drivers/watchdog/wdt_iwdg_stm32.c +++ b/drivers/watchdog/wdt_iwdg_stm32.c @@ -214,7 +214,6 @@ static struct iwdg_stm32_data iwdg_stm32_dev_data = { .Instance = (IWDG_TypeDef *)DT_INST_REG_ADDR(0) }; -DEVICE_DT_INST_DEFINE(0, iwdg_stm32_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, iwdg_stm32_init, NULL, &iwdg_stm32_dev_data, NULL, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &iwdg_stm32_api); + POST_KERNEL, &iwdg_stm32_api); diff --git a/drivers/watchdog/wdt_litex.c b/drivers/watchdog/wdt_litex.c index 469c13aef8d7b..bff94e5b919a2 100644 --- a/drivers/watchdog/wdt_litex.c +++ b/drivers/watchdog/wdt_litex.c @@ -225,8 +225,8 @@ static const struct wdt_driver_api wdt_api = { .irq_cfg_func = wdt_litex_cfg_func_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, wdt_litex_init, NULL, &wdt_litex_data##n, &wdt_litex_config##n, \ - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &wdt_api) \ + DEVICE_INSTANCE_FROM_DT_INST(n, wdt_litex_init, NULL, &wdt_litex_data##n, &wdt_litex_config##n,\ + PRE_KERNEL_1, &wdt_api, \ \ static void wdt_litex_cfg_func_##n(void) \ { \ diff --git a/drivers/watchdog/wdt_max32.c b/drivers/watchdog/wdt_max32.c index 9451ecc665c2f..c18d0c96b306c 100644 --- a/drivers/watchdog/wdt_max32.c +++ b/drivers/watchdog/wdt_max32.c @@ -264,8 +264,8 @@ static const struct wdt_driver_api max32_wdt_api = {.setup = wdt_max32_setup, .perclk.bit = DT_INST_CLOCKS_CELL(_num, bit), \ .irq_func = &wdt_max32_irq_init_##_num, \ }; \ - DEVICE_DT_INST_DEFINE(_num, wdt_max32_init, NULL, &max32_wdt_data##_num, \ + DEVICE_INSTANCE_FROM_DT_INST(_num, wdt_max32_init, NULL, &max32_wdt_data##_num, \ &max32_wdt_config##_num, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &max32_wdt_api); + &max32_wdt_api); DT_INST_FOREACH_STATUS_OKAY(MAX32_WDT_INIT) diff --git a/drivers/watchdog/wdt_mchp_xec.c b/drivers/watchdog/wdt_mchp_xec.c index a6da7d29ed5bd..f95542dfcc6ab 100644 --- a/drivers/watchdog/wdt_mchp_xec.c +++ b/drivers/watchdog/wdt_mchp_xec.c @@ -203,7 +203,6 @@ static const struct wdt_xec_config wdt_xec_config_0 = { static struct wdt_xec_data wdt_xec_dev_data; -DEVICE_DT_INST_DEFINE(0, wdt_xec_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, wdt_xec_init, NULL, &wdt_xec_dev_data, &wdt_xec_config_0, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &wdt_xec_api); + PRE_KERNEL_1, &wdt_xec_api); diff --git a/drivers/watchdog/wdt_mcux_imx_wdog.c b/drivers/watchdog/wdt_mcux_imx_wdog.c index dc1bc38fe9b45..1fae138bbff62 100644 --- a/drivers/watchdog/wdt_mcux_imx_wdog.c +++ b/drivers/watchdog/wdt_mcux_imx_wdog.c @@ -168,12 +168,11 @@ static const struct mcux_wdog_config mcux_wdog_config = { static struct mcux_wdog_data mcux_wdog_data; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, &mcux_wdog_init, NULL, &mcux_wdog_data, &mcux_wdog_config, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &mcux_wdog_api); + POST_KERNEL, &mcux_wdog_api); static void mcux_wdog_config_func(const struct device *dev) { diff --git a/drivers/watchdog/wdt_mcux_wdog.c b/drivers/watchdog/wdt_mcux_wdog.c index 35d143b5c4d4b..7e5d83756e163 100644 --- a/drivers/watchdog/wdt_mcux_wdog.c +++ b/drivers/watchdog/wdt_mcux_wdog.c @@ -175,12 +175,11 @@ static const struct mcux_wdog_config mcux_wdog_config_0 = { static struct mcux_wdog_data mcux_wdog_data_0; -DEVICE_DT_INST_DEFINE(0, +DEVICE_INSTANCE_FROM_DT_INST(0, &mcux_wdog_init, NULL, &mcux_wdog_data_0, &mcux_wdog_config_0, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &mcux_wdog_api); + POST_KERNEL, &mcux_wdog_api); static void mcux_wdog_config_func_0(const struct device *dev) { diff --git a/drivers/watchdog/wdt_mcux_wdog32.c b/drivers/watchdog/wdt_mcux_wdog32.c index b34dabc547e31..f7e5b61f89899 100644 --- a/drivers/watchdog/wdt_mcux_wdog32.c +++ b/drivers/watchdog/wdt_mcux_wdog32.c @@ -208,10 +208,9 @@ static const struct mcux_wdog32_config mcux_wdog32_config_0 = { static struct mcux_wdog32_data mcux_wdog32_data_0; -DEVICE_DT_INST_DEFINE(0, &mcux_wdog32_init, +DEVICE_INSTANCE_FROM_DT_INST(0, &mcux_wdog32_init, NULL, &mcux_wdog32_data_0, &mcux_wdog32_config_0, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &mcux_wdog32_api); static void mcux_wdog32_config_func_0(const struct device *dev) diff --git a/drivers/watchdog/wdt_mcux_wwdt.c b/drivers/watchdog/wdt_mcux_wwdt.c index cfaf98de5b342..a2cc3ed20bbf3 100644 --- a/drivers/watchdog/wdt_mcux_wwdt.c +++ b/drivers/watchdog/wdt_mcux_wwdt.c @@ -191,10 +191,9 @@ static const struct mcux_wwdt_config mcux_wwdt_config_0 = { static struct mcux_wwdt_data mcux_wwdt_data_0; -DEVICE_DT_INST_DEFINE(0, &mcux_wwdt_init, +DEVICE_INSTANCE_FROM_DT_INST(0, &mcux_wwdt_init, NULL, &mcux_wwdt_data_0, &mcux_wwdt_config_0, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &mcux_wwdt_api); static void mcux_wwdt_config_func_0(const struct device *dev) diff --git a/drivers/watchdog/wdt_npcx.c b/drivers/watchdog/wdt_npcx.c index 31aadd86345a1..b5b37e0112b4a 100644 --- a/drivers/watchdog/wdt_npcx.c +++ b/drivers/watchdog/wdt_npcx.c @@ -376,8 +376,7 @@ static const struct wdt_npcx_config wdt_npcx_cfg_0 = { static struct wdt_npcx_data wdt_npcx_data_0; -DEVICE_DT_INST_DEFINE(0, wdt_npcx_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, wdt_npcx_init, NULL, &wdt_npcx_data_0, &wdt_npcx_cfg_0, PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &wdt_npcx_driver_api); diff --git a/drivers/watchdog/wdt_npm1300.c b/drivers/watchdog/wdt_npm1300.c index 418d1a87d4bca..b15b0b76ca906 100644 --- a/drivers/watchdog/wdt_npm1300.c +++ b/drivers/watchdog/wdt_npm1300.c @@ -162,7 +162,7 @@ static int wdt_npm1300_init(const struct device *dev) .reset_gpios = GPIO_DT_SPEC_INST_GET_OR(n, reset_gpios, {0}), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &wdt_npm1300_init, NULL, &data##n, &config##n, POST_KERNEL, \ - CONFIG_WDT_NPM1300_INIT_PRIORITY, &wdt_npm1300_api); + DEVICE_INSTANCE_FROM_DT_INST(n, &wdt_npm1300_init, NULL, &data##n, &config##n, POST_KERNEL,\ + &wdt_npm1300_api); DT_INST_FOREACH_STATUS_OKAY(WDT_NPM1300_DEFINE) diff --git a/drivers/watchdog/wdt_npm6001.c b/drivers/watchdog/wdt_npm6001.c index 0ec17703e30e2..587a7a398dd54 100644 --- a/drivers/watchdog/wdt_npm6001.c +++ b/drivers/watchdog/wdt_npm6001.c @@ -180,9 +180,8 @@ static int wdt_npm6001_init(const struct device *dev) .bus = I2C_DT_SPEC_GET(DT_INST_PARENT(n)), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, &wdt_npm6001_init, NULL, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, &wdt_npm6001_init, NULL, NULL, \ &wdt_npm6001_config##n, POST_KERNEL, \ - CONFIG_WDT_NPM6001_INIT_PRIORITY, \ &wdt_npm6001_api); DT_INST_FOREACH_STATUS_OKAY(WDT_NPM6001_DEFINE) diff --git a/drivers/watchdog/wdt_nrfx.c b/drivers/watchdog/wdt_nrfx.c index 277d195f681bc..fdce6f19858aa 100644 --- a/drivers/watchdog/wdt_nrfx.c +++ b/drivers/watchdog/wdt_nrfx.c @@ -221,13 +221,12 @@ static void wdt_event_handler(const struct device *dev, nrf_wdt_event_t event_ty static const struct wdt_nrfx_config wdt_##idx##z_config = { \ .wdt = NRFX_WDT_INSTANCE(idx), \ }; \ - DEVICE_DT_DEFINE(WDT(idx), \ - wdt_##idx##_init, \ - NULL, \ - &wdt_##idx##_data, \ - &wdt_##idx##z_config, \ - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &wdt_nrfx_driver_api) + DEVICE_INSTANCE(WDT(idx), \ + wdt_##idx##_init, \ + NULL, \ + &wdt_##idx##_data, \ + &wdt_##idx##z_config, \ + PRE_KERNEL_1, &wdt_nrfx_driver_api) #ifdef CONFIG_HAS_HW_NRF_WDT0 WDT_NRFX_WDT_DEVICE(0); diff --git a/drivers/watchdog/wdt_nxp_fs26.c b/drivers/watchdog/wdt_nxp_fs26.c index f6aed5079e4ec..1a7a0cb5a0c9b 100644 --- a/drivers/watchdog/wdt_nxp_fs26.c +++ b/drivers/watchdog/wdt_nxp_fs26.c @@ -830,13 +830,12 @@ static const struct wdt_driver_api wdt_nxp_fs26_api = { .int_gpio = GPIO_DT_SPEC_INST_GET(n, int_gpios), \ }; \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ wdt_nxp_fs26_init, \ NULL, \ &wdt_nxp_fs26_data_##n, \ &wdt_nxp_fs26_config_##n, \ POST_KERNEL, \ - CONFIG_WDT_NXP_FS26_INIT_PRIORITY, \ &wdt_nxp_fs26_api); DT_INST_FOREACH_STATUS_OKAY(FS26_WDT_DEVICE_INIT) diff --git a/drivers/watchdog/wdt_nxp_s32.c b/drivers/watchdog/wdt_nxp_s32.c index fafc030e6dcd7..7d9c4b46e8eb8 100644 --- a/drivers/watchdog/wdt_nxp_s32.c +++ b/drivers/watchdog/wdt_nxp_s32.c @@ -402,13 +402,12 @@ static const struct wdt_driver_api swt_nxp_s32_driver_api = { return 0; \ } \ \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ swt_nxp_s32_##n##_init, \ NULL, \ &swt_nxp_s32_data_##n, \ &swt_nxp_s32_config_##n, \ POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &swt_nxp_s32_driver_api); DT_INST_FOREACH_STATUS_OKAY(SWT_NXP_S32_DEVICE_INIT) diff --git a/drivers/watchdog/wdt_opentitan.c b/drivers/watchdog/wdt_opentitan.c index 7f6fde21e41f7..40a5aa5ca7267 100644 --- a/drivers/watchdog/wdt_opentitan.c +++ b/drivers/watchdog/wdt_opentitan.c @@ -212,7 +212,6 @@ static const struct wdt_driver_api ot_aontimer_api = { .feed = ot_aontimer_feed, }; -DEVICE_DT_INST_DEFINE(0, ot_aontimer_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, ot_aontimer_init, NULL, &ot_aontimer_data, &ot_aontimer_cfg, PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &ot_aontimer_api); diff --git a/drivers/watchdog/wdt_rpi_pico.c b/drivers/watchdog/wdt_rpi_pico.c index 7d3f2a5fc6078..27051fe00c990 100644 --- a/drivers/watchdog/wdt_rpi_pico.c +++ b/drivers/watchdog/wdt_rpi_pico.c @@ -180,8 +180,7 @@ static const struct wdt_driver_api wdt_rpi_pico_driver_api = { RPI_PICO_WDT_TIME_MULTIPLICATION_FACTOR), \ .enabled = false \ }; \ - DEVICE_DT_DEFINE(DT_NODELABEL(wdt##idx), wdt_rpi_pico_init, NULL, &wdt_##idx##_data, \ - &wdt_##idx##_config, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &wdt_rpi_pico_driver_api) + DEVICE_INSTANCE(DT_NODELABEL(wdt##idx), wdt_rpi_pico_init, NULL, &wdt_##idx##_data, \ + &wdt_##idx##_config, PRE_KERNEL_1, &wdt_rpi_pico_driver_api) DT_INST_FOREACH_STATUS_OKAY(WDT_RPI_PICO_WDT_DEVICE); diff --git a/drivers/watchdog/wdt_sam.c b/drivers/watchdog/wdt_sam.c index 52a251db74904..ac488e6df1cff 100644 --- a/drivers/watchdog/wdt_sam.c +++ b/drivers/watchdog/wdt_sam.c @@ -253,6 +253,6 @@ static int wdt_sam_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, wdt_sam_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, wdt_sam_init, NULL, &wdt_sam_data, &wdt_sam_cfg, PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &wdt_sam_api); + &wdt_sam_api); diff --git a/drivers/watchdog/wdt_sam0.c b/drivers/watchdog/wdt_sam0.c index 12c82d21f71cc..4beaf6680489d 100644 --- a/drivers/watchdog/wdt_sam0.c +++ b/drivers/watchdog/wdt_sam0.c @@ -279,6 +279,6 @@ static int wdt_sam0_init(const struct device *dev) static struct wdt_sam0_dev_data wdt_sam0_data; -DEVICE_DT_INST_DEFINE(0, wdt_sam0_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, wdt_sam0_init, NULL, &wdt_sam0_data, NULL, PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &wdt_sam0_api); + &wdt_sam0_api); diff --git a/drivers/watchdog/wdt_sifive.c b/drivers/watchdog/wdt_sifive.c index ab2560ca15783..60cc57c460c14 100644 --- a/drivers/watchdog/wdt_sifive.c +++ b/drivers/watchdog/wdt_sifive.c @@ -282,6 +282,6 @@ static const struct wdt_sifive_device_config wdt_sifive_cfg = { .regs = DT_INST_REG_ADDR(0), }; -DEVICE_DT_INST_DEFINE(0, wdt_sifive_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, wdt_sifive_init, NULL, &wdt_sifive_data, &wdt_sifive_cfg, PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &wdt_sifive_api); + &wdt_sifive_api); diff --git a/drivers/watchdog/wdt_smartbond.c b/drivers/watchdog/wdt_smartbond.c index 5ae0767124772..6c0b17b5a4e8a 100644 --- a/drivers/watchdog/wdt_smartbond.c +++ b/drivers/watchdog/wdt_smartbond.c @@ -132,5 +132,5 @@ static int wdg_smartbond_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, wdg_smartbond_init, NULL, &wdog_smartbond_dev_data, NULL, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &wdg_smartbond_api); +DEVICE_INSTANCE_FROM_DT_INST(0, wdg_smartbond_init, NULL, &wdog_smartbond_dev_data, NULL, POST_KERNEL, + &wdg_smartbond_api); diff --git a/drivers/watchdog/wdt_tco.c b/drivers/watchdog/wdt_tco.c index 599871bc5f09d..74b95ee6b03e5 100644 --- a/drivers/watchdog/wdt_tco.c +++ b/drivers/watchdog/wdt_tco.c @@ -268,6 +268,5 @@ static const struct tco_config wdt_config = { .base = DT_INST_REG_ADDR(0), }; -DEVICE_DT_INST_DEFINE(0, wdt_init, NULL, &wdt_data, &wdt_config, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &tco_driver_api); +DEVICE_INSTANCE_FROM_DT_INST(0, wdt_init, NULL, &wdt_data, &wdt_config, + POST_KERNEL, &tco_driver_api); diff --git a/drivers/watchdog/wdt_ti_tps382x.c b/drivers/watchdog/wdt_ti_tps382x.c index c9e94310c3f5b..3b7b8e95d5486 100644 --- a/drivers/watchdog/wdt_ti_tps382x.c +++ b/drivers/watchdog/wdt_ti_tps382x.c @@ -87,10 +87,9 @@ static const struct wdt_driver_api ti_tps382x_api = { .timeout = DT_INST_PROP(n, timeout_period), \ }; \ \ - DEVICE_DT_INST_DEFINE( \ + DEVICE_INSTANCE_FROM_DT_INST( \ n, ti_tps382x_init, NULL, NULL, &ti_tps382x_##n##config, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &ti_tps382x_api \ + POST_KERNEL, &ti_tps382x_api \ ); DT_INST_FOREACH_STATUS_OKAY(WDT_TI_TPS382X_INIT); diff --git a/drivers/watchdog/wdt_wwdg_stm32.c b/drivers/watchdog/wdt_wwdg_stm32.c index 0ef9ee12f9ea2..e6a029fab263d 100644 --- a/drivers/watchdog/wdt_wwdg_stm32.c +++ b/drivers/watchdog/wdt_wwdg_stm32.c @@ -305,10 +305,9 @@ static struct wwdg_stm32_config wwdg_stm32_dev_config = { .Instance = (WWDG_TypeDef *)DT_INST_REG_ADDR(0), }; -DEVICE_DT_INST_DEFINE(0, wwdg_stm32_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, wwdg_stm32_init, NULL, &wwdg_stm32_dev_data, &wwdg_stm32_dev_config, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &wwdg_stm32_api); + POST_KERNEL, &wwdg_stm32_api); static void wwdg_stm32_irq_config(const struct device *dev) { diff --git a/drivers/watchdog/wdt_wwdgt_gd32.c b/drivers/watchdog/wdt_wwdgt_gd32.c index 2409af782573f..54b81d7840b51 100644 --- a/drivers/watchdog/wdt_wwdgt_gd32.c +++ b/drivers/watchdog/wdt_wwdgt_gd32.c @@ -221,5 +221,5 @@ static struct gd32_wwdgt_data wwdgt_data = { .callback = NULL }; -DEVICE_DT_INST_DEFINE(0, gd32_wwdgt_init, NULL, &wwdgt_data, &wwdgt_cfg, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &wwdgt_gd32_api); +DEVICE_INSTANCE_FROM_DT_INST(0, gd32_wwdgt_init, NULL, &wwdgt_data, &wwdgt_cfg, POST_KERNEL, + &wwdgt_gd32_api); diff --git a/drivers/watchdog/wdt_wwdt_numaker.c b/drivers/watchdog/wdt_wwdt_numaker.c index 3004635031b78..e57c5c171974c 100644 --- a/drivers/watchdog/wdt_wwdt_numaker.c +++ b/drivers/watchdog/wdt_wwdt_numaker.c @@ -295,7 +295,6 @@ static struct wwdt_numaker_config wwdt_numaker_cfg_inst = { static struct wwdt_numaker_data wwdt_numaker_data_inst; -DEVICE_DT_INST_DEFINE(0, wwdt_numaker_init, NULL, +DEVICE_INSTANCE_FROM_DT_INST(0, wwdt_numaker_init, NULL, &wwdt_numaker_data_inst, &wwdt_numaker_cfg_inst, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &wwdt_numaker_api); + POST_KERNEL, &wwdt_numaker_api); diff --git a/drivers/watchdog/wdt_xilinx_axi.c b/drivers/watchdog/wdt_xilinx_axi.c index f4f6b2e2a14e6..8cb9ddc17a891 100644 --- a/drivers/watchdog/wdt_xilinx_axi.c +++ b/drivers/watchdog/wdt_xilinx_axi.c @@ -280,8 +280,8 @@ static const struct wdt_driver_api wdt_xilinx_api = { .enable_once = DT_INST_PROP(inst, xlnx_wdt_enable_once), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &wdt_xilinx_axi_init, NULL, &wdt_xilinx_axi_##inst##_dev_data, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &wdt_xilinx_axi_init, NULL, &wdt_xilinx_axi_##inst##_dev_data,\ &wdt_xilinx_axi_##inst##_cfg, PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &wdt_xilinx_api); + &wdt_xilinx_api); DT_INST_FOREACH_STATUS_OKAY(WDT_XILINX_AXI_INIT) diff --git a/drivers/watchdog/wdt_xmc4xxx.c b/drivers/watchdog/wdt_xmc4xxx.c index e038bb0d4d59f..f7e0332708cf1 100644 --- a/drivers/watchdog/wdt_xmc4xxx.c +++ b/drivers/watchdog/wdt_xmc4xxx.c @@ -180,5 +180,5 @@ static int wdt_xmc4xxx_init(const struct device *dev) return wdt_xmc4xxx_setup(dev, WDT_OPT_PAUSE_HALTED_BY_DBG); #endif } -DEVICE_DT_INST_DEFINE(0, wdt_xmc4xxx_init, NULL, &wdt_xmc4xxx_data, NULL, PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &wdt_xmc4xxx_api); +DEVICE_INSTANCE_FROM_DT_INST(0, wdt_xmc4xxx_init, NULL, &wdt_xmc4xxx_data, NULL, PRE_KERNEL_1, + &wdt_xmc4xxx_api); diff --git a/drivers/watchdog/xt_wdt_esp32.c b/drivers/watchdog/xt_wdt_esp32.c index 3c76b03ba3575..c91e1451b799c 100644 --- a/drivers/watchdog/xt_wdt_esp32.c +++ b/drivers/watchdog/xt_wdt_esp32.c @@ -164,13 +164,12 @@ static struct esp32_xt_wdt_config esp32_xt_wdt_config0 = { .irq_flags = DT_INST_IRQ_BY_IDX(0, 0, flags) }; -DEVICE_DT_DEFINE(DT_NODELABEL(xt_wdt), +DEVICE_INSTANCE(DT_NODELABEL(xt_wdt), &esp32_xt_wdt_init, NULL, &esp32_xt_wdt_data0, &esp32_xt_wdt_config0, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &esp32_xt_wdt_api); #if !(defined(CONFIG_SOC_SERIES_ESP32S2) || \ diff --git a/drivers/wifi/esp32/src/esp_wifi_drv.c b/drivers/wifi/esp32/src/esp_wifi_drv.c index 56f8b92e51e2b..306175695f7a4 100644 --- a/drivers/wifi/esp32/src/esp_wifi_drv.c +++ b/drivers/wifi/esp32/src/esp_wifi_drv.c @@ -908,17 +908,15 @@ static const struct net_wifi_mgmt_offload esp32_api = { .wifi_mgmt_api = &esp32_wifi_mgmt, }; -NET_DEVICE_DT_INST_DEFINE(0, +NET_DEVICE_INSTANCE_FROM_DT_INST(0, esp32_wifi_dev_init, NULL, - &esp32_data, NULL, CONFIG_WIFI_INIT_PRIORITY, - &esp32_api, ETHERNET_L2, + &esp32_data, NULL, &esp32_api, ETHERNET_L2, NET_L2_GET_CTX_TYPE(ETHERNET_L2), NET_ETH_MTU); #if defined(CONFIG_ESP32_WIFI_AP_STA_MODE) -NET_DEVICE_DT_INST_DEFINE(1, +NET_DEVICE_INSTANCE_FROM_DT_INST(1, NULL, NULL, - &esp32_ap_sta_data, NULL, CONFIG_WIFI_INIT_PRIORITY, - &esp32_api, ETHERNET_L2, + &esp32_ap_sta_data, NULL, &esp32_api, ETHERNET_L2, NET_L2_GET_CTX_TYPE(ETHERNET_L2), NET_ETH_MTU); DEFINE_WIFI_NM_INSTANCE(esp32_wifi_nm, &esp32_wifi_mgmt); diff --git a/drivers/wifi/esp_at/esp.c b/drivers/wifi/esp_at/esp.c index 0dfe0bfb9d439..6c1c2a8bd9aa1 100644 --- a/drivers/wifi/esp_at/esp.c +++ b/drivers/wifi/esp_at/esp.c @@ -1538,9 +1538,9 @@ static int esp_init(const struct device *dev); * for the struct net_if that the macro declares to be visible inside the * function. An `extern` declaration does not work as the struct is static. */ -NET_DEVICE_DT_INST_OFFLOAD_DEFINE(0, esp_init, NULL, +NET_DEVICE_OFFLOAD_INSTANCE_FROM_DT_INST(0, esp_init, NULL, &esp_driver_data, &esp_driver_config, - CONFIG_WIFI_INIT_PRIORITY, &esp_api, + &esp_api, ESP_MTU); CONNECTIVITY_WIFI_MGMT_BIND(Z_DEVICE_DT_DEV_ID(DT_DRV_INST(0))); diff --git a/drivers/wifi/eswifi/eswifi_core.c b/drivers/wifi/eswifi/eswifi_core.c index 976037c19fe2b..3c46db1ed320e 100644 --- a/drivers/wifi/eswifi/eswifi_core.c +++ b/drivers/wifi/eswifi/eswifi_core.c @@ -811,9 +811,8 @@ static const struct net_wifi_mgmt_offload eswifi_offload_api = { .wifi_mgmt_api = &eswifi_mgmt_api, }; -NET_DEVICE_DT_INST_OFFLOAD_DEFINE(0, eswifi_init, NULL, +NET_DEVICE_OFFLOAD_INSTANCE_FROM_DT_INST(0, eswifi_init, NULL, &eswifi0, &eswifi0_cfg, - CONFIG_WIFI_INIT_PRIORITY, &eswifi_offload_api, 1500); diff --git a/drivers/wifi/infineon/airoc_wifi.c b/drivers/wifi/infineon/airoc_wifi.c index 330227fd359c2..3ca50770fd6b0 100644 --- a/drivers/wifi/infineon/airoc_wifi.c +++ b/drivers/wifi/infineon/airoc_wifi.c @@ -815,8 +815,8 @@ static const struct net_wifi_mgmt_offload airoc_api = { .wifi_mgmt_api = &airoc_wifi_mgmt, }; -NET_DEVICE_DT_INST_DEFINE(0, airoc_init, NULL, &airoc_wifi_data, &airoc_wifi_config, - CONFIG_WIFI_INIT_PRIORITY, &airoc_api, ETHERNET_L2, +NET_DEVICE_INSTANCE_FROM_DT_INST(0, airoc_init, NULL, &airoc_wifi_data, &airoc_wifi_config, + &airoc_api, ETHERNET_L2, NET_L2_GET_CTX_TYPE(ETHERNET_L2), WHD_LINK_MTU); CONNECTIVITY_WIFI_MGMT_BIND(Z_DEVICE_DT_DEV_ID(DT_DRV_INST(0))); diff --git a/drivers/wifi/simplelink/simplelink.c b/drivers/wifi/simplelink/simplelink.c index c4af70ce003bd..8acfd15280b07 100644 --- a/drivers/wifi/simplelink/simplelink.c +++ b/drivers/wifi/simplelink/simplelink.c @@ -298,10 +298,9 @@ static int simplelink_init(const struct device *dev) return 0; } -NET_DEVICE_OFFLOAD_INIT(simplelink, CONFIG_WIFI_SIMPLELINK_NAME, - simplelink_init, NULL, +NET_DEVICE_OFFLOAD_INSTANCE(simplelink, simplelink_init, NULL, &simplelink_data, NULL, - CONFIG_WIFI_INIT_PRIORITY, &simplelink_api, + &simplelink_api, CONFIG_WIFI_SIMPLELINK_MAX_PACKET_SIZE); CONNECTIVITY_WIFI_MGMT_BIND(simplelink); diff --git a/drivers/wifi/winc1500/wifi_winc1500.c b/drivers/wifi/winc1500/wifi_winc1500.c index 8ef41f71215eb..bba3c36ff1b49 100644 --- a/drivers/wifi/winc1500/wifi_winc1500.c +++ b/drivers/wifi/winc1500/wifi_winc1500.c @@ -1182,9 +1182,8 @@ static int winc1500_init(const struct device *dev) return 0; } -NET_DEVICE_OFFLOAD_INIT(winc1500, CONFIG_WIFI_WINC1500_NAME, - winc1500_init, NULL, &w1500_data, NULL, - CONFIG_WIFI_INIT_PRIORITY, &winc1500_api, +NET_DEVICE_OFFLOAD_INSTANCE(winc1500, winc1500_init, NULL, &w1500_data, NULL, + &winc1500_api, CONFIG_WIFI_WINC1500_MAX_PACKET_SIZE); CONNECTIVITY_WIFI_MGMT_BIND(winc1500); diff --git a/include/zephyr/device.h b/include/zephyr/device.h index f9e134111ebae..7626c6e3dfbdf 100644 --- a/include/zephyr/device.h +++ b/include/zephyr/device.h @@ -145,6 +145,24 @@ typedef int16_t device_handle_t; config, level, prio, api, \ &Z_DEVICE_STATE_NAME(dev_id)) +/** + * @brief Return the device id whether it's a devicetree based device or not + * + * @param ident Either a devicetree node identifier or a plain unique token + */ +#define Z_DEVICE_ID(ident) \ + COND_CODE_1(DT_NODE_EXISTS(ident), \ + (Z_DEVICE_DT_DEV_ID(ident)), (ident)) + +/** + * @brief Return the device name whether it's a devicetree based device or not + * + * @param ident Either a devicetree node identifier or a plain unique token + */ +#define Z_DEVICE_NAME(ident) \ + COND_CODE_1(DT_NODE_EXISTS(ident), \ + (DEVICE_DT_NAME(ident)), (STRINGIFY(ident))) + /** * @brief Return a string name for a devicetree node. * @@ -210,6 +228,64 @@ typedef int16_t device_handle_t; __VA_ARGS__) \ IF_ENABLED(CONFIG_LLEXT_EXPORT_DEVICES, (Z_DEVICE_EXPORT(node_id);)) +/** + * @brief Create a device object and set it up for boot time initialization. + * + * @note This macro supports both devicetree based device as well as + * non-devicetree based device (legacy support). + * + * This macro defines a @ref device that is automatically configured by the + * kernel during system initialization. If the given identifier is a plain + * unique token, it will be used in the name of the global device structure + * as a C identifier as well as its @ref device.name. + * If the given identifier is a devicetree node itentifier, the global device + * object's name as a C will be derived from the node's dependency ordinal + * (DT based) and @ref device.name will be set to `DEVICE_DT_NAME(node_id)`. + * + * The device is declared with extern visibility, so a pointer to a global + * device object can be obtained either with `DEVICE_DT_GET(node_id)` in case + * the device is devicetree based, or with `DEVICE_GET(dev_id)` for + * non-devicetree legacy devices. And this from any source file that includes + * ``. Before using the pointer, the referenced object should + * be checked using device_is_ready(). + * + * @param ident Either a devicetree node identifier or a plain unique token + * @param init_fn Pointer to the device's initialization function, which will be + * run by the kernel during system initialization. Can be `NULL`. + * @param pm Pointer to the device's power management resources, a + * @ref pm_device, which will be stored in @ref device.pm. Use `NULL` if the + * device does not use PM. + * @param data Pointer to the device's private mutable data, which will be + * stored in @ref device.data. + * @param config Pointer to the device's private constant data, which will be + * stored in @ref device.config field. + * @param level The device's initialization level (PRE_KERNEL_1, PRE_KERNEL_2 or + * POST_KERNEL). + * @param api Pointer to the device's API structure. Can be `NULL`. + */ +#define DEVICE_INSTANCE(ident, init_fn, pm, data, config, level, api) \ + Z_DEVICE_STATE_DEFINE(Z_DEVICE_ID(ident)); \ + Z_DEVICE_DEFINE(ident, Z_DEVICE_ID(ident), \ + Z_DEVICE_NAME(ident), init_fn, pm, data, config, \ + ZINIT_GET_LEVEL(Z_DEVICE_ID(ident), level), \ + ZINIT_GET_PRIORITY(ident, Z_DEVICE_ID(ident)), \ + api, &Z_DEVICE_STATE_NAME(Z_DEVICE_ID(ident))) + +/** + * @brief Like DEVICE_INSTANCE(), but with an extra parameter in order to + * provide an externaly defined device state object. + * + * First parameters are as expected by DEVICE_INSTANCE(). + * @param state A pointer on the externally defined device state object + */ +#define DEVICE_INSTANCE_EXTERNAL_STATE(ident, init_fn, pm, data, \ + config, level, api, state) \ + Z_DEVICE_DEFINE(ident, Z_DEVICE_ID(ident), \ + Z_DEVICE_NAME(ident), init_fn, pm, data, config, \ + ZINIT_GET_LEVEL(Z_DEVICE_ID(ident), level), \ + ZINIT_GET_PRIORITY(ident, Z_DEVICE_ID(ident)), \ + api, state) + /** * @brief Like DEVICE_DT_DEFINE(), but uses an instance of a `DT_DRV_COMPAT` * compatible instead of a node identifier. @@ -221,6 +297,17 @@ typedef int16_t device_handle_t; #define DEVICE_DT_INST_DEFINE(inst, ...) \ DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) +/** + * @brief Like DEVICE_INSTANCE, but uses an instance of a `DT_DRV_COMPAT` + * compatible instead of a node identifier. + + * @param inst Instance number. The `ident` argument to DEVICE_INSTANCE() is + * set to `DT_DRV_INST(inst)`. + * @param ... Other parameters as expected by DEVICE_INSTANCE(). + */ +#define DEVICE_INSTANCE_FROM_DT_INST(inst, init_fn, pm, data, config, level, api) \ + DEVICE_INSTANCE(DT_DRV_INST(inst), init_fn, pm, data, config, level, api) + /** * @brief The name of the global device object for @p node_id * @@ -333,6 +420,15 @@ typedef int16_t device_handle_t; */ #define DEVICE_GET(dev_id) (&DEVICE_NAME_GET(dev_id)) +/** + * @brief Obtain a pointer to a device object + * + * @param ident Either a devicetree node identifier or a plain unique token + */ +#define DEVICE_INSTANCE_GET(ident) \ + COND_CODE_1(DT_NODE_EXISTS(ident), \ + (&DEVICE_DT_NAME_GET(ident)), (&DEVICE_NAME_GET(ident))) + /** * @brief Declare a static device object * @@ -369,6 +465,16 @@ typedef int16_t device_handle_t; */ #define DEVICE_INIT_GET(dev_id) (&Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id))) +/** + * @brief Get a @ref init_entry reference from a device + * + * @param ident Either a devicetree node identifier or a plain unique token + */ +#define DEVICE_INIT_ENTRY_GET(ident) \ + COND_CODE_1(DT_NODE_EXISTS(ident), \ + (&Z_INIT_ENTRY_NAME(DEVICE_DT_NAME_GET(ident))), \ + (&Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(ident)))) + /** * @brief Runtime device dynamic structure (in RAM) per driver instance * @@ -982,17 +1088,6 @@ device_get_dt_nodelabels(const struct device *dev) }; #endif /* CONFIG_DEVICE_DT_METADATA */ -/** - * @brief Init sub-priority of the device - * - * The sub-priority is defined by the devicetree ordinal, which ensures that - * multiple drivers running at the same priority level run in an order that - * respects the devicetree dependencies. - */ -#define Z_DEVICE_INIT_SUB_PRIO(node_id) \ - COND_CODE_1(DT_NODE_EXISTS(node_id), \ - (DT_DEP_ORD_STR_SORTABLE(node_id)), (0)) - /** * @brief Maximum device name length. * @@ -1109,7 +1204,7 @@ device_get_dt_nodelabels(const struct device *dev) Z_DEVICE_CHECK_INIT_LEVEL(level) \ \ static const Z_DECL_ALIGN(struct init_entry) __used __noasan Z_INIT_ENTRY_SECTION( \ - level, prio, Z_DEVICE_INIT_SUB_PRIO(node_id)) \ + level, prio) \ Z_INIT_ENTRY_NAME(DEVICE_NAME_GET(dev_id)) = { \ .init_fn = {COND_CODE_1(Z_DEVICE_IS_MUTABLE(node_id), (.dev_rw), (.dev)) = \ (init_fn_)}, \ diff --git a/include/zephyr/devicetree.h b/include/zephyr/devicetree.h index 1adc7602f10ff..a269546d87db5 100644 --- a/include/zephyr/devicetree.h +++ b/include/zephyr/devicetree.h @@ -3564,8 +3564,10 @@ * @param status a status as one of the tokens okay or disabled, not a string * @return 1 if the node has the given status, 0 otherwise. */ +#ifndef ZTEST_UNITTEST /* If ZTEST_UNITTEST, a dummy version will be defined */ #define DT_NODE_HAS_STATUS(node_id, status) \ DT_NODE_HAS_STATUS_INTERNAL(node_id, status) +#endif /* ZTEST_UNITTEST */ /** * @brief Does a node identifier refer to a node with a status `okay`? diff --git a/include/zephyr/drivers/can.h b/include/zephyr/drivers/can.h index 82dbf4160cf40..7e019845566bb 100644 --- a/include/zephyr/drivers/can.h +++ b/include/zephyr/drivers/can.h @@ -773,6 +773,31 @@ struct can_device_state { pm, data, config, level, prio, api, \ &(Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)).devstate), \ __VA_ARGS__) +/** + * @brief Like DEVICE_INSTANCE() with CAN device specifics. + * + * @details Defines a device which implements the CAN API. May generate a custom + * device_state container struct and init_fn wrapper when needed depending on + * @kconfig{CONFIG_CAN_STATS}. + * + * @param node_id The devicetree node identifier. + * @param init_fn Name of the init function of the driver. + * @param pm PM device resources reference (NULL if device does not use PM). + * @param data Pointer to the device's private data. + * @param config The address to the structure containing the configuration + * information for this instance of the driver. + * @param level The initialization level. See SYS_INIT() for + * details. + * @param api Provides an initial pointer to the API function struct + * used by the driver. Can be NULL. + */ +#define CAN_DEVICE_INSTANCE(node_id, init_fn, pm, data, config, level, api) \ + Z_CAN_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \ + Z_CAN_INIT_FN(Z_DEVICE_DT_DEV_ID(node_id), init_fn) \ + DEVICE_INSTANCE_EXTERNAL_STATE(node_id, init_fn, pm, data, \ + config, level, api, \ + &(Z_DEVICE_STATE_NAME( \ + Z_DEVICE_DT_DEV_ID(node_id)).devstate)) #else /* CONFIG_CAN_STATS */ @@ -791,6 +816,9 @@ struct can_device_state { DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \ prio, api, __VA_ARGS__) +#define CAN_DEVICE_INSTANCE(node_id, init_fn, pm, data, config, level, api) \ + DEVICE_INSTANCE(node_id, init_fn, pm, data, config, level, api) + #endif /* CONFIG_CAN_STATS */ /** @@ -803,6 +831,16 @@ struct can_device_state { #define CAN_DEVICE_DT_INST_DEFINE(inst, ...) \ CAN_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) +/** + * @brief Like CAN_DEVICE_INSTANCE() for an instance of a DT_DRV_COMPAT compatible + * + * @param inst Instance number. This is replaced by DT_DRV_COMPAT(inst) + * in the call to CAN_DEVICE_INSTANCE(). + * @param ... Other parameters as expected by CAN_DEVICE_INSTANCE(). + */ +#define CAN_DEVICE_INSTANCE_FROM_DT_INST(inst, ...) \ + CAN_DEVICE_INSTANCE(DT_DRV_INST(inst), __VA_ARGS__) + /** * @name CAN controller configuration * diff --git a/include/zephyr/drivers/emul_stub_device.h b/include/zephyr/drivers/emul_stub_device.h index b1b1bd87ff34a..14bddc8db96f7 100644 --- a/include/zephyr/drivers/emul_stub_device.h +++ b/include/zephyr/drivers/emul_stub_device.h @@ -35,7 +35,7 @@ struct emul_stub_dev_api { static struct emul_stub_dev_data stub_data_##n; \ static struct emul_stub_dev_config stub_config_##n; \ static struct emul_stub_dev_api stub_api_##n; \ - DEVICE_DT_INST_DEFINE(n, &emul_init_stub_##n, NULL, &stub_data_##n, &stub_config_##n, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &stub_api_##n); + DEVICE_INSTANCE_FROM_DT_INST(n, &emul_init_stub_##n, NULL, &stub_data_##n, \ + &stub_config_##n, POST_KERNEL, &stub_api_##n); #endif /* ZEPHYR_INCLUDE_EMUL_STUB_DEVICE_H_ */ diff --git a/include/zephyr/drivers/firmware/scmi/util.h b/include/zephyr/drivers/firmware/scmi/util.h index cd05f984ac202..4768b5e03cdfe 100644 --- a/include/zephyr/drivers/firmware/scmi/util.h +++ b/include/zephyr/drivers/firmware/scmi/util.h @@ -183,6 +183,23 @@ DEVICE_DT_INST_DEFINE(inst, &scmi_core_transport_init, \ pm, data, config, level, prio, api) +/** + * @brief Define an SCMI transport driver + * + * This is merely a wrapper over DEVICE_INSTANCE_FROM_DT_INST(), but is + * required since transport layer drivers are not allowed to place + * their own init() function in the init section. Instead, transport + * layer drivers place the scmi_core_transport_init() function in the + * init section, which, in turn, will call the transport layer driver + * init() function. This is required because the SCMI core needs to + * perform channel binding and setup during the transport layer driver's + * initialization. + */ +#define SCMI_TRANSPORT_INSTANCE_FROM_DT_INST(inst, pm, data, config, \ + level, api) \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &scmi_core_transport_init, \ + pm, data, config, level, api) + /** * @brief Define an SCMI protocol * @@ -216,6 +233,39 @@ &SCMI_PROTOCOL_NAME(DT_REG_ADDR_RAW(node_id)), \ config, level, prio, api) +/** + * @brief Define an SCMI protocol + * + * This macro performs three important functions: + * 1) It defines a `struct scmi_protocol`, which is + * needed by all protocol drivers to work with the SCMI API. + * + * 2) It declares the static channels bound to the protocol. + * This is only applicable if the transport layer driver + * supports static channels. + * + * 3) It creates a `struct device` a sets the `data` field + * to the newly defined `struct scmi_protocol`. This is + * needed because the protocol driver needs to work with the + * SCMI API **and** the subsystem API. + * + * @param node_id protocol node identifier + * @param init_fn pointer to protocol's initialization function + * @param api pointer to protocol's subsystem API + * @param pm pointer to the protocol's power management resources + * @param data pointer to protocol's private data + * @param config pointer to protocol's private constant data + * @param level protocol initialization level + * @param api pointer to driver's api + */ +#define SCMI_PROTOCOL_INSTANCE(node_id, init_fn, pm, data, config, \ + level, api) \ + DT_SCMI_TRANSPORT_CHANNELS_DECLARE(node_id) \ + DT_SCMI_PROTOCOL_DATA_DEFINE(node_id, DT_REG_ADDR(node_id), data); \ + DEVICE_INSTANCE(node_id, init_fn, pm, \ + &SCMI_PROTOCOL_NAME(DT_REG_ADDR(node_id)), \ + config, level, api) + /** * @brief Just like DT_SCMI_PROTOCOL_DEFINE(), but uses an instance * of a `DT_DRV_COMPAT` compatible instead of a node identifier @@ -233,6 +283,15 @@ level, prio, api) \ DT_SCMI_PROTOCOL_DEFINE(DT_INST(inst, DT_DRV_COMPAT), init_fn, pm, \ data, config, level, prio, api) +/** + * @brief Just like SCMI_PROTOCOL_INSTANCE(), but uses an instance + * of a `DT_DRV_COMPAT` compatible instead of a node identifier + * + * @param inst instance number + * @param ... Other parameters as expected by SCMI_PROTOCOL_INSTANCE + */ +#define SCMI_PROTOCOL_INSTANCE_FROM_DT_INST(inst, ...) \ + SCMI_PROTOCOL_INSTANCE(DT_INST(inst, DT_DRV_COMPAT), __VA_ARGS__) /** * @brief Define an SCMI protocol with no device diff --git a/include/zephyr/drivers/gpio/gpio_mmio32.h b/include/zephyr/drivers/gpio/gpio_mmio32.h index 005f72052936d..475bea2f1d1aa 100644 --- a/include/zephyr/drivers/gpio/gpio_mmio32.h +++ b/include/zephyr/drivers/gpio/gpio_mmio32.h @@ -56,13 +56,13 @@ static const struct gpio_mmio32_config _CONCAT(Z_DEVICE_DT_DEV_ID(node_id), _cfg .mask = _mask, \ }; \ \ -DEVICE_DT_DEFINE(node_id, \ - &gpio_mmio32_init, \ - NULL, \ - &_CONCAT(Z_DEVICE_DT_DEV_ID(node_id), _ctx), \ - &_CONCAT(Z_DEVICE_DT_DEV_ID(node_id), _cfg), \ - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - &gpio_mmio32_api) +DEVICE_INSTANCE(node_id, \ + &gpio_mmio32_init, \ + NULL, \ + &_CONCAT(Z_DEVICE_DT_DEV_ID(node_id), _ctx), \ + &_CONCAT(Z_DEVICE_DT_DEV_ID(node_id), _cfg), \ + PRE_KERNEL_1, \ + &gpio_mmio32_api) #else /* CONFIG_GPIO_MMIO32 */ diff --git a/include/zephyr/drivers/i2c.h b/include/zephyr/drivers/i2c.h index 5f1c3fbe8ae4d..ce4c268cc737c 100644 --- a/include/zephyr/drivers/i2c.h +++ b/include/zephyr/drivers/i2c.h @@ -672,6 +672,32 @@ static inline void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs &(Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)).devstate), \ __VA_ARGS__) +/** + * @brief Like DEVICE_INSTANCE() with I2C specifics. + * + * @details Defines a device which implements the I2C API. May + * generate a custom device_state container struct and init_fn + * wrapper when needed depending on I2C @kconfig{CONFIG_I2C_STATS}. + * + * @param node_id The devicetree node identifier. + * @param init_fn Name of the init function of the driver. Can be `NULL`. + * @param pm PM device resources reference (NULL if device does not use PM). + * @param data Pointer to the device's private data. + * @param config The address to the structure containing the + * configuration information for this instance of the driver. + * @param level The initialization level. See SYS_INIT() for + * details. + * @param api Provides an initial pointer to the API function struct + * used by the driver. Can be NULL. + */ +#define I2C_DEVICE_INSTANCE(node_id, init_fn, pm, data, config, level, api) \ + Z_I2C_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \ + Z_I2C_INIT_FN(Z_DEVICE_DT_DEV_ID(node_id), init_fn) \ + DEVICE_INSTANCE_EXTERNAL_STATE(node_id, init_fn, pm, data, \ + config, level, api, \ + &(Z_DEVICE_STATE_NAME( \ + Z_DEVICE_DT_DEV_ID(node_id)).devstate)) + #else /* CONFIG_I2C_STATS */ static inline void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs, @@ -687,6 +713,9 @@ static inline void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \ prio, api, __VA_ARGS__) +#define I2C_DEVICE_INSTANCE(node_id, init_fn, pm, data, config, level, api) \ + DEVICE_INSTANCE(node_id, init_fn, pm, data, config, level, api) + #endif /* CONFIG_I2C_STATS */ /** @@ -700,6 +729,16 @@ static inline void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs #define I2C_DEVICE_DT_INST_DEFINE(inst, ...) \ I2C_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) +/** + * @brief Like I2C_DEVICE_INSTANCE() for an instance of a DT_DRV_COMPAT compatible + * + * @param inst instance number. This is replaced by + * DT_DRV_COMPAT(inst) in the call to I2C_DEVICE_INSTANCE(). + * @param ... other parameters as expected by I2C_DEVICE_INSTANCE(). + */ +#define I2C_DEVICE_INSTANCE_FROM_DT_INST(inst, ...) \ + I2C_DEVICE_INSTANCE(DT_DRV_INST(inst), __VA_ARGS__) + /** * @brief Configure operation of a host controller. diff --git a/include/zephyr/drivers/sensor.h b/include/zephyr/drivers/sensor.h index 1d958a4b70704..5990662e45ed8 100644 --- a/include/zephyr/drivers/sensor.h +++ b/include/zephyr/drivers/sensor.h @@ -1404,18 +1404,54 @@ struct sensor_info { \ SENSOR_INFO_DT_DEFINE(node_id); +/** + * @brief Like DEVICE_INSTANCE() with sensor specifics. + * + * @details Defines a device which implements the sensor API. May define an + * element in the sensor info iterable section used to enumerate all sensor + * devices. + * + * @param node_id The devicetree node identifier. + * @param init_fn Name of the init function of the driver. + * @param pm_device PM device resources reference (NULL if device does not use + * PM). + * @param data_ptr Pointer to the device's private data. + * @param cfg_ptr The address to the structure containing the configuration + * information for this instance of the driver. + * @param level The initialization level. See init.h for details. + * @param api_ptr Provides an initial pointer to the API function struct used + * by the driver. Can be NULL. + */ +#define SENSOR_DEVICE_INSTANCE(node_id, init_fn, pm_device, \ + data_ptr, cfg_ptr, level, api_ptr) \ + DEVICE_INSTANCE(node_id, init_fn, pm_device, \ + data_ptr, cfg_ptr, level, api_ptr); \ + \ + SENSOR_INFO_DT_DEFINE(node_id); + /** * @brief Like SENSOR_DEVICE_DT_DEFINE() for an instance of a DT_DRV_COMPAT * compatible * * @param inst instance number. This is replaced by * DT_DRV_COMPAT(inst) in the call to SENSOR_DEVICE_DT_DEFINE(). - * * @param ... other parameters as expected by SENSOR_DEVICE_DT_DEFINE(). */ #define SENSOR_DEVICE_DT_INST_DEFINE(inst, ...) \ SENSOR_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) +/** + * @brief Like SENSOR_DEVICE_INSTANCE() for an instance of a DT_DRV_COMPAT + * compatible + * + * @param inst instance number. This is replaced by + * DT_DRV_COMPAT(inst) in the call to SENSOR_DEVICE_INSTANCE(). + * + * @param ... other parameters as expected by SENSOR_DEVICE_INSTANCE(). + */ +#define SENSOR_DEVICE_INSTANCE_FROM_DT_INST(inst, ...) \ + SENSOR_DEVICE_INSTANCE(DT_DRV_INST(inst), __VA_ARGS__) + /** * @brief Helper function for converting struct sensor_value to integer milli units. * diff --git a/include/zephyr/drivers/smbus.h b/include/zephyr/drivers/smbus.h index f0642d6d837e4..f10fec211697b 100644 --- a/include/zephyr/drivers/smbus.h +++ b/include/zephyr/drivers/smbus.h @@ -517,6 +517,36 @@ static inline void smbus_xfer_stats(const struct device *dev, uint8_t sent, (node_id)).devstate), \ __VA_ARGS__) +/** + * @brief Like DEVICE_INSTANCE() with SMBus specifics. + * + * @details Defines a device which implements the SMBus API. May + * generate a custom device_state container struct and init_fn + * wrapper when needed depending on SMBus @kconfig{CONFIG_SMBUS_STATS}. + * + * @param node_id The devicetree node identifier. + * @param init_fn Name of the init function of the driver. + * @param pm_device PM device resources reference + * (NULL if device does not use PM). + * @param data_ptr Pointer to the device's private data. + * @param cfg_ptr The address to the structure containing the + * configuration information for this instance of the driver. + * @param level The initialization level. See SYS_INIT() for + * details. + * @param api_ptr Provides an initial pointer to the API function struct + * used by the driver. Can be NULL. + */ +#define SMBUS_DEVICE_INSTANCE(node_id, init_fn, pm_device, \ + data_ptr, cfg_ptr, level, api_ptr) \ + Z_SMBUS_DEVICE_STATE_DEFINE(node_id, \ + Z_DEVICE_DT_DEV_NAME(node_id)); \ + Z_SMBUS_INIT_FN(Z_DEVICE_DT_DEV_NAME(node_id), init_fn) \ + DEVICE_INSTANCE_EXTERNAL_STATE(node_id, init_fn, pm_device, \ + data_ptr, cfg_ptr, level, api_ptr,\ + &(Z_DEVICE_STATE_NAME( \ + Z_DEVICE_DT_DEV_NAME \ + (node_id)).devstate)) + #else /* CONFIG_SMBUS_STATS */ static inline void smbus_xfer_stats(const struct device *dev, uint8_t sent, @@ -534,6 +564,11 @@ static inline void smbus_xfer_stats(const struct device *dev, uint8_t sent, data_ptr, cfg_ptr, level, prio, \ api_ptr, __VA_ARGS__) +#define SMBUS_DEVICE_INSTANCE(node_id, init_fn, pm_device, \ + data_ptr, cfg_ptr, level, api_ptr) \ + DEVICE_INSTANCE(node_id, init_fn, pm_device, data_ptr, cfg_ptr, \ + level, api_ptr) + #endif /* CONFIG_SMBUS_STATS */ /** @@ -548,6 +583,16 @@ static inline void smbus_xfer_stats(const struct device *dev, uint8_t sent, #define SMBUS_DEVICE_DT_INST_DEFINE(inst, ...) \ SMBUS_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) +/** + * @brief Like SMBUS_DEVICE_INSTANCE() for an instance of a DT_DRV_COMPAT + * compatible + * + * @param inst instance number. This is replaced by + * DT_DRV_COMPAT(inst) in the call to SMBUS_DEVICE_INSTANCE(). + * @param ... other parameters as expected by SMBUS_DEVICE_INSTANCE(). + */ +#define SMBUS_DEVICE_INSTANCE_FROM_DT_INST(inst, ...) \ + SMBUS_DEVICE_INSTANCE(DT_DRV_INST(inst), __VA_ARGS__) /** * @brief Configure operation of a SMBus host controller. * diff --git a/include/zephyr/drivers/spi.h b/include/zephyr/drivers/spi.h index 3368a5312a45f..1ad786f83fd95 100644 --- a/include/zephyr/drivers/spi.h +++ b/include/zephyr/drivers/spi.h @@ -585,6 +585,33 @@ struct spi_device_state { &(Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)).devstate), \ __VA_ARGS__) +/** + * @brief Like DEVICE_INSTANCE() with SPI specifics. + * + * @details Defines a device which implements the SPI API. May + * generate a custom device_state container struct and init_fn + * wrapper when needed depending on SPI @kconfig{CONFIG_SPI_STATS}. + * + * @param node_id The devicetree node identifier. + * @param init_fn Name of the init function of the driver. + * @param pm_device PM device resources reference (NULL if device does not use PM). + * @param data_ptr Pointer to the device's private data. + * @param cfg_ptr The address to the structure containing the configuration + * information for this instance of the driver. + * @param level The initialization level. See SYS_INIT() for details. + * @param api_ptr Provides an initial pointer to the API function struct used by + * the driver. Can be NULL. + */ +#define SPI_DEVICE_INSTANCE(node_id, init_fn, pm_device, \ + data_ptr, cfg_ptr, level, api_ptr) \ + Z_SPI_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \ + Z_SPI_INIT_FN(Z_DEVICE_DT_DEV_ID(node_id), init_fn) \ + DEVICE_INSTANCE_EXTERNAL_STATE(node_id, init_fn, pm_device, \ + data_ptr, cfg_ptr, level, \ + api_ptr, \ + &(Z_DEVICE_STATE_NAME( \ + Z_DEVICE_DT_DEV_ID(node_id)).devstate)) + static inline void spi_transceive_stats(const struct device *dev, int error, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs) @@ -619,6 +646,11 @@ static inline void spi_transceive_stats(const struct device *dev, int error, &Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)), \ __VA_ARGS__) +#define SPI_DEVICE_INSTANCE(node_id, init_fn, pm_device, \ + data_ptr, cfg_ptr, level, api_ptr) \ + DEVICE_INSTANCE(node_id, init_fn, pm_device, data_ptr, cfg_ptr, \ + level, api_ptr) + #define SPI_STATS_RX_BYTES_INC(dev_) #define SPI_STATS_TX_BYTES_INC(dev_) #define SPI_STATS_TRANSFER_ERROR_INC(dev_) diff --git a/include/zephyr/init.h b/include/zephyr/init.h index 512ea9f67bea6..29e085989d370 100644 --- a/include/zephyr/init.h +++ b/include/zephyr/init.h @@ -13,6 +13,8 @@ #include #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -144,12 +146,10 @@ struct init_entry { * @brief Init entry section. * * Each init entry is placed in a section with a name crafted so that it allows - * linker scripts to sort them according to the specified - * level/priority/sub-priority. + * linker scripts to sort them according to the specified level and priority. */ -#define Z_INIT_ENTRY_SECTION(level, prio, sub_prio) \ - __attribute__((__section__( \ - ".z_init_" #level STRINGIFY(prio)"_" STRINGIFY(sub_prio)"_"))) +#define Z_INIT_ENTRY_SECTION(level, prio) \ + __attribute__((__section__(".z_init_" #level "_" STRINGIFY(prio)"_"))) /* Designated initializers where added to C in C99. There were added to @@ -235,10 +235,10 @@ struct init_entry { * * @see SYS_INIT() */ -#define SYS_INIT_NAMED(name, init_fn_, level, prio) \ - static const Z_DECL_ALIGN(struct init_entry) \ - Z_INIT_ENTRY_SECTION(level, prio, 0) __used __noasan \ - Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}, \ +#define SYS_INIT_NAMED(name, init_fn_, level, prio) \ + static const Z_DECL_ALIGN(struct init_entry) \ + Z_INIT_ENTRY_SECTION(level, prio) __used __noasan \ + Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}, \ Z_INIT_SYS_INIT_DEV_NULL} /** @} */ diff --git a/include/zephyr/linker/iterable_sections.h b/include/zephyr/linker/iterable_sections.h index 3eb4e9527b8d1..91dd48a6ffd64 100644 --- a/include/zephyr/linker/iterable_sections.h +++ b/include/zephyr/linker/iterable_sections.h @@ -21,6 +21,7 @@ _CONCAT(_##struct_type, _list_start) = .; \ KEEP(*(SORT(._##struct_type.static.*_?_*))); \ KEEP(*(SORT(._##struct_type.static.*_??_*))); \ + KEEP(*(SORT(._##struct_type.static.*_???_*))); \ _CONCAT(_##struct_type, _list_end) = . #define Z_LINK_ITERABLE_ALIGNED(struct_type, align) \ diff --git a/include/zephyr/linker/linker-defs.h b/include/zephyr/linker/linker-defs.h index 9c795ae78517a..1466f32a98b2c 100644 --- a/include/zephyr/linker/linker-defs.h +++ b/include/zephyr/linker/linker-defs.h @@ -46,8 +46,9 @@ */ #define CREATE_OBJ_LEVEL(object, level) \ __##object##_##level##_start = .; \ - KEEP(*(SORT(.z_##object##_##level?_*))); \ - KEEP(*(SORT(.z_##object##_##level??_*))); + KEEP(*(SORT(.z_##object##_##level##_?_*))); \ + KEEP(*(SORT(.z_##object##_##level##_??_*))); \ + KEEP(*(SORT(.z_##object##_##level##_???_*))); /* * link in shell initialization objects for all modules that use shell and diff --git a/include/zephyr/net/ethernet.h b/include/zephyr/net/ethernet.h index c870525c2e9f8..7d3f54131b1c7 100644 --- a/include/zephyr/net/ethernet.h +++ b/include/zephyr/net/ethernet.h @@ -1257,6 +1257,79 @@ static inline bool net_eth_is_vlan_interface(struct net_if *iface) #define ETH_NET_DEVICE_DT_INST_DEFINE(inst, ...) \ ETH_NET_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) + +#if !defined(CONFIG_ETH_DRIVER_RAW_MODE) + +#define Z_ETH_NET_DEVICE_INSTANCE_SFX(ident, sfx, init_fn, pm, data, \ + config, api, mtu) \ + Z_NET_DEVICE_INSTANCE_SFX(ident, sfx, init_fn, pm, data, \ + config, api, ETHERNET_L2, \ + NET_L2_GET_CTX_TYPE(ETHERNET_L2), mtu) + +#else /* CONFIG_ETH_DRIVER_RAW_MODE */ + +#define Z_ETH_NET_DEVICE_INSTANCE_SFX(ident, sfx, init_fn, pm, data, \ + config, api, mtu) \ + DEVICE_INSTANCE(ident, init_fn, pm, data, config, \ + POST_KERNEL, api); + +#endif /* CONFIG_ETH_DRIVER_RAW_MODE */ + +/** + * @brief Create an Ethernet network interface and bind it to network device. + * + * @param ident Either a devicetree node identifier or a plain unique token + * @param init_fn Address to the init function of the driver. + * @param pm Reference to struct pm_device associated with the device. + * (optional). + * @param data Pointer to the device's private data. + * @param config The address to the structure containing the + * configuration information for this instance of the driver. + * @param api Provides an initial pointer to the API function struct + * used by the driver. Can be NULL. + * @param mtu Maximum transfer unit in bytes for this network interface. + */ +#define ETH_NET_DEVICE_INSTANCE(ident, init_fn, pm, data, config, \ + api, mtu) \ + Z_ETH_NET_DEVICE_INSTANCE_SFX(ident, 0, init_fn, pm, data, \ + config, api, mtu) + +/** + * @brief Like ETH_NET_DEVICE_INSTANCE for an instance of a DT_DRV_COMPAT + * compatible + * + * @param inst instance number. This is replaced by + * DT_DRV_COMPAT(inst) in the call to ETH_NET_DEVICE_INSTANCE. + * + * @param ... other parameters as expected by ETH_NET_DEVICE_INSTANCE. + */ +#define ETH_NET_DEVICE_INSTANCE_FROM_DT_INST(inst, ...) \ + ETH_NET_DEVICE_INSTANCE(DT_DRV_INST(inst), __VA_ARGS__) + +/** + * @brief Create multiple Ethernet network interfaces and bind them to network + * devices. + * If your network device needs more than one instance of a network interface, + * use this macro below and provide a different instance suffix each time + * (0, 1, 2, ... or a, b, c ... whatever works for you) + * + * @param ident Either a devicetree node identifier or a plain unique token + * @param sfx Instance suffix for differentiation. + * @param init_fn Address to the init function of the driver. + * @param pm Reference to struct pm_device associated with the device. + * (optional). + * @param data Pointer to the device's private data. + * @param config The address to the structure containing the + * configuration information for this instance of the driver. + * @param api Provides an initial pointer to the API function struct + * used by the driver. Can be NULL. + * @param mtu Maximum transfer unit in bytes for this network interface. + */ +#define ETH_NET_DEVICE_INSTANCE_MULTI(ident, sfx, init_fn, \ + pm, data, config, api, mtu) \ + Z_ETH_NET_DEVICE_INSTANCE_SFX(ident, sfx, init_fn, pm, data, \ + config, api, mtu) + /** * @brief Inform ethernet L2 driver that ethernet carrier is detected. * This happens when cable is connected. diff --git a/include/zephyr/net/net_if.h b/include/zephyr/net/net_if.h index c44d73144808a..678022394ea62 100644 --- a/include/zephyr/net/net_if.h +++ b/include/zephyr/net/net_if.h @@ -3462,6 +3462,120 @@ struct net_if_api { #define NET_DEVICE_DT_INST_OFFLOAD_DEFINE(inst, ...) \ NET_DEVICE_DT_OFFLOAD_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) + +/* Network device initialization macros */ + +#define Z_NET_DEVICE_INSTANCE_SFX(ident, sfx, init_fn, pm, data, \ + config, api, l2, l2_ctx_type, mtu) \ + DEVICE_INSTANCE(ident, init_fn, pm, data, config, \ + POST_KERNEL, api); \ + NET_L2_DATA_INIT(Z_DEVICE_ID(ident), sfx, l2_ctx_type); \ + NET_IF_INIT(Z_DEVICE_ID(ident), sfx, l2, mtu, NET_IF_MAX_CONFIGS) + +/** + * @brief Create a network interface and bind it to network device. + * + * @param ident Either a devicetree node identifier or a plain unique token + * @param init_fn Address to the init function of the driver. + * @param pm Reference to struct pm_device associated with the device. + * (optional). + * @param data Pointer to the device's private data. + * @param config The address to the structure containing the + * configuration information for this instance of the driver. + * @param api Provides an initial pointer to the API function struct + * used by the driver. Can be NULL. + * @param l2 Network L2 layer for this network interface. + * @param l2_ctx_type Type of L2 context data. + * @param mtu Maximum transfer unit in bytes for this network interface. + */ +#define NET_DEVICE_INSTANCE(ident, init_fn, pm, data, config, \ + api, l2, l2_ctx_type, mtu) \ + Z_NET_DEVICE_INSTANCE_SFX(ident, 0, init_fn, pm, data, config, \ + api, l2, l2_ctx_type, mtu) + +/** + * @brief Like NET_DEVICE_INSTANCE for an instance of a DT_DRV_COMPAT compatible + * + * @param inst instance number. This is replaced by + * DT_DRV_COMPAT(inst) in the call to NET_DEVICE_INSTANCE. + * + * @param ... other parameters as expected by NET_DEVICE_INSTANCE. + */ +#define NET_DEVICE_INSTANCE_FROM_DT_INST(inst, ...) \ + NET_DEVICE_INSTANCE(DT_DRV_INST(inst), __VA_ARGS__) + +/** + * @brief Create multiple network interfaces and bind them to network device. + * If your network device needs more than one instance of a network interface, + * use this macro below and provide a different instance suffix each time + * (0, 1, 2, ... or a, b, c ... whatever works for you) + * + * @param ident Either a devicetree node identifier or a plain unique token + * @param sfx Instance suffix for differentiation. + * @param init_fn Address to the init function of the driver. + * @param pm Reference to struct pm_device associated with the device. + * (optional). + * @param data Pointer to the device's private data. + * @param config The address to the structure containing the + * configuration information for this instance of the driver. + * @param api Provides an initial pointer to the API function struct + * used by the driver. Can be NULL. + * @param l2 Network L2 layer for this network interface. + * @param l2_ctx_type Type of L2 context data. + * @param mtu Maximum transfer unit in bytes for this network interface. + */ +#define NET_DEVICE_INSTANCE_MULTI(ident, sfx, init_fn, pm, \ + data, config, api, l2, \ + l2_ctx_type, mtu) \ + Z_NET_DEVICE_INSTANCE_SFX(ident, sfx, init_fn, pm, data, \ + config, api, l2, l2_ctx_type, mtu) + +/** + * @brief Like NET_DEVICE_INSTANCE_MULTI for an instance of a DT_DRV_COMPAT + * compatible + * + * @param inst instance number. This is replaced by + * DT_DRV_COMPAT(inst) in the call to NET_DEVICE_INSTANCE_MULTI. + * + * @param ... other parameters as expected by NET_DEVICE_INSTANCE_MULTI. + */ +#define NET_DEVICE_INSTANCE_MULT_FROM_DT_INST(inst, ...) \ + NET_DEVICE_INSTANCE_MULTI(DT_DRV_INST(inst), __VA_ARGS__) + +/** + * @brief Create a offloaded network interface and bind it to network device. + * The offloaded network interface is implemented by a device vendor HAL or + * similar. + * + * @param ident Either a devicetree node identifier or a plain unique token + * @param init_fn Address to the init function of the driver. + * @param pm Reference to struct pm_device associated with the device. + * (optional). + * @param data Pointer to the device's private data. + * @param config The address to the structure containing the + * configuration information for this instance of the driver. + * @param api Provides an initial pointer to the API function struct + * used by the driver. Can be NULL. + * @param mtu Maximum transfer unit in bytes for this network interface. + */ +#define NET_DEVICE_OFFLOAD_INSTANCE(ident, init_fn, pm, data, config, \ + api, mtu) \ + DEVICE_INSTANCE(ident, init_fn, pm, data, config, \ + POST_KERNEL, api); \ + NET_IF_OFFLOAD_INIT(Z_DEVICE_ID(ident), 0, mtu) + +/** + * @brief Like NET_DEVICE_OFFLOAD_INSTANCE for an instance of a DT_DRV_COMPAT + * compatible + * + * @param inst instance number. This is replaced by + * DT_DRV_COMPAT(inst) in the call to NET_DEVICE_OFFLOAD_INSTANCE. + * + * @param ... other parameters as expected by NET_DEVICE_OFFLOAD_INSTANCE. + */ +#define NET_DEVICE_OFFLOAD_INSTANCE_FROM_DT_INST(inst, ...) \ + NET_DEVICE_OFFLOAD_INSTANCE(DT_DRV_INST(inst), __VA_ARGS__) + /** * @brief Count the number of network interfaces. * diff --git a/include/zephyr/sensing/sensing_sensor.h b/include/zephyr/sensing/sensing_sensor.h index 2c5e526f760b6..ab91b36a1aca0 100644 --- a/include/zephyr/sensing/sensing_sensor.h +++ b/include/zephyr/sensing/sensing_sensor.h @@ -378,6 +378,36 @@ extern const struct rtio_iodev_api __sensing_iodev_api; cb_list_ptr); \ SENSING_SENSORS_DEFINE(node, reg_ptr, cb_list_ptr); +/** + * @brief Like SENSOR_DEVICE_INSTANCE() with sensing specifics. + * + * @details Defines a sensor which implements the sensor API. May define an + * element in the sensing sensor iterable section used to enumerate all sensing + * sensors. + * + * @param node The devicetree node identifier. + * @param reg_ptr Pointer to the device's sensing_sensor_register_info. + * @param cb_list_ptr Pointer to sensing callback list. + * @param init_fn Name of the init function of the driver. + * @param pm_device PM device resources reference (NULL if device does not use + * PM). + * @param data_ptr Pointer to the device's private data. + * @param cfg_ptr The address to the structure containing the configuration + * information for this instance of the driver. + * @param level The initialization level. See init.h for details. + * @param api_ptr Provides an initial pointer to the API function struct used + * by the driver. Can be NULL. + */ +#define SENSING_SENSORS_INSTANCE(node, reg_ptr, cb_list_ptr, \ + init_fn, pm_device, \ + data_ptr, cfg_ptr, level, api_ptr) \ + SENSOR_DEVICE_INSTANCE(node, init_fn, pm_device, \ + data_ptr, cfg_ptr, level, api_ptr); \ + SENSING_CONNECTIONS_DEFINE(node, \ + DT_PROP_LEN_OR(node, reporters, 0), \ + cb_list_ptr); \ + SENSING_SENSORS_DEFINE(node, reg_ptr, cb_list_ptr); + /** * @brief Like SENSING_SENSORS_DT_DEFINE() for an instance of a DT_DRV_COMPAT * compatible @@ -389,6 +419,16 @@ extern const struct rtio_iodev_api __sensing_iodev_api; #define SENSING_SENSORS_DT_INST_DEFINE(inst, ...) \ SENSING_SENSORS_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__) +/** + * @brief Like SENSING_SENSORS_INSTANCE() for an instance of a DT_DRV_COMPAT + * compatible + * + * @param inst instance number. This is replaced by + * DT_DRV_COMPAT(inst) in the call to SENSING_SENSORS_INSTANCE(). + * @param ... other parameters as expected by SENSING_SENSORS_INSTANCE(). + */ +#define SENSING_SENSORS_INSTANCE_FROM_DT_INST(inst, ...) \ + SENSING_SENSORS_INSTANCE(DT_DRV_INST(inst), __VA_ARGS__) /** * @brief Get reporter handles of a given sensor instance by sensor type. * diff --git a/include/zephyr/service.h b/include/zephyr/service.h new file mode 100644 index 0000000000000..469e0d872166b --- /dev/null +++ b/include/zephyr/service.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2024 Tomasz Bursztyka + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_SERVICE_H_ +#define ZEPHYR_INCLUDE_SERVICE_H_ + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup service Service instanciation + * @ingroup os_services + * + * Zephyr offers an infrastructure to instanciate software services, that + * can be initialized at boot time, following the levels described in init.h + * + * @{ + */ + +/** + * @brief Register a software service to be initialized only once + * + * @param name A unique name identifying the service (can reuse init_fn) + * @param init_func Service initialization function. + * @param level Default service initialization level. Allowed tokens: `EARLY`, + *`PRE_KERNEL_1`, `PRE_KERNEL_2`, `POST_KERNEL`, `APPLICATION` and `SMP` if + * @kconfig{CONFIG_SMP} is enabled. Which default level can be superceded by a computed + * one (see scripts/gen_init_priorities.py) + */ +#define SERVICE_INSTANCE_INIT_ONCE(name, init_func, level) \ + Z_SERVICE_INSTANCE_INIT_ONCE(name, init_func, \ + ZINIT_GET_LEVEL(name, level), \ + ZINIT_GET_PRIORITY(name, name)) + +/** @cond INTERNAL_HIDDEN */ + +#define Z_SERVICE_INSTANCE_INIT_ONCE(name, init_func, level, prio) \ + static const Z_DECL_ALIGN(struct init_entry) __used __noasan \ + Z_INIT_ENTRY_SECTION(level, prio) \ + Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_func)}, \ + Z_INIT_SYS_INIT_DEV_NULL} + +/** @endcond */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_SERVICE_H_ */ diff --git a/include/zephyr/sys/util_init.h b/include/zephyr/sys/util_init.h new file mode 100644 index 0000000000000..a34dbadda1db5 --- /dev/null +++ b/include/zephyr/sys/util_init.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2024, Tomasz Bursztyka + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_ZEPHYR_SYS_UTIL_INIT_H_ +#define ZEPHYR_INCLUDE_ZEPHYR_SYS_UTIL_INIT_H_ + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif +/** @{ */ + +#define ZINIT_EXISTS(init_id) \ + IS_ENABLED(DT_CAT3(ZINIT_, init_id, _EXISTS)) + +#define ZINIT_EXPLICIT_LEVEL_EXISTS(init_id) \ + IS_ENABLED(DT_CAT3(ZINIT_, init_id, _INIT_EXPLICIT_LEVEL_EXISTS)) + +#define ZINIT_EXPLICIT_LEVEL(init_id) \ + DT_CAT3(ZINIT_, init_id, _INIT_EXPLICIT_LEVEL) + +#define ZINIT_IMPLICIT_LEVEL_EXISTS(init_id) \ + IS_ENABLED(DT_CAT3(ZINIT_, init_id, _INIT_IMPLICIT_LEVEL_EXISTS)) + +#define ZINIT_IMPLICIT_LEVEL(init_id) \ + DT_CAT3(ZINIT_, init_id, _INIT_IMPLICIT_LEVEL) + +#define ZINIT_PRIORITY(init_id) \ + DT_CAT3(ZINIT_, init_id, _INIT_PRIORITY) + +#define ZINIT_GET_PRIORITY(node_id, dev_id) \ + COND_CODE_1(ZINIT_EXISTS(node_id), \ + (ZINIT_PRIORITY(node_id)), \ + (COND_CODE_1(ZINIT_EXISTS(dev_id), \ + (ZINIT_PRIORITY(dev_id)), \ + (0)))) + +/* Helper definition to evaluate level predominance */ +#define ZINIT_LEVEL_PREDOMINANCE_PRE_KERNEL_1_VS_EARLY 1 +#define ZINIT_LEVEL_PREDOMINANCE_PRE_KERNEL_2_VS_EARLY 1 +#define ZINIT_LEVEL_PREDOMINANCE_POST_KERNEL_VS_EARLY 1 +#define ZINIT_LEVEL_PREDOMINANCE_APPLICATION_VS_EARLY 1 +#define ZINIT_LEVEL_PREDOMINANCE_SMP_VS_EARLY 1 + +#define ZINIT_LEVEL_PREDOMINANCE_PRE_KERNEL_2_VS_PRE_KERNEL_1 1 +#define ZINIT_LEVEL_PREDOMINANCE_POST_KERNEL_VS_PRE_KERNEL_1 1 +#define ZINIT_LEVEL_PREDOMINANCE_APPLICATION_VS_PRE_KERNEL_1 1 +#define ZINIT_LEVEL_PREDOMINANCE_SMP_VS_PRE_KERNEL_1 1 + +#define ZINIT_LEVEL_PREDOMINANCE_POST_KERNEL_VS_PRE_KERNEL_2 1 +#define ZINIT_LEVEL_PREDOMINANCE_APPLICATION_VS_PRE_KERNEL_2 1 +#define ZINIT_LEVEL_PREDOMINANCE_SMP_VS_PRE_KERNEL_2 1 + +#define ZINIT_LEVEL_PREDOMINANCE_APPLICATION_VS_POST_KERNEL 1 +#define ZINIT_LEVEL_PREDOMINANCE_SMP_VS_POST_KERNEL 1 + +#define ZINIT_LEVEL_PREDOMINANCE_SMP_VS_APPLICATION 1 + +#define ZINIT_LEVEL_PREDOMINANCE(default_level, level) \ + COND_CODE_1(_CONCAT_4(ZINIT_LEVEL_PREDOMINANCE_, default_level, _, level),\ + (default_level), (level)) + +#define ZINIT_GET_LEVEL(node_id, level) \ + COND_CODE_1(ZINIT_EXISTS(node_id), \ + (COND_CODE_1(ZINIT_EXPLICIT_LEVEL_EXISTS(node_id), \ + (ZINIT_EXPLICIT_LEVEL(node_id)), \ + (COND_CODE_1(ZINIT_IMPLICIT_LEVEL_EXISTS(node_id), \ + (ZINIT_LEVEL_PREDOMINANCE(level, \ + ZINIT_IMPLICIT_LEVEL(node_id))), \ + (level))))), \ + (level)) + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_ZEPHYR_SYS_UTIL_INIT_H_ */ diff --git a/modules/lvgl/input/lvgl_button_input.c b/modules/lvgl/input/lvgl_button_input.c index 9976df48ca77c..cf36c68a71fd5 100644 --- a/modules/lvgl/input/lvgl_button_input.c +++ b/modules/lvgl/input/lvgl_button_input.c @@ -81,8 +81,8 @@ int lvgl_button_input_init(const struct device *dev) .coordinates = lvgl_button_coordinates_##inst, \ }; \ static struct lvgl_common_input_data lvgl_common_input_data_##inst; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &lvgl_common_input_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &lvgl_common_input_data_##inst, \ &lvgl_button_input_config_##inst, POST_KERNEL, \ - CONFIG_INPUT_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(LVGL_BUTTON_INPUT_DEFINE) diff --git a/modules/lvgl/input/lvgl_encoder_input.c b/modules/lvgl/input/lvgl_encoder_input.c index fd32e2b53c091..8a1e45984856a 100644 --- a/modules/lvgl/input/lvgl_encoder_input.c +++ b/modules/lvgl/input/lvgl_encoder_input.c @@ -68,8 +68,8 @@ int lvgl_encoder_input_init(const struct device *dev) .button_input_code = BUTTON_CODE(inst), \ }; \ static struct lvgl_common_input_data lvgl_common_input_data_##inst; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &lvgl_common_input_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &lvgl_common_input_data_##inst, \ &lvgl_encoder_input_config_##inst, POST_KERNEL, \ - CONFIG_INPUT_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(LVGL_ENCODER_INPUT_DEFINE) diff --git a/modules/lvgl/input/lvgl_keypad_input.c b/modules/lvgl/input/lvgl_keypad_input.c index 963784df0965c..5eff77acf3ecb 100644 --- a/modules/lvgl/input/lvgl_keypad_input.c +++ b/modules/lvgl/input/lvgl_keypad_input.c @@ -68,8 +68,8 @@ int lvgl_keypad_input_init(const struct device *dev) .num_codes = DT_INST_PROP_LEN(inst, input_codes), \ }; \ static struct lvgl_common_input_data lvgl_common_input_data_##inst; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &lvgl_common_input_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &lvgl_common_input_data_##inst, \ &lvgl_keypad_input_config_##inst, POST_KERNEL, \ - CONFIG_INPUT_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(LVGL_KEYPAD_INPUT_DEFINE) diff --git a/modules/lvgl/input/lvgl_pointer_input.c b/modules/lvgl/input/lvgl_pointer_input.c index 89f35cd04e26b..641a122332056 100644 --- a/modules/lvgl/input/lvgl_pointer_input.c +++ b/modules/lvgl/input/lvgl_pointer_input.c @@ -142,8 +142,8 @@ int lvgl_pointer_input_init(const struct device *dev) .invert_y = DT_INST_PROP(inst, invert_y), \ }; \ static struct lvgl_pointer_input_data lvgl_pointer_input_data_##inst; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &lvgl_pointer_input_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &lvgl_pointer_input_data_##inst, \ &lvgl_pointer_input_config_##inst, POST_KERNEL, \ - CONFIG_INPUT_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(LVGL_POINTER_INPUT_DEFINE) diff --git a/samples/sensor/sensor_shell/src/fake_sensor.c b/samples/sensor/sensor_shell/src/fake_sensor.c index 2d6df21251a83..24186bbd9dda7 100644 --- a/samples/sensor/sensor_shell/src/fake_sensor.c +++ b/samples/sensor/sensor_shell/src/fake_sensor.c @@ -90,7 +90,7 @@ static const struct sensor_driver_api api = { }; #define VND_SENSOR_INIT(n) \ - SENSOR_DEVICE_DT_INST_DEFINE(n, init, NULL, NULL, NULL, POST_KERNEL, \ - CONFIG_SENSOR_INIT_PRIORITY, &api); + SENSOR_DEVICE_INSTANCE_FROM_DT_INST(n, init, NULL, NULL, NULL, POST_KERNEL, \ + &api); DT_INST_FOREACH_STATUS_OKAY(VND_SENSOR_INIT) diff --git a/samples/subsys/pm/device_pm/service_and_device_init.yaml b/samples/subsys/pm/device_pm/service_and_device_init.yaml new file mode 100644 index 0000000000000..e478e43da5c3c --- /dev/null +++ b/samples/subsys/pm/device_pm/service_and_device_init.yaml @@ -0,0 +1,9 @@ +# Copyright (c) 2024, Tomasz Bursztyka +# +# SPDX-License-Identifier: Apache-2.0 + +device: + dummy_driver: + init: + dependencies: + - dummy_parent diff --git a/samples/subsys/pm/device_pm/src/dummy_driver.c b/samples/subsys/pm/device_pm/src/dummy_driver.c index ffc4decb1eb7b..25a0e14ed0a99 100644 --- a/samples/subsys/pm/device_pm/src/dummy_driver.c +++ b/samples/subsys/pm/device_pm/src/dummy_driver.c @@ -114,6 +114,6 @@ int dummy_init(const struct device *dev) PM_DEVICE_DEFINE(dummy_driver, dummy_device_pm_action); -DEVICE_DEFINE(dummy_driver, DUMMY_DRIVER_NAME, &dummy_init, +DEVICE_INSTANCE(dummy_driver, &dummy_init, PM_DEVICE_GET(dummy_driver), NULL, NULL, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &funcs); + &funcs); diff --git a/samples/subsys/pm/device_pm/src/dummy_parent.c b/samples/subsys/pm/device_pm/src/dummy_parent.c index 456ca8e155b40..5b3844a562590 100644 --- a/samples/subsys/pm/device_pm/src/dummy_parent.c +++ b/samples/subsys/pm/device_pm/src/dummy_parent.c @@ -51,6 +51,6 @@ int dummy_parent_init(const struct device *dev) PM_DEVICE_DEFINE(dummy_parent, dummy_parent_pm_action); -DEVICE_DEFINE(dummy_parent, DUMMY_PARENT_NAME, &dummy_parent_init, +DEVICE_INSTANCE(dummy_parent, &dummy_parent_init, PM_DEVICE_GET(dummy_parent), NULL, NULL, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &funcs); + &funcs); diff --git a/samples/subsys/pm/latency/src/test.c b/samples/subsys/pm/latency/src/test.c index bf94c9c1bf87e..664bcf382e1cd 100644 --- a/samples/subsys/pm/latency/src/test.c +++ b/samples/subsys/pm/latency/src/test.c @@ -59,5 +59,5 @@ int dev_test_init(const struct device *dev) static struct dev_test_data data; -DEVICE_DEFINE(dev_test, "dev_test", &dev_test_init, NULL, &data, NULL, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &dev_test_api); +DEVICE_INSTANCE(dev_test, &dev_test_init, NULL, &data, NULL, + POST_KERNEL, &dev_test_api); diff --git a/samples/subsys/rtio/sensor_batch_processing/src/vnd_sensor.c b/samples/subsys/rtio/sensor_batch_processing/src/vnd_sensor.c index 97fd39f4d1fc8..510ae952a3c73 100644 --- a/samples/subsys/rtio/sensor_batch_processing/src/vnd_sensor.c +++ b/samples/subsys/rtio/sensor_batch_processing/src/vnd_sensor.c @@ -145,8 +145,8 @@ static const struct rtio_iodev_api vnd_sensor_iodev_api = { }, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, vnd_sensor_init, NULL, &vnd_sensor_data_##n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, vnd_sensor_init, NULL, &vnd_sensor_data_##n, \ &vnd_sensor_config_##n, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(VND_SENSOR_INIT) diff --git a/samples/subsys/shell/shell_module/boards/qemu_x86_64.conf b/samples/subsys/shell/shell_module/boards/qemu_x86_64.conf new file mode 100644 index 0000000000000..33694f5ea3820 --- /dev/null +++ b/samples/subsys/shell/shell_module/boards/qemu_x86_64.conf @@ -0,0 +1,5 @@ +CONFIG_PCIE=y +CONFIG_PCIE_SHELL=y +CONFIG_ACPI=y +CONFIG_ACPI_SHELL=y +CONFIG_EARLY_CONSOLE=y \ No newline at end of file diff --git a/samples/userspace/prod_consumer/src/sample_driver.h b/samples/userspace/prod_consumer/src/sample_driver.h index 88329313434aa..8c100985ed9bf 100644 --- a/samples/userspace/prod_consumer/src/sample_driver.h +++ b/samples/userspace/prod_consumer/src/sample_driver.h @@ -9,7 +9,7 @@ #include -#define SAMPLE_DRIVER_NAME_0 "SAMPLE_DRIVER_0" +#define SAMPLE_DRIVER_NAME_0 "sample_driver_foo_0" #define SAMPLE_DRIVER_MSG_SIZE 128 typedef void (*sample_driver_callback_t)(const struct device *dev, diff --git a/samples/userspace/prod_consumer/src/sample_driver_foo.c b/samples/userspace/prod_consumer/src/sample_driver_foo.c index 929ff6c1e007a..dc5e03f351c43 100644 --- a/samples/userspace/prod_consumer/src/sample_driver_foo.c +++ b/samples/userspace/prod_consumer/src/sample_driver_foo.c @@ -108,8 +108,6 @@ static int sample_driver_foo_init(const struct device *dev) static struct sample_driver_foo_dev_data sample_driver_foo_dev_data_0; -DEVICE_DEFINE(sample_driver_foo_0, SAMPLE_DRIVER_NAME_0, - &sample_driver_foo_init, NULL, +DEVICE_INSTANCE(sample_driver_foo_0, &sample_driver_foo_init, NULL, &sample_driver_foo_dev_data_0, NULL, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &sample_driver_foo_api); + POST_KERNEL, &sample_driver_foo_api); diff --git a/scripts/dts/python-devicetree/src/devicetree/edtlib.py b/scripts/dts/python-devicetree/src/devicetree/edtlib.py index 30c936b373360..4832b92180930 100644 --- a/scripts/dts/python-devicetree/src/devicetree/edtlib.py +++ b/scripts/dts/python-devicetree/src/devicetree/edtlib.py @@ -1896,6 +1896,13 @@ class EDT: /chosen node which can't be converted to a Node are not included in the value. + aliases_nodes: + A dict that maps the properties defined on the devicetree's /aliases + node to their values. 'aliases' is indexed by property name (a string), + and values are converted to Node objects. Note that properties of the + /aliases node which can't be converted to a Node are not included in + the value. + dts_path: The .dts path passed to __init__() @@ -2061,6 +2068,33 @@ def chosen_node(self, name: str) -> Optional[Node]: """ return self.chosen_nodes.get(name) + @property + def aliases_nodes(self) -> Dict[str, Node]: + ret: Dict[str, Node] = {} + + try: + aliases = self._dt.get_node("/aliases") + except DTError: + return ret + + for name, prop in aliases.props.items(): + try: + node = prop.to_path() + except DTError: + # DTS value is not phandle or string, or path doesn't exist + continue + + ret[name] = self._node2enode[node] + + return ret + + def aliases_node(self, name: str) -> Optional[Node]: + """ + Returns the Node pointed at by the property named 'name' in /aliases, or + None if the property is missing + """ + return self.aliases_nodes.get(name) + @property def dts_source(self) -> str: return f"{self._dt}" diff --git a/scripts/gen_init_priorities/gen_init_priorities.py b/scripts/gen_init_priorities/gen_init_priorities.py new file mode 100644 index 0000000000000..5ccb9a36e00cf --- /dev/null +++ b/scripts/gen_init_priorities/gen_init_priorities.py @@ -0,0 +1,626 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2024, Tomasz Bursztyka +# +# SPDX-License-Identifier: Apache-2.0 + +import os +import re +import sys +import pickle +import argparse +import fileinput +import pykwalify.core +from pathlib import Path + +import yaml +try: + # Use the C LibYAML parser if available, rather than the Python parser. + from yaml import CSafeLoader as SafeLoader +except ImportError: + from yaml import SafeLoader # type: ignore + +# We will need to access edtlib +sys.path.insert(0, os.path.join(os.path.dirname(__file__), + '..', 'dts', 'python-devicetree', 'src')) + +from devicetree.grutils import Graph +from devicetree import edtlib + +LEVELS = """ +EARLY: + fake: true + rank: 0 + +PRE_KERNEL_1: + fake: true + rank: 1 + dependencies: + - EARLY + +PRE_KERNEL_2: + fake: true + rank: 2 + dependencies: + - PRE_KERNEL_1 + +POST_KERNEL: + fake: true + rank: 3 + dependencies: + - PRE_KERNEL_2 + +APPLICATION: + fake: true + rank: 4 + dependencies: + - POST_KERNEL + +SMP: + fake: true + rank: 5 + dependencies: + - APPLICATION +""" + +# Q&D debug enabler +global debug +debug = False + +# Zephyr Init Node +class ZInitNode: + def __init__(self, name, node = None): + self.name = name + self.fake = False + self.rank = -1 # used only on fake nodes (aka: actual level nodes) + self.level = None + self.explicit_level = False + self.hard_dependencies = [] + + # compat properties for Graph, as it is supposed to work with edt nodes + self.parent = None + self.unit_addr = None + self.dep_ordinal = -1 + + self.node = node + if node is not None: + # Let's fill in the compat properties relevantly then + self.parent = node.parent + self.unit_addr = node.unit_addr + + def __str__(self): + if self.fake: + return self.name + + s = f"ZInitNode({self.name} {self.dep_ordinal})" + if self.node is not None: + s += f" ({self.node.name})" + + return s + + def set_level(self, level): + self.level = level + self.explicit_level = True + + def add_hard_dependency(self, node): + self.hard_dependencies.append(node) + + def set_implicit_level(self, depth, bottom): + if (self.rank == 0 or + (self.level is not None and self.explicit_level)): + return + + impl_level = None + for node in self.hard_dependencies: + if node.level is None: + if depth == bottom: + raise Exception(f"Check arrived at maximum depth") + node.set_implicit_level(depth+1, bottom) + + if impl_level is None: + if node.fake: + impl_level = node + else: + impl_level = node.level + elif (node.level is not None and + node.level.rank > impl_level.rank): + impl_level = node.level + + if impl_level is not None and not self.fake and debug: + print(f"-> Setting implicit level {impl_level} on {self}") + + self.level = impl_level + + def _get_define(self): + if self.node is not None: + basename = f"DT_{self.node.z_path_id}" + else: + basename = self.name.replace('@', '_').replace('-', '_') + + return f"#define ZINIT_{basename}_" + + def _get_level_macros(self): + if self.level is None: + return None + + implicit = 'IMPLICIT' + if self.explicit_level: + implicit = 'EXPLICIT' + + level_str = f"{self._get_define()}INIT_{implicit}_LEVEL_EXISTS 1\n" + level_str += f"{self._get_define()}INIT_{implicit}_LEVEL {self.level}" + + return level_str + + def _get_priority_macro(self): + return f"{self._get_define()}INIT_PRIORITY {self.dep_ordinal}" + + def write_macros(self, header): + if self.fake: + return + + if self.node is not None: + name = self.node.name + path = self.node.path + else: + name = self.name + path = None + + header.write(f"/** Zephyr Init Node: {name} ") + if path is not None: + header.write(f"\n * DTS object path: {path}\n ") + header.write("*/\n") + + header.write(f"{self._get_define()}EXISTS 1\n") + + level = self._get_level_macros() + if level is not None: + header.write(f"{level}\n") + + header.write(f"{self._get_priority_macro()}\n\n") + +# ToDo: Move this out of gen_defines.py and make it into edt directly +# node's z_path_id are useful in both gen_defines.py, +# so let's generate it once. +def str2ident(s: str) -> str: + # Converts 's' to a form suitable for (part of) an identifier + + return re.sub('[-,.@/+]', '_', s.lower()) + +def node_z_path_id(node: edtlib.Node) -> str: + # Return the node specific bit of the node's path identifier: + # + # - the root node's path "/" has path identifier "N" + # - "/foo" has "N_S_foo" + # - "/foo/bar" has "N_S_foo_S_bar" + # - "/foo/bar@123" has "N_S_foo_S_bar_123" + # + # This is used throughout this file to generate macros related to + # the node. + + components = ["N"] + if node.parent is not None: + components.extend(f"S_{str2ident(component)}" for component in + node.path.split("/")[1:]) + + return "_".join(components) + +class EDTNodeMatcher: + def __init__(self, edt_file): + self.names = {} + self.paths = {} + self.yaml_nodes = {} + self.macro_viability_rule = re.compile('[0-9a-zA-Z_]*') + + self.__load(edt_file) + + def __is_excluded(self, name): + return name in [ '/', 'aliases', 'chosen' ] + + def __load(self, edt_file): + with open(edt_file, 'rb') as f: + self.edt = pickle.load(f) + + for node_list in self.edt.scc_order: + for node in node_list: + if self.__is_excluded(node.name): + continue + + self.add(node) + self.yaml_nodes[node.path] = {} + + deps = [] + for d_node in self.edt._graph.depends_on(node): + if self.__is_excluded(d_node.name): + continue + deps.append(d_node.path) + + if len(deps) > 0: + self.yaml_nodes[node.path]['dependencies'] = deps + + # This should be done at EDT object instanciation and not in gen_defines.py + # as we need this info here as well. See above. + sorted_nodes = sorted(self.edt.nodes, key=lambda node: node.dep_ordinal) + for node in sorted_nodes: + node.z_path_id = node_z_path_id(node) + + def as_yaml_nodes(self): + return self.yaml_nodes + + def get_real_name(self, name): + chosen = self.edt.chosen_node(name) + if chosen is not None: + return chosen.path, True + + alias = self.edt.aliases_node(name) + if alias is not None: + return alias.path, True + + if name in self.edt.label2node: + return self.edt.label2node[name].path, False + + if name in self.edt.compat2nodes: + return None, True + + node = self.get(name) + if node is None: + return name, False + + return node.path, False + + def add(self, node): + if node.path in self.paths: + return + + if node.name not in self.names: + self.names[node.name] = [] + + self.names[node.name].append(node) + self.paths[node.path] = node + + def get(self, desc): + if desc in self.names: + if len(self.names[desc]) > 1: + raise Exception(f"Name {desc} leads to multiple nodes") + return self.names[desc][0] + + if desc in self.paths: + return self.paths[desc] + + # ToDo: desc could be a truncated path, if needed + + return None + + def check_viability(self, name=None, names=None): + if name is not None: + names = [] + names.append(name) + + results = [] + for n in names: + rn, alias = self.get_real_name(n) + if (n == rn and self.get(n) is None and + self.macro_viability_rule.fullmatch(n) is None): + if debug: + print(f"-> Skipping {n}: not EDT-based nor macro viable") + continue + + if rn is None and alias is True: + compats = self.edt.compat2nodes[n] + for node in compats: + results.append(node.path) + else: + results.append(rn) + + if len(results) == 0: + return None + + return results + + +class InitGraph(Graph): + def __init__(self): + super(InitGraph, self).__init__() + + self.zinit_nodes = {} + + @property + def nodes_count(self) -> int: + return len(self.zinit_nodes) + + def populate(self, edt_nodes, yaml_nodes): + for yn_name in list(yaml_nodes): + z_n, alias = edt_nodes.get_real_name(yn_name) + if z_n not in self.zinit_nodes: + zinit_node = ZInitNode(z_n, node = edt_nodes.get(z_n)) + self.zinit_nodes[z_n] = zinit_node + else: + zinit_node = self.zinit_nodes[z_n] + + ynode = yaml_nodes[yn_name] + if ynode is None and not alias: + self.add_node(zinit_node) + continue + + if 'level' in ynode: + if ynode['level'] not in self.zinit_nodes: + raise Exception("No such level as "+ynode['level']) + zinit_node.set_level(zinit_nodes[ynode['level']]) + + if 'fake' in ynode: + zinit_node.fake = ynode['fake'] + zinit_node.rank = ynode['rank'] # rank has to be provided + + if 'dependencies' in ynode: + for d in ynode['dependencies']: + d_n, _ = edt_nodes.get_real_name(d) + if d_n not in self.zinit_nodes: + dnode = ZInitNode(d_n, node = edt_nodes.get(d_n)) + self.zinit_nodes[d_n] = dnode + else: + dnode = self.zinit_nodes[d_n] + + zinit_node.add_hard_dependency(dnode) + self.add_edge(zinit_node, dnode) + else: + self.add_node(zinit_node) + + # Updating edges depending on levels + for zn in self.zinit_nodes: + zinit_node = self.zinit_nodes[zn] + if not zinit_node.explicit_level: + zinit_node.set_implicit_level(1, self.nodes_count) + if zinit_node.level is not None: + self.add_edge(zinit_node, zinit_node.level) + + def verify_detected_loops(self): + found = [] + for ns in self.zinit_nodes: + node = self.zinit_nodes[ns] + if not node.fake and node.dep_ordinal == -1: + found.append(node) + + if len(found) > 0: + s = "" + for nf in found: + s.join(f"{nf} ") + + raise Exception(f"Dependency loop detected around: {s}") + + def verify_level_sanity(self): + def _level_check(node, level, depth, bottom): + for hd_node in node.hard_dependencies: + if (hd_node.level is not None and level.rank < hd_node.level.rank): + return hd_node + + if depth == bottom: + raise Exception("Check arrived at maximum depth") + + return _level_check(hd_node, level, depth+1, bottom) + + return None + + found = [] + for ns in self.zinit_nodes: + node = self.zinit_nodes[ns] + if node.level is None: + continue + + hd_node = _level_check(node, node.level, 0, self.nodes_count) + if hd_node is not None: + found.append([node, hd_node]) + + if len(found) > 0: + s = "" + for nf in found: + s += f"{nf[0]} is on an earlier level than " + s += f"{nf[1]} but requires the later\n" + + raise Exception(f"Level sanity broken: {s}") + + def generate_header_file(self, header): + with open(header, "w") as hf: + hf.write("/*\n * Generated by gen_init_priorities.py\n */\n\n") + + for l in self.scc_order(): + for n in l: + n.write_macros(hf) + + def output(self): + if not debug: + return + print("\nFinal initialization graph:") + for l in self.scc_order(): + for n in l: + print(f" {n}") + print("") + + +def load_dotconfig(dotconfig_file): + dotconfig = [] + with fileinput.input(files=(dotconfig_file), encoding="utf-8") as dcf: + for line in dcf: + if len(line) < 8 or line[0] == '#': + continue + + opt, val = line.split('=', 1) + val = val.strip('\r\n ') + if val != 'y': + continue + + dotconfig.append(opt) + + return dotconfig + +def _yaml_init_obj_iterator(nodes): + for sd in nodes: + obj = nodes[sd] + for sd_name in obj: + if 'init' in obj[sd_name]: + yield sd_name, obj[sd_name]['init'] + else: + yield sd_name, {} + +def update_from_yaml(yaml_nodes, updates, dotcfg, edt_nodes): + if updates is None or ('service' not in updates and + 'device' not in updates): + return yaml_nodes + + for un, ui in _yaml_init_obj_iterator(updates): + yn_l = edt_nodes.check_viability(name=un) + if yn_l is None: + continue + + for yn in yn_l: + if yn not in yaml_nodes.keys(): + yaml_nodes[yn] = {} + + if 'level' in ui: + yaml_nodes[yn]['level'] = ui['level'] + + if 'dependencies' in ui: + n_l = ui['dependencies'] + deps = edt_nodes.check_viability(names=n_l) + if deps is not None: + if 'dependencies' in yaml_nodes[yn]: + yaml_nodes[yn]['dependencies'] += deps + else: + yaml_nodes[yn]['dependencies'] = deps + + if 'if' in ui and 'then' in ui: + cond = ui['if'] + if cond not in dotcfg: + continue + + stmt = ui['then'] + if 'level' in stmt: + yaml_nodes[yn]['level'] = stmt['level'] + if 'dependencies' in stmt: + n_l = stmt['dependencies'] + deps = edt_nodes.check_viability(names=n_l) + if deps is not None: + yaml_nodes[yn]['dependencies'] = deps + + return yaml_nodes + +def print_yaml_nodes(yaml_nodes): + if not debug: + return + print("\n# YAML nodes :") + print("init:") + for yn in list(yaml_nodes): + print(f" {yn}:") + ynode = yaml_nodes[yn] + if 'fake' in ynode: + print(f" fake: true") + print(f" rank: {ynode['rank']}") + if 'level' in ynode: + print(f" level: {ynode['level']}") + if 'dependencies' in ynode: + print(f" dependencies:") + for elt in ynode['dependencies']: + print(f" - {elt}") + print("") + +def print_edt_nodes(edt_nodes): + if not debug: + return + print("EDT original graph:") + for l in edt_nodes.edt.scc_order: + for n in l: + print(f" {n.name} -> {n.path}") + print("") + +def generate_init_priorities(args): + global debug + debug = args.debug + + # 1 - Loading the generated .config + dotconfig = load_dotconfig(args.dotconfig_file) + + # 2 - Loading levels, to act as fake nodes + yaml_nodes = yaml.safe_load(LEVELS) + + # 3a - Loading EDT DTS nodes (pair of name/path leading to node) + edt_nodes = EDTNodeMatcher(args.edt_pickle) + print_edt_nodes(edt_nodes) + + # 3b - Integrating EDT as yaml nodes + yaml_nodes.update(edt_nodes.as_yaml_nodes()) + + # 4 - Now loading any extra yaml nodes, and integrating them relevantly + for i_p in args.init_files: + print(f'Loading {i_p}') + with open(i_p, 'r', encoding="utf-8") as i_f: + yaml_nodes = update_from_yaml(yaml_nodes, + yaml.load(i_f, SafeLoader), + dotconfig, + edt_nodes) + print_yaml_nodes(yaml_nodes) + + # 5 - Generating dependency graph from the yaml_nodes + graph = InitGraph() + graph.populate(edt_nodes, yaml_nodes) + graph.scc_order() + graph.output() + + # 6 - Sanity check + graph.verify_detected_loops() + graph.verify_level_sanity() + + # 7 - Finally, as all went well, let's generate the header + graph.generate_header_file(args.header_out) + +def load_schemas(): + schemas = {} + p = Path(os.path.abspath(os.path.dirname(__file__))) + for sch_p in sorted(p.glob('*.yaml')): + sch_n = Path(sch_p).stem + if sch_n in schemas: + raise Exception(f"Duplicate schema file name {sch_n}") + + with open(sch_p, 'r', encoding='utf-8') as sch_f: + schemas[sch_n] = yaml.load(sch_f, SafeLoader) + + return schemas + +def validate_input(init_files): + schemas = load_schemas() + if len(schemas) == 0: + return + + for i_p in init_files: + with open(i_p, 'r', encoding="utf-8") as i_f: + try: + content = yaml.load(i_f, SafeLoader) + for sch in schemas: + pykwalify.core.Core(source_data=content, + schema_data=schemas[sch]).validate() + except (yaml.YAMLError, pykwalify.errors.SchemaError) as e: + sys.exit(f"ERROR: malformed service file {i_p}") + +def main(): + parser = argparse.ArgumentParser(allow_abbrev=False) + + parser.add_argument('--debug', action='store_true', + help='Print debug messages') + parser.add_argument('--validate', action='store_true', + help='Validate the input files prior to using them') + parser.add_argument('--init-files', nargs='+', default=[], + help='Init description files to load (services and/or devices)') + parser.add_argument("--dotconfig-file", required=True, + help="Path to the general .config file") + parser.add_argument("--edt-pickle", required=True, + help="Path to the pickled edtlib.EDT object file") + parser.add_argument("--header-out", required=True, + help="Path to write generated header to") + + args = parser.parse_args() + + if args.validate: + validate_input(args.init_files) + + generate_init_priorities(args) + +if __name__ == "__main__": + main() diff --git a/scripts/gen_init_priorities/zephyr_service_schema.yaml b/scripts/gen_init_priorities/zephyr_service_schema.yaml new file mode 100644 index 0000000000000..be805d9b49d5e --- /dev/null +++ b/scripts/gen_init_priorities/zephyr_service_schema.yaml @@ -0,0 +1,70 @@ +# Schema file for service object in YAML +# +# Copyright (c) 2024, Tomasz Bursztyka +# +# SPDX-License-Identifier: Apache-2.0 + +type: map +mapping: + "service": + type: map + mapping: + =: + type: map + mapping: + "init": + required: False + type: map + mapping: + "level": + type: str + enum: ['EARLY', 'PRE_KERNEL_1', 'PRE_KERNEL_2', + 'POST_KERNEL', 'APPLICATION', 'SMP'] + required: False + + "dependencies": + type: seq + seq: + - type: str + required: False + + "if": + type: str + required: False + "then": + required: False + type: map + mapping: + "level": + type: str + enum: ['EARLY', 'PRE_KERNEL_1', 'PRE_KERNEL_2', + 'POST_KERNEL', 'APPLICATION', 'SMP'] + required: False + + "dependencies": + type: seq + seq: + - type: str + required: False + + "device": + type: map + mapping: + =: + type: map + mapping: + "init": + required: False + type: map + mapping: + "level": + type: str + enum: ['EARLY', 'PRE_KERNEL_1', 'PRE_KERNEL_2', + 'POST_KERNEL', 'APPLICATION', 'SMP'] + required: False + + "dependencies": + type: seq + seq: + - type: str + required: False diff --git a/soc/intel/intel_adsp/common/mem_window.c b/soc/intel/intel_adsp/common/mem_window.c index ae5abcb77bf79..bbc1778038d07 100644 --- a/soc/intel/intel_adsp/common/mem_window.c +++ b/soc/intel/intel_adsp/common/mem_window.c @@ -54,9 +54,9 @@ void mem_window_idle_exit(void) .mem_base = DT_REG_ADDR(DT_PHANDLE(MEM_WINDOW_NODE(n), memory)) + WIN_OFFSET(n), \ .initialize = DT_PROP(MEM_WINDOW_NODE(n), initialize), \ }; \ - DEVICE_DT_DEFINE(MEM_WINDOW_NODE(n), mem_win_init, NULL, NULL, \ + DEVICE_INSTANCE(MEM_WINDOW_NODE(n), mem_win_init, NULL, NULL, \ &mem_win_config_##n, PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); + NULL); #if DT_NODE_HAS_STATUS_OKAY(MEM_WINDOW_NODE(0)) MEM_WINDOW_DEFINE(0) diff --git a/soc/ite/ec/it8xxx2/ilm.c b/soc/ite/ec/it8xxx2/ilm.c index f586e38dd4574..0fdb93f9b04c6 100644 --- a/soc/ite/ec/it8xxx2/ilm.c +++ b/soc/ite/ec/it8xxx2/ilm.c @@ -208,4 +208,4 @@ static const struct ilm_config ilm_config = { BUILD_ASSERT(ARRAY_SIZE(ilm_config.scar_regs) * ILM_BLOCK_SIZE == KB(CONFIG_ILM_MAX_SIZE), "Wrong number of SCAR registers defined for RAM size"); -DEVICE_DT_DEFINE(ILM_NODE, &it8xxx2_ilm_init, NULL, NULL, &ilm_config, PRE_KERNEL_1, 0, NULL); +DEVICE_INSTANCE(ILM_NODE, &it8xxx2_ilm_init, NULL, NULL, &ilm_config, PRE_KERNEL_1, NULL); diff --git a/soc/mediatek/mtk_adsp/mbox.c b/soc/mediatek/mtk_adsp/mbox.c index e2906b8fa29d4..fcd07d2d8be9c 100644 --- a/soc/mediatek/mtk_adsp/mbox.c +++ b/soc/mediatek/mtk_adsp/mbox.c @@ -124,7 +124,7 @@ SYS_INIT(mbox_init, POST_KERNEL, 0); static struct mbox_data dev_data##N; \ static const struct mbox_cfg dev_cfg##N = \ { .irq = DT_INST_IRQN(N), .mbox = (void *)DT_INST_REG_ADDR(N), }; \ - DEVICE_DT_INST_DEFINE(N, NULL, NULL, &dev_data##N, &dev_cfg##N, \ - POST_KERNEL, 0, NULL); + DEVICE_INSTANCE_FROM_DT_INST(N, NULL, NULL, &dev_data##N, &dev_cfg##N,\ + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(DEF_DEV) diff --git a/soc/nxp/s32/common/mc_rgm.c b/soc/nxp/s32/common/mc_rgm.c index d7ada34d6ecc5..96f647381ac00 100644 --- a/soc/nxp/s32/common/mc_rgm.c +++ b/soc/nxp/s32/common/mc_rgm.c @@ -119,4 +119,4 @@ static int mc_rgm_init(const struct device *dev) return err; } -DEVICE_DT_INST_DEFINE(0, mc_rgm_init, NULL, NULL, 0, PRE_KERNEL_1, 1, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, mc_rgm_init, NULL, NULL, 0, PRE_KERNEL_1, NULL); diff --git a/soc/nxp/s32/s32k3/pmc.c b/soc/nxp/s32/s32k3/pmc.c index 28933d97e74f0..2bc08e4c0a654 100644 --- a/soc/nxp/s32/s32k3/pmc.c +++ b/soc/nxp/s32/s32k3/pmc.c @@ -133,4 +133,4 @@ static int pmc_init(const struct device *dev) return 0; } -DEVICE_DT_INST_DEFINE(0, pmc_init, NULL, NULL, 0, PRE_KERNEL_1, 1, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, pmc_init, NULL, NULL, 0, PRE_KERNEL_1, NULL); diff --git a/soc/st/stm32/common/stm32_backup_sram.c b/soc/st/stm32/common/stm32_backup_sram.c index 9ba6b36ff163a..b4f6e4c6ca16d 100644 --- a/soc/st/stm32/common/stm32_backup_sram.c +++ b/soc/st/stm32/common/stm32_backup_sram.c @@ -58,5 +58,5 @@ static const struct stm32_backup_sram_config config = { .enr = DT_INST_CLOCKS_CELL(0, bits) }, }; -DEVICE_DT_INST_DEFINE(0, stm32_backup_sram_init, NULL, NULL, &config, - POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, stm32_backup_sram_init, NULL, NULL, &config, + POST_KERNEL, NULL); diff --git a/subsys/bluetooth/controller/coex/coex_ticker.c b/subsys/bluetooth/controller/coex/coex_ticker.c index be349622ecd68..b6465deeba941 100644 --- a/subsys/bluetooth/controller/coex/coex_ticker.c +++ b/subsys/bluetooth/controller/coex/coex_ticker.c @@ -202,5 +202,5 @@ static struct coex_ticker_config config = { }; static struct coex_ticker_data data; -DEVICE_DT_INST_DEFINE(0, &coex_ticker_init, NULL, &data, &config, - POST_KERNEL, 90, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, &coex_ticker_init, NULL, &data, &config, + POST_KERNEL, NULL); diff --git a/subsys/bluetooth/controller/hci/hci_driver.c b/subsys/bluetooth/controller/hci/hci_driver.c index aa2bdb0c20c43..1311b58d37361 100644 --- a/subsys/bluetooth/controller/hci/hci_driver.c +++ b/subsys/bluetooth/controller/hci/hci_driver.c @@ -908,8 +908,8 @@ static const struct bt_hci_driver_api hci_driver_api = { #define BT_HCI_CONTROLLER_INIT(inst) \ static struct hci_driver_data data_##inst; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &data_##inst, NULL, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &hci_driver_api) + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &data_##inst, NULL, POST_KERNEL,\ + &hci_driver_api) /* Only a single instance is supported */ BT_HCI_CONTROLLER_INIT(0) diff --git a/subsys/input/input_double_tap.c b/subsys/input/input_double_tap.c index 1928393a63784..0029074239722 100644 --- a/subsys/input/input_double_tap.c +++ b/subsys/input/input_double_tap.c @@ -119,7 +119,7 @@ static int double_tap_init(const struct device *dev) .double_tap_delay_ms = DT_INST_PROP(inst, double_tap_delay_ms), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, double_tap_init, NULL, NULL, &double_tap_config_##inst, \ - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL); + DEVICE_INSTANCE_FROM_DT_INST(inst, double_tap_init, NULL, NULL, &double_tap_config_##inst, \ + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(INPUT_DOUBLE_TAP_DEFINE) diff --git a/subsys/input/input_keymap.c b/subsys/input/input_keymap.c index 9e98fd5f5148b..91e96eab3b0df 100644 --- a/subsys/input/input_keymap.c +++ b/subsys/input/input_keymap.c @@ -118,8 +118,8 @@ static int keymap_init(const struct device *dev) \ static struct keymap_data keymap_data_##inst; \ \ - DEVICE_DT_INST_DEFINE(inst, keymap_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, keymap_init, NULL, \ &keymap_data_##inst, &keymap_config_##inst, \ - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL); + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(INPUT_KEYMAP_DEFINE) diff --git a/subsys/input/input_longpress.c b/subsys/input/input_longpress.c index bcb8768fd2121..eeaebd87c2dea 100644 --- a/subsys/input/input_longpress.c +++ b/subsys/input/input_longpress.c @@ -136,8 +136,8 @@ static int longpress_init(const struct device *dev) .long_delays_ms = DT_INST_PROP(inst, long_delay_ms), \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, longpress_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, longpress_init, NULL, \ NULL, &longpress_config_##inst, \ - POST_KERNEL, CONFIG_INPUT_INIT_PRIORITY, NULL); + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(INPUT_LONGPRESS_DEFINE) diff --git a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c index 7e985aa76deb0..15676fd14712f 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icbmsg.c +++ b/subsys/ipc/ipc_service/backends/ipc_icbmsg.c @@ -1450,13 +1450,12 @@ const static struct ipc_service_backend backend_ops = { "RX region is too small for provided number of blocks"); \ BUILD_ASSERT(DT_INST_PROP(i, rx_blocks) <= 256, "Too many RX blocks"); \ BUILD_ASSERT(DT_INST_PROP(i, tx_blocks) <= 256, "Too many TX blocks"); \ - DEVICE_DT_INST_DEFINE(i, \ + DEVICE_INSTANCE_FROM_DT_INST(i, \ &backend_init, \ NULL, \ &backend_data_##i, \ &backend_config_##i, \ POST_KERNEL, \ - CONFIG_IPC_SERVICE_REG_BACKEND_PRIORITY, \ &backend_ops); DT_INST_FOREACH_STATUS_OKAY(DEFINE_BACKEND_DEVICE) diff --git a/subsys/ipc/ipc_service/backends/ipc_icmsg.c b/subsys/ipc/ipc_service/backends/ipc_icmsg.c index 40cc06b8a6ff9..c063dda31ce4c 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icmsg.c +++ b/subsys/ipc/ipc_service/backends/ipc_icmsg.c @@ -74,13 +74,12 @@ static int backend_init(const struct device *instance) .rx_pb = &rx_pb_##i, \ }; \ \ - DEVICE_DT_INST_DEFINE(i, \ + DEVICE_INSTANCE_FROM_DT_INST(i, \ &backend_init, \ NULL, \ &backend_data_##i, \ &backend_config_##i, \ POST_KERNEL, \ - CONFIG_IPC_SERVICE_REG_BACKEND_PRIORITY, \ &backend_ops); DT_INST_FOREACH_STATUS_OKAY(DEFINE_BACKEND_DEVICE) diff --git a/subsys/ipc/ipc_service/backends/ipc_icmsg_me_follower.c b/subsys/ipc/ipc_service/backends/ipc_icmsg_me_follower.c index cc374b31f57d6..75f2ed8174664 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icmsg_me_follower.c +++ b/subsys/ipc/ipc_service/backends/ipc_icmsg_me_follower.c @@ -300,13 +300,12 @@ static int backend_init(const struct device *instance) } \ }; \ \ - DEVICE_DT_INST_DEFINE(i, \ + DEVICE_INSTANCE_FROM_DT_INST(i, \ &backend_init, \ NULL, \ &backend_data_##i, \ &backend_config_##i, \ POST_KERNEL, \ - CONFIG_IPC_SERVICE_REG_BACKEND_PRIORITY, \ &backend_ops); DT_INST_FOREACH_STATUS_OKAY(DEFINE_BACKEND_DEVICE) diff --git a/subsys/ipc/ipc_service/backends/ipc_icmsg_me_initiator.c b/subsys/ipc/ipc_service/backends/ipc_icmsg_me_initiator.c index 28170f909ece4..9b9836e579975 100644 --- a/subsys/ipc/ipc_service/backends/ipc_icmsg_me_initiator.c +++ b/subsys/ipc/ipc_service/backends/ipc_icmsg_me_initiator.c @@ -206,13 +206,12 @@ static int backend_init(const struct device *instance) } \ }; \ \ - DEVICE_DT_INST_DEFINE(i, \ + DEVICE_INSTANCE_FROM_DT_INST(i, \ &backend_init, \ NULL, \ &backend_data_##i, \ &backend_config_##i, \ POST_KERNEL, \ - CONFIG_IPC_SERVICE_REG_BACKEND_PRIORITY, \ &backend_ops); DT_INST_FOREACH_STATUS_OKAY(DEFINE_BACKEND_DEVICE) diff --git a/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c b/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c index 19955f065b3b2..3a6865b46d58a 100644 --- a/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c +++ b/subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c @@ -826,13 +826,12 @@ static int backend_init(const struct device *instance) \ static struct backend_data_t backend_data_##i; \ \ - DEVICE_DT_INST_DEFINE(i, \ + DEVICE_INSTANCE_FROM_DT_INST(i, \ &backend_init, \ NULL, \ &backend_data_##i, \ &backend_config_##i, \ POST_KERNEL, \ - CONFIG_IPC_SERVICE_REG_BACKEND_PRIORITY, \ &backend_ops); DT_INST_FOREACH_STATUS_OKAY(DEFINE_BACKEND_DEVICE) diff --git a/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_shi_ite.c b/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_shi_ite.c index cad8ecd4f36cb..b94210183610f 100644 --- a/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_shi_ite.c +++ b/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_shi_ite.c @@ -547,8 +547,8 @@ static struct shi_it8xxx2_data shi_data = { .shi_state = SHI_STATE_DISABLED, }; -DEVICE_DT_INST_DEFINE(0, shi_ite_init, PM_DEVICE_DT_INST_GET(0), &shi_data, &shi_cfg, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &ec_host_cmd_api); +DEVICE_INSTANCE_FROM_DT_INST(0, shi_ite_init, PM_DEVICE_DT_INST_GET(0), &shi_data, &shi_cfg, POST_KERNEL, + &ec_host_cmd_api); EC_HOST_CMD_SHI_ITE_DEFINE(ec_host_cmd_shi_ite); diff --git a/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_shi_npcx.c b/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_shi_npcx.c index 7d446f4a39aab..2ef6aa71e62f1 100644 --- a/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_shi_npcx.c +++ b/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_shi_npcx.c @@ -1144,8 +1144,8 @@ static struct shi_npcx_data shi_data = { .out_msg = shi_data.out_msg_padded + SHI_OUT_START_PAD - EC_SHI_FRAME_START_LENGTH, }; -DEVICE_DT_INST_DEFINE(0, shi_npcx_init, PM_DEVICE_DT_INST_GET(0), &shi_data, &shi_cfg, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &ec_host_cmd_api); +DEVICE_INSTANCE_FROM_DT_INST(0, shi_npcx_init, PM_DEVICE_DT_INST_GET(0), &shi_data, &shi_cfg, POST_KERNEL, + &ec_host_cmd_api); EC_HOST_CMD_SHI_NPCX_DEFINE(ec_host_cmd_shi_npcx); diff --git a/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_spi_stm32.c b/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_spi_stm32.c index bdc9faf6871fc..aedf21fe3b09a 100644 --- a/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_spi_stm32.c +++ b/subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_spi_stm32.c @@ -848,11 +848,11 @@ static int ec_host_cmd_spi_stm32_pm_action(const struct device *dev, PM_DEVICE_DT_DEFINE(DT_CHOSEN(zephyr_host_cmd_spi_backend), ec_host_cmd_spi_stm32_pm_action); -DEVICE_DT_DEFINE(DT_CHOSEN(zephyr_host_cmd_spi_backend), +DEVICE_INSTANCE(DT_CHOSEN(zephyr_host_cmd_spi_backend), NULL, PM_DEVICE_DT_GET(DT_CHOSEN(zephyr_host_cmd_spi_backend)), &ec_host_cmd_spi, NULL, - PRE_KERNEL_1, CONFIG_EC_HOST_CMD_INIT_PRIORITY, NULL); + PRE_KERNEL_1, NULL); #ifdef CONFIG_EC_HOST_CMD_INITIALIZE_AT_BOOT static int host_cmd_init(void) diff --git a/subsys/net/lib/capture/capture.c b/subsys/net/lib/capture/capture.c index 122096c96fcb5..edb656ebaf41f 100644 --- a/subsys/net/lib/capture/capture.c +++ b/subsys/net/lib/capture/capture.c @@ -727,14 +727,12 @@ static const struct net_capture_interface_api capture_interface_api = { static struct net_capture capture_dev_data_##x #define DEFINE_NET_CAPTURE_DEVICE(x, _) \ - DEVICE_DEFINE(net_capture_##x, \ - "NET_CAPTURE" #x, \ + DEVICE_INSTANCE(net_capture_##x, \ &capture_dev_init, \ NULL, \ &capture_dev_data_##x, \ NULL, \ POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ &capture_interface_api) LISTIFY(CONFIG_NET_CAPTURE_DEVICE_COUNT, DEFINE_NET_CAPTURE_DEV_DATA, (;), _); diff --git a/subsys/retention/retention.c b/subsys/retention/retention.c index a61f8df6b4d8a..6b7b95bd6f8dd 100644 --- a/subsys/retention/retention.c +++ b/subsys/retention/retention.c @@ -418,13 +418,12 @@ static const struct retention_api retention_api = { (DT_INST_PROP_LEN(inst, prefix)), (0)), \ .prefix = DT_INST_PROP_OR(inst, prefix, {0}), \ }; \ - DEVICE_DT_INST_DEFINE(inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, \ &retention_init, \ NULL, \ &retention_data_##inst, \ &retention_config_##inst, \ POST_KERNEL, \ - CONFIG_RETENTION_INIT_PRIORITY, \ &retention_api); DT_INST_FOREACH_STATUS_OKAY(RETENTION_DEVICE) diff --git a/subsys/sensing/sensor/hinge_angle/hinge_angle.c b/subsys/sensing/sensor/hinge_angle/hinge_angle.c index db86f4081a3d6..8dd54e8cc1f69 100644 --- a/subsys/sensing/sensor/hinge_angle/hinge_angle.c +++ b/subsys/sensing/sensor/hinge_angle/hinge_angle.c @@ -159,11 +159,11 @@ static void hinge_reporter_on_data_event(sensing_sensor_handle_t handle, .on_data_event = hinge_reporter_on_data_event, \ .context = &_CONCAT(hinge_ctx, _inst), \ }; \ - SENSING_SENSORS_DT_INST_DEFINE(_inst, &hinge_reg, \ + SENSING_SENSORS_INSTANCE_FROM_DT_INST(_inst, &hinge_reg, \ &_CONCAT(hinge_cb, _inst), \ &hinge_init, NULL, \ &_CONCAT(hinge_ctx, _inst), NULL, \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ + POST_KERNEL, \ &hinge_api); DT_INST_FOREACH_STATUS_OKAY(SENSING_HINGE_ANGLE_DT_DEFINE); diff --git a/subsys/sensing/sensor/phy_3d_sensor/phy_3d_sensor.c b/subsys/sensing/sensor/phy_3d_sensor/phy_3d_sensor.c index 12f2026636dc9..b6fcb4e708914 100644 --- a/subsys/sensing/sensor/phy_3d_sensor/phy_3d_sensor.c +++ b/subsys/sensing/sensor/phy_3d_sensor/phy_3d_sensor.c @@ -238,10 +238,10 @@ static const struct sensing_sensor_register_info phy_3d_sensor_reg = { .sensor_num = DT_INST_PROP_LEN(_inst, sensor_types), \ .sensor_types = DT_PROP(DT_DRV_INST(_inst), sensor_types), \ }; \ - SENSING_SENSORS_DT_INST_DEFINE(_inst, &phy_3d_sensor_reg, NULL, \ + SENSING_SENSORS_INSTANCE_FROM_DT_INST(_inst, &phy_3d_sensor_reg, NULL, \ &phy_3d_sensor_init, NULL, \ &_CONCAT(data, _inst), &_CONCAT(cfg, _inst), \ - POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ + POST_KERNEL, \ &phy_3d_sensor_api); DT_INST_FOREACH_STATUS_OKAY(SENSING_PHY_3D_SENSOR_DT_DEFINE); diff --git a/subsys/sensing/sensor_mgmt.c b/subsys/sensing/sensor_mgmt.c index a3ce834c64989..68ae86c4e7585 100644 --- a/subsys/sensing/sensor_mgmt.c +++ b/subsys/sensing/sensor_mgmt.c @@ -517,5 +517,5 @@ int sensing_get_sensors(int *sensor_nums, const struct sensing_sensor_info **inf K_THREAD_DEFINE(sensing_runtime, CONFIG_SENSING_RUNTIME_THREAD_STACK_SIZE, sensing_runtime_thread, &sensing_ctx, NULL, NULL, CONFIG_SENSING_RUNTIME_THREAD_PRIORITY, 0, 0); -DEVICE_DT_INST_DEFINE(0, sensing_init, NULL, &sensing_ctx, NULL, POST_KERNEL, - CONFIG_SENSOR_INIT_PRIORITY, NULL); +DEVICE_INSTANCE_FROM_DT_INST(0, sensing_init, NULL, &sensing_ctx, NULL, POST_KERNEL, + NULL); diff --git a/subsys/testsuite/busy_sim/busy_sim.c b/subsys/testsuite/busy_sim/busy_sim.c index 6b8d311951577..eda8b7d7b6077 100644 --- a/subsys/testsuite/busy_sim/busy_sim.c +++ b/subsys/testsuite/busy_sim/busy_sim.c @@ -208,7 +208,6 @@ static int busy_sim_init(const struct device *dev) return 0; } -DEVICE_DT_DEFINE(DT_BUSY_SIM, busy_sim_init, NULL, +DEVICE_INSTANCE(DT_BUSY_SIM, busy_sim_init, NULL, &sim_data, &sim_config, - POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY, - NULL); + POST_KERNEL, NULL); diff --git a/subsys/usb/device/class/cdc_acm.c b/subsys/usb/device/class/cdc_acm.c index 7e5fbbb672a95..e0cb133c28b5c 100644 --- a/subsys/usb/device/class/cdc_acm.c +++ b/subsys/usb/device/class/cdc_acm.c @@ -1221,9 +1221,8 @@ static const struct uart_driver_api cdc_acm_driver_api = { " is not assigned to a USB device controller"); \ CDC_ACM_CFG_AND_DATA_DEFINE(idx) \ \ - DEVICE_DT_INST_DEFINE(idx, cdc_acm_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(idx, cdc_acm_init, NULL, \ &cdc_acm_dev_data_##idx, &cdc_acm_config_##idx, \ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &cdc_acm_driver_api); + PRE_KERNEL_1, &cdc_acm_driver_api); DT_INST_FOREACH_STATUS_OKAY(CDC_ACM_DT_DEVICE_DEFINE); diff --git a/subsys/usb/device/class/hid/core.c b/subsys/usb/device/class/hid/core.c index 442f1a4a0f03b..d1df8211f9e9e 100644 --- a/subsys/usb/device/class/hid/core.c +++ b/subsys/usb/device/class/hid/core.c @@ -733,13 +733,11 @@ static int usb_hid_device_init(const struct device *dev) struct hid_device_info usb_hid_dev_data_##x #define DEFINE_HID_DEVICE(x, _) \ - DEVICE_DEFINE(usb_hid_device_##x, \ - CONFIG_USB_HID_DEVICE_NAME "_" #x, \ + DEVICE_INSTANCE(usb_hid_device_##x, \ &usb_hid_device_init, \ NULL, \ &usb_hid_dev_data_##x, \ &hid_config_##x, POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ &hid_api) LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_DESCR, (;), _); diff --git a/subsys/usb/device_next/class/usbd_cdc_acm.c b/subsys/usb/device_next/class/usbd_cdc_acm.c index 15fa82ad9eb1b..cc2d0d6e03efc 100644 --- a/subsys/usb/device_next/class/usbd_cdc_acm.c +++ b/subsys/usb/device_next/class/usbd_cdc_acm.c @@ -1267,10 +1267,9 @@ const static struct usb_desc_header *cdc_acm_hs_desc_##n[] = { \ .hs_desc = cdc_acm_hs_desc_##n, \ }; \ \ - DEVICE_DT_INST_DEFINE(n, usbd_cdc_acm_preinit, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, usbd_cdc_acm_preinit, NULL, \ &uart_data_##n, NULL, \ - PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \ - &cdc_acm_uart_api); + PRE_KERNEL_1, &cdc_acm_uart_api); DT_INST_FOREACH_STATUS_OKAY(USBD_CDC_ACM_DT_DEVICE_DEFINE); diff --git a/subsys/usb/device_next/class/usbd_hid.c b/subsys/usb/device_next/class/usbd_hid.c index 1de7abb5bd27b..c5ac78ba051b0 100644 --- a/subsys/usb/device_next/class/usbd_hid.c +++ b/subsys/usb/device_next/class/usbd_hid.c @@ -767,9 +767,8 @@ static const struct hid_device_driver_api hid_device_api = { \ static struct hid_device_data hid_data_##n; \ \ - DEVICE_DT_INST_DEFINE(n, hid_device_init, NULL, \ + DEVICE_INSTANCE_FROM_DT_INST(n, hid_device_init, NULL, \ &hid_data_##n, &hid_config_##n, \ - POST_KERNEL, CONFIG_USBD_HID_INIT_PRIORITY, \ - &hid_device_api); + POST_KERNEL, &hid_device_api); DT_INST_FOREACH_STATUS_OKAY(USBD_HID_INSTANCE_DEFINE); diff --git a/subsys/usb/device_next/class/usbd_uac2.c b/subsys/usb/device_next/class/usbd_uac2.c index 0e7144ec62254..c3d89143e07be 100644 --- a/subsys/usb/device_next/class/usbd_uac2.c +++ b/subsys/usb/device_next/class/usbd_uac2.c @@ -962,10 +962,9 @@ struct usbd_class_api uac2_api = { "UAC2 implementation supports up to 32 AS interfaces"); \ BUILD_ASSERT(ARRAY_SIZE(entity_types_##inst) <= 255, \ "UAC2 supports up to 255 entities"); \ - DEVICE_DT_DEFINE(DT_DRV_INST(inst), NULL, NULL, \ + DEVICE_INSTANCE(DT_DRV_INST(inst), NULL, NULL, \ &uac2_ctx_##inst, &uac2_cfg_##inst, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \ - NULL); + POST_KERNEL, NULL); DT_INST_FOREACH_STATUS_OKAY(DEFINE_UAC2_CLASS_DATA) static size_t clock_frequencies(struct usbd_class_data *const c_data, diff --git a/subsys/usb/usb_c/usbc_stack.c b/subsys/usb/usb_c/usbc_stack.c index 5cf32b70aa7d6..b959a5bb4cfb0 100644 --- a/subsys/usb/usb_c/usbc_stack.c +++ b/subsys/usb/usb_c/usbc_stack.c @@ -88,9 +88,9 @@ static ALWAYS_INLINE void usbc_handler(void *port_dev) .create_thread = create_thread_##inst, \ }; \ \ - DEVICE_DT_INST_DEFINE(inst, &usbc_subsys_init, NULL, &usbc_port_data_##inst, \ + DEVICE_INSTANCE_FROM_DT_INST(inst, &usbc_subsys_init, NULL, &usbc_port_data_##inst, \ &usbc_port_config_##inst, POST_KERNEL, \ - CONFIG_USBC_STACK_INIT_PRIORITY, NULL); + NULL); DT_INST_FOREACH_STATUS_OKAY(USBC_SUBSYS_INIT) diff --git a/tests/benchmarks/footprints/src/pm_device.c b/tests/benchmarks/footprints/src/pm_device.c index 028eff1e3f902..bf48544421f31 100644 --- a/tests/benchmarks/footprints/src/pm_device.c +++ b/tests/benchmarks/footprints/src/pm_device.c @@ -25,12 +25,12 @@ static int dummy_device_pm_action(const struct device *dev, /* Define a driver with and without power management enabled */ PM_DEVICE_DEFINE(dummy_pm_driver, dummy_device_pm_action); -DEVICE_DEFINE(dummy_pm_driver, DUMMY_PM_DRIVER_NAME, NULL, +DEVICE_INSTANCE(dummy_pm_driver, NULL, PM_DEVICE_GET(dummy_pm_driver), NULL, NULL, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); + NULL); -DEVICE_DEFINE(dummy_driver, DUMMY_DRIVER_NAME, NULL, NULL, NULL, NULL, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); +DEVICE_INSTANCE(dummy_driver, NULL, NULL, NULL, NULL, + POST_KERNEL, NULL); void run_pm_device(void) { diff --git a/tests/bluetooth/bluetooth/src/bluetooth.c b/tests/bluetooth/bluetooth/src/bluetooth.c index 92889f9b598ea..be933fbf4fcc8 100644 --- a/tests/bluetooth/bluetooth/src/bluetooth.c +++ b/tests/bluetooth/bluetooth/src/bluetooth.c @@ -43,8 +43,8 @@ static const struct bt_hci_driver_api driver_api = { #define TEST_DEVICE_INIT(inst) \ static struct driver_data driver_data_##inst = { \ }; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &driver_data_##inst, NULL, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &driver_api) + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &driver_data_##inst, NULL,\ + POST_KERNEL, &driver_api) DT_INST_FOREACH_STATUS_OKAY(TEST_DEVICE_INIT) diff --git a/tests/bluetooth/hci_prop_evt/src/main.c b/tests/bluetooth/hci_prop_evt/src/main.c index ea433b62df42d..615b6c2336b8b 100644 --- a/tests/bluetooth/hci_prop_evt/src/main.c +++ b/tests/bluetooth/hci_prop_evt/src/main.c @@ -243,8 +243,8 @@ static const struct bt_hci_driver_api driver_api = { #define TEST_DEVICE_INIT(inst) \ static struct driver_data driver_data_##inst = { \ }; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &driver_data_##inst, NULL, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &driver_api) + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &driver_data_##inst, NULL,\ + POST_KERNEL, &driver_api) DT_INST_FOREACH_STATUS_OKAY(TEST_DEVICE_INIT) diff --git a/tests/bluetooth/hci_uart_async/src/test_hci_uart_async.c b/tests/bluetooth/hci_uart_async/src/test_hci_uart_async.c index d30503ce216d9..c0a3da3be8f0e 100644 --- a/tests/bluetooth/hci_uart_async/src/test_hci_uart_async.c +++ b/tests/bluetooth/hci_uart_async/src/test_hci_uart_async.c @@ -51,8 +51,8 @@ static int drv_init(const struct device *dev) #define TEST_DEVICE_INIT(inst) \ static struct drv_data drv_data_##inst = { \ }; \ - DEVICE_DT_INST_DEFINE(inst, drv_init, NULL, &drv_data_##inst, NULL, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &drv_api) + DEVICE_INSTANCE_FROM_DT_INST(inst, drv_init, NULL, &drv_data_##inst, NULL,\ + POST_KERNEL, &drv_api) DT_INST_FOREACH_STATUS_OKAY(TEST_DEVICE_INIT) diff --git a/tests/bluetooth/host_long_adv_recv/src/main.c b/tests/bluetooth/host_long_adv_recv/src/main.c index 71769be589dfb..ecc3f402e35f6 100644 --- a/tests/bluetooth/host_long_adv_recv/src/main.c +++ b/tests/bluetooth/host_long_adv_recv/src/main.c @@ -257,8 +257,8 @@ static const struct bt_hci_driver_api driver_api = { #define TEST_DEVICE_INIT(inst) \ static struct driver_data driver_data_##inst = { \ }; \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &driver_data_##inst, NULL, \ - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &driver_api) + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &driver_data_##inst, NULL,\ + POST_KERNEL, &driver_api) DT_INST_FOREACH_STATUS_OKAY(TEST_DEVICE_INIT) diff --git a/tests/drivers/build_all/input/app.overlay b/tests/drivers/build_all/input/app.overlay index e8f2e38365284..1e86ebf06381e 100644 --- a/tests/drivers/build_all/input/app.overlay +++ b/tests/drivers/build_all/input/app.overlay @@ -148,7 +148,6 @@ }; longpress: longpress { - input = <&longpress>; compatible = "zephyr,input-longpress"; input-codes = <0>; short-codes = <0>; @@ -157,7 +156,6 @@ }; double_tap: doubletap { - input = <&double_tap>; compatible = "zephyr,input-double-tap"; input-codes = <0>; double-tap-codes = <0>; diff --git a/tests/drivers/espi/src/stub_espi_emul_host.c b/tests/drivers/espi/src/stub_espi_emul_host.c index 330bae80f3e03..3cbf36ac0549f 100644 --- a/tests/drivers/espi/src/stub_espi_emul_host.c +++ b/tests/drivers/espi/src/stub_espi_emul_host.c @@ -32,8 +32,7 @@ static struct emul_espi_host_stub_dev_config stub_host_config; static struct emul_espi_host_stub_dev_api stub_host_api; #define EMUL_ESPI_HOST_DEVICE_STUB(n) \ - DEVICE_DT_INST_DEFINE(n, &emul_espi_host_init_stub, NULL, &stub_host_data, \ - &stub_host_config, POST_KERNEL, CONFIG_ESPI_INIT_PRIORITY, \ - &stub_host_api) + DEVICE_INSTANCE_FROM_DT_INST(n, &emul_espi_host_init_stub, NULL, &stub_host_data, \ + &stub_host_config, POST_KERNEL, &stub_host_api) DT_INST_FOREACH_STATUS_OKAY(EMUL_ESPI_HOST_DEVICE_STUB); diff --git a/tests/drivers/gnss/gnss_dump/src/main.c b/tests/drivers/gnss/gnss_dump/src/main.c index 4a07d42404602..ce748e523e1ed 100644 --- a/tests/drivers/gnss/gnss_dump/src/main.c +++ b/tests/drivers/gnss/gnss_dump/src/main.c @@ -8,8 +8,8 @@ #include #include -DEVICE_DEFINE(gnss_dev, "gnss_dev", NULL, NULL, NULL, NULL, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); +DEVICE_INSTANCE(gnss_dev, NULL, NULL, NULL, NULL, + POST_KERNEL, NULL); static const struct device *gnss_dev = &DEVICE_NAME_GET(gnss_dev); static struct gnss_data test_data; diff --git a/tests/drivers/i2c/i2c_target_api/common/i2c_virtual.c b/tests/drivers/i2c/i2c_target_api/common/i2c_virtual.c index d8833b69c0a12..1bb2608222b98 100644 --- a/tests/drivers/i2c/i2c_target_api/common/i2c_virtual.c +++ b/tests/drivers/i2c/i2c_target_api/common/i2c_virtual.c @@ -222,7 +222,6 @@ static int i2c_virtual_init(const struct device *dev) static struct i2c_virtual_data i2c_virtual_dev_data_0; -DEVICE_DEFINE(i2c_virtual_0, CONFIG_I2C_VIRTUAL_NAME, &i2c_virtual_init, +DEVICE_INSTANCE(i2c_virtual_0, &i2c_virtual_init, NULL, &i2c_virtual_dev_data_0, NULL, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, - &api_funcs); + POST_KERNEL, &api_funcs); diff --git a/tests/drivers/input/kbd_matrix/src/main.c b/tests/drivers/input/kbd_matrix/src/main.c index 8477a6cc50bbe..df37391bd8c18 100644 --- a/tests/drivers/input/kbd_matrix/src/main.c +++ b/tests/drivers/input/kbd_matrix/src/main.c @@ -57,9 +57,9 @@ static const struct input_kbd_matrix_common_config static struct input_kbd_matrix_common_data test_data; -DEVICE_DT_DEFINE(TEST_KBD_SCAN_NODE, input_kbd_matrix_common_init, NULL, +DEVICE_INSTANCE(TEST_KBD_SCAN_NODE, input_kbd_matrix_common_init, NULL, &test_data, &test_cfg, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, NULL); + POST_KERNEL, NULL); static const struct device *const test_dev = DEVICE_DT_GET(TEST_KBD_SCAN_NODE); diff --git a/tests/drivers/ipm/service_and_device_init.yaml b/tests/drivers/ipm/service_and_device_init.yaml new file mode 100644 index 0000000000000..89710a550bb5d --- /dev/null +++ b/tests/drivers/ipm/service_and_device_init.yaml @@ -0,0 +1,14 @@ +# Copyright (c) 2024, Tomasz Bursztyka +# +# SPDX-License-Identifier: Apache-2.0 + +device: + ipm_console_send0: + init: + dependencies: + - ipm_dummy0 + + ipm_console_recv0: + init: + dependencies: + - ipm_dummy0 diff --git a/tests/drivers/ipm/src/main.c b/tests/drivers/ipm/src/main.c index 6c1660798d09b..fdcb07eef66d3 100644 --- a/tests/drivers/ipm/src/main.c +++ b/tests/drivers/ipm/src/main.c @@ -32,9 +32,9 @@ extern struct ipm_driver_api ipm_dummy_api; /* Set up the dummy IPM driver */ struct ipm_dummy_driver_data ipm_dummy0_driver_data; -DEVICE_DEFINE(ipm_dummy0, "ipm_dummy0", NULL, +DEVICE_INSTANCE(ipm_dummy0, NULL, NULL, &ipm_dummy0_driver_data, NULL, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, + PRE_KERNEL_1, &ipm_dummy_api); /* Sending side of the console IPM driver, will forward anything sent @@ -44,9 +44,9 @@ static struct ipm_console_sender_config_info sender_config = { .bind_to = "ipm_dummy0", .flags = SOURCE }; -DEVICE_DEFINE(ipm_console_send0, "ipm_send0", ipm_console_sender_init, +DEVICE_INSTANCE(ipm_console_send0, ipm_console_sender_init, NULL, NULL, &sender_config, - POST_KERNEL, INIT_PRIO_IPM_SEND, NULL); + POST_KERNEL, NULL); /* Receiving side of the console IPM driver. These numbers are * more or less arbitrary @@ -70,9 +70,9 @@ static struct ipm_console_receiver_config_info receiver_config = { }; struct ipm_console_receiver_runtime_data receiver_data; -DEVICE_DEFINE(ipm_console_recv0, "ipm_recv0", ipm_console_receiver_init, +DEVICE_INSTANCE(ipm_console_recv0, ipm_console_receiver_init, NULL, &receiver_data, &receiver_config, - POST_KERNEL, INIT_PRIO_IPM_RECV, NULL); + POST_KERNEL, NULL); static const char thestr[] = "everything is awesome\n"; diff --git a/tests/drivers/mspi/api/src/stub_mspi_emul_device.c b/tests/drivers/mspi/api/src/stub_mspi_emul_device.c index 438b4f3202eaf..ce165f372da04 100644 --- a/tests/drivers/mspi/api/src/stub_mspi_emul_device.c +++ b/tests/drivers/mspi/api/src/stub_mspi_emul_device.c @@ -40,13 +40,12 @@ struct emul_mspi_device_stub_dev_api { static struct emul_mspi_device_stub_dev_data stub_device_data_##n; \ static struct emul_mspi_device_stub_dev_config stub_device_config_##n; \ static struct emul_mspi_device_stub_dev_api stub_device_api_##n; \ - DEVICE_DT_INST_DEFINE(n, \ + DEVICE_INSTANCE_FROM_DT_INST(n, \ emul_mspi_device_init_stub, \ NULL, \ &stub_device_data_##n, \ &stub_device_config_##n, \ POST_KERNEL, \ - CONFIG_MSPI_INIT_PRIORITY, \ &stub_device_api_##n); #define EMUL_TEST(n) \ diff --git a/tests/drivers/pinctrl/common/test_device.c b/tests/drivers/pinctrl/common/test_device.c index 2b025877cee77..dc7934cfeef5c 100644 --- a/tests/drivers/pinctrl/common/test_device.c +++ b/tests/drivers/pinctrl/common/test_device.c @@ -14,7 +14,7 @@ #define PINCTRL_DEVICE_INIT(inst) \ PINCTRL_DT_INST_DEFINE(inst); \ \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, NULL, POST_KERNEL,\ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, NULL, NULL, POST_KERNEL,\ + NULL); DT_INST_FOREACH_STATUS_OKAY(PINCTRL_DEVICE_INIT) diff --git a/tests/drivers/sensor/generic/src/dummy_sensor.c b/tests/drivers/sensor/generic/src/dummy_sensor.c index a68c90973716f..7d8671237076f 100644 --- a/tests/drivers/sensor/generic/src/dummy_sensor.c +++ b/tests/drivers/sensor/generic/src/dummy_sensor.c @@ -177,10 +177,10 @@ static const struct sensor_driver_api dummy_sensor_no_trig_api = { .trigger_set = NULL, }; -DEVICE_DEFINE(dummy_sensor, DUMMY_SENSOR_NAME, &dummy_sensor_init, +DEVICE_INSTANCE(dummy_sensor, &dummy_sensor_init, NULL, &dummy_data, &dummy_config, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &dummy_sensor_api); + &dummy_sensor_api); -DEVICE_DEFINE(dummy_sensor_no_trig, DUMMY_SENSOR_NAME_NO_TRIG, &dummy_sensor_init, +DEVICE_INSTANCE(dummy_sensor_no_trig, &dummy_sensor_init, NULL, &dummy_data, &dummy_config, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &dummy_sensor_no_trig_api); + &dummy_sensor_no_trig_api); diff --git a/tests/drivers/smbus/smbus_emul/src/smbus.c b/tests/drivers/smbus/smbus_emul/src/smbus.c index b590470ff70ea..c21d123cc9c6b 100644 --- a/tests/drivers/smbus/smbus_emul/src/smbus.c +++ b/tests/drivers/smbus/smbus_emul/src/smbus.c @@ -97,9 +97,9 @@ static struct pch_config pch_config_data = { .pcie = &pcie_params, }; -DEVICE_DEFINE(dummy_driver, SMBUS_EMUL, &pch_smbus_init, +DEVICE_INSTANCE(smbus_emul, &pch_smbus_init, NULL, &smbus_data, &pch_config_data, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &funcs); + &funcs); ZTEST(test_smbus_emul, test_byte) { diff --git a/tests/drivers/w1/w1_api/src/w1_dummy_slave.c b/tests/drivers/w1/w1_api/src/w1_dummy_slave.c index 5819360ec40fe..99172ff37f805 100644 --- a/tests/drivers/w1/w1_api/src/w1_dummy_slave.c +++ b/tests/drivers/w1/w1_api/src/w1_dummy_slave.c @@ -15,7 +15,7 @@ struct w1_dummy_slave_api { static const struct w1_dummy_slave_api w1_dummy_slave_api1 = {}; #define TEST_W1_DUMMY_SLAVE_DEFINE(inst) \ - DEVICE_DT_INST_DEFINE(inst, NULL, NULL, NULL, NULL, POST_KERNEL, \ - CONFIG_W1_INIT_PRIORITY, &w1_dummy_slave_api1); + DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, NULL, NULL, POST_KERNEL, \ + &w1_dummy_slave_api1); DT_INST_FOREACH_STATUS_OKAY(TEST_W1_DUMMY_SLAVE_DEFINE) diff --git a/tests/kernel/device/service_and_device_init.yaml b/tests/kernel/device/service_and_device_init.yaml new file mode 100644 index 0000000000000..2d36dfb5d275e --- /dev/null +++ b/tests/kernel/device/service_and_device_init.yaml @@ -0,0 +1,19 @@ +# Copyright (c) 2024, Tomasz Bursztyka +# +# SPDX-License-Identifier: Apache-2.0 + +device: + my_driver_level_2: + init: + dependencies: + - my_driver_priority_1 + + my_driver_priority_3: + init: + dependencies: + - my_driver_priority_2 + + my_driver_priority_4: + init: + dependencies: + - my_driver_priority_3 diff --git a/tests/kernel/device/src/abstract_driver.c b/tests/kernel/device/src/abstract_driver.c index 1fccec62b8869..dd82d03604d3d 100644 --- a/tests/kernel/device/src/abstract_driver.c +++ b/tests/kernel/device/src/abstract_driver.c @@ -53,15 +53,13 @@ static struct subsystem_api my_driver_B_api_funcs = { /** * @cond INTERNAL_HIDDEN */ -DEVICE_DEFINE(my_driver_A, MY_DRIVER_A, &common_driver_init, +DEVICE_INSTANCE(my_driver_A, &common_driver_init, NULL, NULL, NULL, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &my_driver_A_api_funcs); + POST_KERNEL, &my_driver_A_api_funcs); -DEVICE_DEFINE(my_driver_B, MY_DRIVER_B, &common_driver_init, +DEVICE_INSTANCE(my_driver_B, &common_driver_init, NULL, NULL, NULL, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &my_driver_B_api_funcs); + POST_KERNEL, &my_driver_B_api_funcs); /** * @endcond diff --git a/tests/kernel/device/src/bad_driver.c b/tests/kernel/device/src/bad_driver.c index 7f781ce92d36a..78e16cf8f7ff6 100644 --- a/tests/kernel/device/src/bad_driver.c +++ b/tests/kernel/device/src/bad_driver.c @@ -35,9 +35,9 @@ int bad_driver_init(const struct device *dev) /** * @cond INTERNAL_HIDDEN */ -DEVICE_DEFINE(bad_driver, BAD_DRIVER_NAME, &bad_driver_init, +DEVICE_INSTANCE(bad_driver, &bad_driver_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &funcs); + &funcs); /** * @endcond diff --git a/tests/kernel/device/src/dummy_driver.c b/tests/kernel/device/src/dummy_driver.c index bef80a159f38e..03b6083f1b9cc 100644 --- a/tests/kernel/device/src/dummy_driver.c +++ b/tests/kernel/device/src/dummy_driver.c @@ -35,8 +35,8 @@ int dummy_init(const struct device *dev) /** * @cond INTERNAL_HIDDEN */ -DEVICE_DEFINE(dummy_driver, DUMMY_DRIVER_NAME, dummy_init, NULL, NULL, NULL, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &funcs); +DEVICE_INSTANCE(dummy_driver, dummy_init, NULL, NULL, NULL, + POST_KERNEL, &funcs); /** * @endcond diff --git a/tests/kernel/device/src/main.c b/tests/kernel/device/src/main.c index 437f2ae056c74..42c52072c8491 100644 --- a/tests/kernel/device/src/main.c +++ b/tests/kernel/device/src/main.c @@ -26,18 +26,17 @@ #define FAKEDEFERDRIVER1 DEVICE_DT_GET(DT_PATH(fakedeferdriver_e8000000)) /* A device without init call */ -DEVICE_DEFINE(dummy_noinit, DUMMY_NOINIT, NULL, NULL, NULL, NULL, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); +DEVICE_INSTANCE(dummy_noinit, NULL, NULL, NULL, NULL, + POST_KERNEL, NULL); /* To access from userspace, the device needs an API. Use a dummy GPIO one */ static const struct gpio_driver_api fakedeferdriverapi; /* Fake deferred devices */ -DEVICE_DT_DEFINE(DT_INST(0, fakedeferdriver), NULL, NULL, NULL, NULL, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); -DEVICE_DT_DEFINE(DT_INST(1, fakedeferdriver), NULL, NULL, NULL, NULL, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &fakedeferdriverapi); +DEVICE_INSTANCE(DT_INST(0, fakedeferdriver), NULL, NULL, NULL, NULL, + POST_KERNEL, NULL); +DEVICE_INSTANCE(DT_INST(1, fakedeferdriver), NULL, NULL, NULL, NULL, + POST_KERNEL, &fakedeferdriverapi); /** * @brief Test cases to verify device objects @@ -65,7 +64,7 @@ DEVICE_DT_DEFINE(DT_INST(1, fakedeferdriver), NULL, NULL, NULL, NULL, * * @ingroup kernel_device_tests * - * @see device_get_binding(), DEVICE_DEFINE() + * @see device_get_binding(), DEVICE_INSTANCE() */ ZTEST(device, test_dummy_device) { @@ -95,7 +94,7 @@ ZTEST(device, test_dummy_device) * * Validates device binding for an existing device object. * - * @see device_get_binding(), DEVICE_DEFINE() + * @see device_get_binding(), DEVICE_INSTANCE() */ ZTEST_USER(device, test_dynamic_name) { @@ -113,7 +112,7 @@ ZTEST_USER(device, test_dynamic_name) * Validates binding of a random device driver(non-defined driver) named * "ANOTHER_BOGUS_NAME". * - * @see device_get_binding(), DEVICE_DEFINE() + * @see device_get_binding(), DEVICE_INSTANCE() */ ZTEST_USER(device, test_bogus_dynamic_name) { @@ -130,7 +129,7 @@ ZTEST_USER(device, test_bogus_dynamic_name) * * Validates device binding for device object when given dynamic name is null. * - * @see device_get_binding(), DEVICE_DEFINE() + * @see device_get_binding(), DEVICE_INSTANCE() */ ZTEST_USER(device, test_null_dynamic_name) { diff --git a/tests/kernel/device/src/mmio.c b/tests/kernel/device/src/mmio.c index b8066eeea3ecf..ca85c988e6149 100644 --- a/tests/kernel/device/src/mmio.c +++ b/tests/kernel/device/src/mmio.c @@ -36,10 +36,9 @@ int foo_single_init(const struct device *dev) } /* fake API pointer, we don't use it at all for this suite */ -DEVICE_DEFINE(foo0, "foo0", foo_single_init, NULL, +DEVICE_INSTANCE(foo0, foo_single_init, NULL, &foo0_data, &foo0_config, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - (void *)0xDEADBEEF); + POST_KERNEL, (void *)0xDEADBEEF); /** * @brief Test DEVICE_MMIO_* macros @@ -130,10 +129,9 @@ int foo_mult_init(const struct device *dev) return 0; } -DEVICE_DEFINE(foo12, "foo12", foo_mult_init, NULL, +DEVICE_INSTANCE(foo12, foo_mult_init, NULL, &foo12_data, &foo12_config, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - (void *)0xDEADBEEF); + POST_KERNEL, (void *)0xDEADBEEF); /** * @brief Test DEVICE_MMIO_NAMED_* macros diff --git a/tests/kernel/device/src/mmio_multireg.c b/tests/kernel/device/src/mmio_multireg.c index 53b27a282b5e2..dfe096b4a1407 100644 --- a/tests/kernel/device/src/mmio_multireg.c +++ b/tests/kernel/device/src/mmio_multireg.c @@ -44,10 +44,9 @@ int foo_multireg_init(const struct device *dev) return 0; } -DEVICE_DEFINE(foo_multireg, "foo_multireg", foo_multireg_init, NULL, +DEVICE_INSTANCE(foo_multireg, foo_multireg_init, NULL, &foo_multireg_data, &foo_multireg_config, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - (void *)0xDEADBEEF); + POST_KERNEL, (void *)0xDEADBEEF); /** * @brief Test DEVICE_MMIO_NAMED_* macros * diff --git a/tests/kernel/device/src/test_driver_init.c b/tests/kernel/device/src/test_driver_init.c index aaca820942f24..cf520c8887bb3 100644 --- a/tests/kernel/device/src/test_driver_init.c +++ b/tests/kernel/device/src/test_driver_init.c @@ -145,50 +145,42 @@ static int my_driver_sub_pri_2_init(const struct device *dev) * * @details Test that kernel shall provide control over device driver * initialization order, using initialization level and priority for each - * instance. We use DEVICE_DEFINE to define device instances and set + * instance. We use DEVICE_INSTANCE to define device instances and set * it's level and priority here, then we run check function later after * all of this instance finish their initialization. * * @ingroup kernel_device_tests */ -DEVICE_DEFINE(my_driver_level_1, MY_DRIVER_LV_1, &my_driver_lv_1_init, +DEVICE_INSTANCE(my_driver_level_1, &my_driver_lv_1_init, NULL, NULL, NULL, PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &funcs_my_drivers); + &funcs_my_drivers); -DEVICE_DEFINE(my_driver_level_2, MY_DRIVER_LV_2, &my_driver_lv_2_init, +DEVICE_INSTANCE(my_driver_level_2, &my_driver_lv_2_init, NULL, NULL, NULL, PRE_KERNEL_2, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &funcs_my_drivers); + &funcs_my_drivers); -DEVICE_DEFINE(my_driver_level_3, MY_DRIVER_LV_3, &my_driver_lv_3_init, +DEVICE_INSTANCE(my_driver_level_3, &my_driver_lv_3_init, NULL, NULL, NULL, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &funcs_my_drivers); + &funcs_my_drivers); /* We use priority value of 20 to create a possible sorting conflict with * priority value of 2. So if the linker sorting isn't working correctly * we'll find out. */ -DEVICE_DEFINE(my_driver_priority_4, MY_DRIVER_PRI_4, - &my_driver_pri_4_init, NULL, NULL, NULL, POST_KERNEL, 20, - &funcs_my_drivers); +DEVICE_INSTANCE(my_driver_priority_4, &my_driver_pri_4_init, NULL, NULL, NULL, POST_KERNEL, &funcs_my_drivers); -DEVICE_DEFINE(my_driver_priority_1, MY_DRIVER_PRI_1, - &my_driver_pri_1_init, NULL, NULL, NULL, POST_KERNEL, 1, - &funcs_my_drivers); +DEVICE_INSTANCE(my_driver_priority_1, &my_driver_pri_1_init, NULL, NULL, NULL, POST_KERNEL, &funcs_my_drivers); -DEVICE_DEFINE(my_driver_priority_2, MY_DRIVER_PRI_2, - &my_driver_pri_2_init, NULL, NULL, NULL, POST_KERNEL, 2, - &funcs_my_drivers); +DEVICE_INSTANCE(my_driver_priority_2, &my_driver_pri_2_init, NULL, NULL, NULL, POST_KERNEL, &funcs_my_drivers); -DEVICE_DEFINE(my_driver_priority_3, MY_DRIVER_PRI_3, - &my_driver_pri_3_init, NULL, NULL, NULL, POST_KERNEL, 3, - &funcs_my_drivers); +DEVICE_INSTANCE(my_driver_priority_3, &my_driver_pri_3_init, NULL, NULL, NULL, POST_KERNEL, &funcs_my_drivers); /* Create several devices at the same init priority that depend on each * other in devicetree so that we can validate linker sorting. */ -DEVICE_DT_DEFINE(DT_NODELABEL(fakedomain_0), my_driver_sub_pri_0_init, - NULL, NULL, NULL, POST_KERNEL, 33, NULL); -DEVICE_DT_DEFINE(DT_NODELABEL(fakedomain_1), my_driver_sub_pri_1_init, - NULL, NULL, NULL, POST_KERNEL, 33, NULL); -DEVICE_DT_DEFINE(DT_NODELABEL(fakedomain_2), my_driver_sub_pri_2_init, - NULL, NULL, NULL, POST_KERNEL, 33, NULL); +DEVICE_INSTANCE(DT_NODELABEL(fakedomain_0), my_driver_sub_pri_0_init, + NULL, NULL, NULL, POST_KERNEL, NULL); +DEVICE_INSTANCE(DT_NODELABEL(fakedomain_1), my_driver_sub_pri_1_init, + NULL, NULL, NULL, POST_KERNEL, NULL); +DEVICE_INSTANCE(DT_NODELABEL(fakedomain_2), my_driver_sub_pri_2_init, + NULL, NULL, NULL, POST_KERNEL, NULL); diff --git a/tests/lib/cpp/cxx/src/main.cpp b/tests/lib/cpp/cxx/src/main.cpp index d2704e0d992fe..1699681a018b9 100644 --- a/tests/lib/cpp/cxx/src/main.cpp +++ b/tests/lib/cpp/cxx/src/main.cpp @@ -143,7 +143,6 @@ ZTEST_SUITE(cxx_tests, NULL, NULL, NULL, NULL, NULL); * arguments these one-liners add significant C++ coverage. For instance this actually * compiles some of the macros in zephyr/device.h in C++. * - * DEVICE_DEFINE(dev_id, name, * init_fn, pm, data, config, level, prio, api) */ DEVICE_DT_DEFINE(DT_NODELABEL(test_dev1_dfr), NULL, NULL, NULL, NULL, POST_KERNEL, 33, NULL); diff --git a/tests/lib/devicetree/api/src/main.c b/tests/lib/devicetree/api/src/main.c index 4b39c4571a871..203559090804e 100644 --- a/tests/lib/devicetree/api/src/main.c +++ b/tests/lib/devicetree/api/src/main.c @@ -1930,13 +1930,12 @@ static const struct gpio_driver_api test_api; .reg_addr = DT_INST_REG_ADDR(num), \ .reg_len = DT_INST_REG_SIZE(num), \ }; \ - DEVICE_DT_INST_DEFINE(num, \ + DEVICE_INSTANCE_FROM_DT_INST(num, \ test_gpio_init, \ NULL, \ &gpio_data_##num, \ &gpio_info_##num, \ POST_KERNEL, \ - CONFIG_APPLICATION_INIT_PRIORITY, \ &test_api); DT_INST_FOREACH_STATUS_OKAY(TEST_GPIO_INIT) @@ -2943,10 +2942,10 @@ ZTEST(devicetree_api, test_pinctrl) zassert_equal(DT_INST_PINCTRL_HAS_NAME(0, f_o_o2), 0, ""); } -DEVICE_DT_DEFINE(DT_NODELABEL(test_mbox), NULL, NULL, NULL, NULL, POST_KERNEL, - 90, NULL); -DEVICE_DT_DEFINE(DT_NODELABEL(test_mbox_zero_cell), NULL, NULL, NULL, NULL, - POST_KERNEL, 90, NULL); +DEVICE_INSTANCE(DT_NODELABEL(test_mbox), NULL, NULL, NULL, NULL, POST_KERNEL, + NULL); +DEVICE_INSTANCE(DT_NODELABEL(test_mbox_zero_cell), NULL, NULL, NULL, NULL, + POST_KERNEL, NULL); ZTEST(devicetree_api, test_mbox) { diff --git a/tests/lib/devicetree/devices/service_and_device_init.yaml b/tests/lib/devicetree/devices/service_and_device_init.yaml new file mode 100644 index 0000000000000..9d6f793b68229 --- /dev/null +++ b/tests/lib/devicetree/devices/service_and_device_init.yaml @@ -0,0 +1,45 @@ +# Copyright (c) 2024, Tomasz Bursztyka +# +# SPDX-License-Identifier: Apache-2.0 + +device: + test_dev_a: + init: + dependencies: + - test_i2c + + test_gpiox: + init: + dependencies: + - test_dev_a + + test_dev_b: + init: + dependencies: + - test_gpiox + + test_dev_c: + init: + dependencies: + - test_dev_b + + test_p0: + init: + dependencies: + - test_dev_c + + test_gpio_injected: + init: + dependencies: + - test_dev_b + - test_p0 + + manual_dev: + init: + dependencies: + - test_gpio_injected + + test-i2c-dev@14: + init: + dependencies: + - manual_dev diff --git a/tests/lib/devicetree/devices/src/main.c b/tests/lib/devicetree/devices/src/main.c index 55eade26fa8e1..2fe4c0272998c 100644 --- a/tests/lib/devicetree/devices/src/main.c +++ b/tests/lib/devicetree/devices/src/main.c @@ -34,30 +34,29 @@ static int dev_init(const struct device *dev) return 0; } -DEVICE_DT_DEFINE(TEST_GPIO, dev_init, NULL, - NULL, NULL, PRE_KERNEL_1, 90, NULL); -DEVICE_DT_DEFINE(TEST_I2C, dev_init, NULL, - NULL, NULL, POST_KERNEL, 10, NULL); -DEVICE_DT_DEFINE(TEST_DEVA, dev_init, NULL, - NULL, NULL, POST_KERNEL, 20, NULL); -/* NB: Intentional init devb before required gpiox */ -DEVICE_DT_DEFINE(TEST_DEVB, dev_init, NULL, - NULL, NULL, POST_KERNEL, 30, NULL); -DEVICE_DT_DEFINE(TEST_GPIOX, dev_init, NULL, - NULL, NULL, POST_KERNEL, 40, NULL); -DEVICE_DT_DEFINE(TEST_DEVC, dev_init, NULL, - NULL, NULL, POST_KERNEL, 50, NULL); -DEVICE_DT_DEFINE(TEST_PARTITION, dev_init, NULL, - NULL, NULL, POST_KERNEL, 60, NULL); +DEVICE_INSTANCE(TEST_GPIO, dev_init, NULL, + NULL, NULL, PRE_KERNEL_1, NULL); +DEVICE_INSTANCE(TEST_I2C, dev_init, NULL, + NULL, NULL, POST_KERNEL, NULL); +DEVICE_INSTANCE(TEST_DEVA, dev_init, NULL, + NULL, NULL, POST_KERNEL, NULL); +DEVICE_INSTANCE(TEST_DEVB, dev_init, NULL, + NULL, NULL, POST_KERNEL, NULL); +DEVICE_INSTANCE(TEST_GPIOX, dev_init, NULL, + NULL, NULL, POST_KERNEL, NULL); +DEVICE_INSTANCE(TEST_DEVC, dev_init, NULL, + NULL, NULL, POST_KERNEL, NULL); +DEVICE_INSTANCE(TEST_PARTITION, dev_init, NULL, + NULL, NULL, POST_KERNEL, NULL); /* Device with both an existing and missing injected dependency */ -DEVICE_DT_DEFINE(TEST_GPIO_INJECTED, dev_init, NULL, - NULL, NULL, POST_KERNEL, 70, NULL, DT_DEP_ORD(TEST_DEVB), 999); +DEVICE_INSTANCE(TEST_GPIO_INJECTED, dev_init, NULL, + NULL, NULL, POST_KERNEL, NULL); /* Manually specified device */ -DEVICE_DEFINE(manual_dev, "Manual Device", dev_init, NULL, - NULL, NULL, POST_KERNEL, 80, NULL); +DEVICE_INSTANCE(manual_dev, dev_init, NULL, + NULL, NULL, POST_KERNEL, NULL); /* Device with no nodelabel */ -DEVICE_DT_DEFINE(TEST_NOLABEL, dev_init, NULL, - NULL, NULL, POST_KERNEL, 90, NULL); +DEVICE_INSTANCE(TEST_NOLABEL, dev_init, NULL, + NULL, NULL, POST_KERNEL, NULL); #define DEV_HDL(node_id) device_handle_get(DEVICE_DT_GET(node_id)) #define DEV_HDL_NAME(name) device_handle_get(DEVICE_GET(name)) @@ -104,8 +103,8 @@ ZTEST(devicetree_devices, test_init_order) zassert_equal(init_order[0], DEV_HDL(TEST_GPIO)); zassert_equal(init_order[1], DEV_HDL(TEST_I2C)); zassert_equal(init_order[2], DEV_HDL(TEST_DEVA)); - zassert_equal(init_order[3], DEV_HDL(TEST_DEVB)); - zassert_equal(init_order[4], DEV_HDL(TEST_GPIOX)); + zassert_equal(init_order[3], DEV_HDL(TEST_GPIOX)); + zassert_equal(init_order[4], DEV_HDL(TEST_DEVB)); zassert_equal(init_order[5], DEV_HDL(TEST_DEVC)); zassert_equal(init_order[6], DEV_HDL(TEST_PARTITION)); zassert_equal(init_order[7], DEV_HDL(TEST_GPIO_INJECTED)); @@ -259,8 +258,7 @@ ZTEST(devicetree_devices, test_injected) /* TEST_GPIO_INJECTED: TEST_DEVB */ dev = device_get_binding(DEVICE_DT_NAME(TEST_GPIO_INJECTED)); hdls = device_injected_handles_get(dev, &nhdls); - zassert_equal(nhdls, 1); - zassert_true(check_handle(DEV_HDL(TEST_DEVB), hdls, nhdls)); + zassert_equal(nhdls, 0); } ZTEST(devicetree_devices, test_get_or_null) @@ -284,8 +282,7 @@ ZTEST(devicetree_devices, test_supports) /* TEST_DEVB: None */ dev = DEVICE_DT_GET(TEST_DEVB); hdls = device_supported_handles_get(dev, &nhdls); - zassert_equal(nhdls, 1); - zassert_true(check_handle(DEV_HDL(TEST_GPIO_INJECTED), hdls, nhdls)); + zassert_equal(nhdls, 0); /* TEST_GPIO_INJECTED: None */ dev = DEVICE_DT_GET(TEST_GPIO_INJECTED); diff --git a/tests/misc/check_init_priorities/src/main.c b/tests/misc/check_init_priorities/src/main.c index a9cf1c472ccbd..2252f1e27b8d8 100644 --- a/tests/misc/check_init_priorities/src/main.c +++ b/tests/misc/check_init_priorities/src/main.c @@ -9,9 +9,9 @@ DEVICE_DT_DEFINE(DT_INST(0, vnd_gpio_device), NULL, NULL, NULL, NULL, PRE_KERNEL_1, 50, NULL); DEVICE_DT_DEFINE(DT_INST(0, vnd_i2c), NULL, NULL, NULL, NULL, - PRE_KERNEL_1, 50, NULL); + PRE_KERNEL_1, 51, NULL); DEVICE_DT_DEFINE(DT_INST(0, vnd_i2c_device), NULL, NULL, NULL, NULL, PRE_KERNEL_1, 49, NULL); DEVICE_DT_DEFINE(DT_INST(1, vnd_i2c_device), NULL, NULL, NULL, NULL, - PRE_KERNEL_1, 50, NULL); + PRE_KERNEL_1, 52, NULL); diff --git a/tests/net/6lo/src/main.c b/tests/net/6lo/src/main.c index 17fbe090ab799..7ecdfe6608b96 100644 --- a/tests/net/6lo/src/main.c +++ b/tests/net/6lo/src/main.c @@ -275,9 +275,7 @@ static struct dummy_api net_6lo_if_api = { .send = tester_send, }; -NET_DEVICE_INIT(net_6lo_test, "net_6lo_test", - net_6lo_dev_init, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, +NET_DEVICE_INSTANCE(net_6lo_test, net_6lo_dev_init, NULL, NULL, NULL, &net_6lo_if_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); static bool compare_ipv6_hdr(struct net_pkt *pkt, struct net_6lo_data *data) diff --git a/tests/net/all/src/main.c b/tests/net/all/src/main.c index 7e63508f85052..2bdfe343caf35 100644 --- a/tests/net/all/src/main.c +++ b/tests/net/all/src/main.c @@ -31,17 +31,13 @@ static struct offload_context { }; /* Create blank dummy and offloaded net devices */ -NET_DEVICE_INIT(dummy_dev, "dummy_dev", +NET_DEVICE_INSTANCE(dummy_dev, NULL, NULL, NULL, NULL, - NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &dummy_dev_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 0); -NET_DEVICE_OFFLOAD_INIT(net_offload, "net_offload", - NULL, NULL, +NET_DEVICE_OFFLOAD_INSTANCE(net_offload, NULL, NULL, &offload_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &offload_dev_api, 0); ZTEST(net_compile_all_test, test_ok) diff --git a/tests/net/arp/src/main.c b/tests/net/arp/src/main.c index 022abfb54c252..0c2411c04ad0e 100644 --- a/tests/net/arp/src/main.c +++ b/tests/net/arp/src/main.c @@ -300,10 +300,8 @@ static const struct dummy_api net_arp_if_api = { #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) #endif -NET_DEVICE_INIT(net_arp_test, "net_arp_test", - net_arp_dev_init, NULL, +NET_DEVICE_INSTANCE(net_arp_test, net_arp_dev_init, NULL, &net_arp_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_arp_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); static void arp_cb(struct arp_entry *entry, void *user_data) diff --git a/tests/net/checksum_offload/src/main.c b/tests/net/checksum_offload/src/main.c index cb86c98681edb..69e5568dac2e5 100644 --- a/tests/net/checksum_offload/src/main.c +++ b/tests/net/checksum_offload/src/main.c @@ -458,19 +458,15 @@ static int eth_init(const struct device *dev) return 0; } -ETH_NET_DEVICE_INIT(eth1_offloading_disabled_test, - "eth1_offloading_disabled_test", +ETH_NET_DEVICE_INSTANCE(eth1_offloading_disabled_test, eth_init, NULL, ð_context_offloading_disabled, NULL, - CONFIG_ETH_INIT_PRIORITY, &api_funcs_offloading_disabled, NET_ETH_MTU); -ETH_NET_DEVICE_INIT(eth0_offloading_enabled_test, - "eth0_offloading_enabled_test", +ETH_NET_DEVICE_INSTANCE(eth0_offloading_enabled_test, eth_init, NULL, ð_context_offloading_enabled, NULL, - CONFIG_ETH_INIT_PRIORITY, &api_funcs_offloading_enabled, NET_ETH_MTU); diff --git a/tests/net/conn_mgr_conn/src/test_ifaces.c b/tests/net/conn_mgr_conn/src/test_ifaces.c index 535eee07de80c..dc92b6d0430de 100644 --- a/tests/net/conn_mgr_conn/src/test_ifaces.c +++ b/tests/net/conn_mgr_conn/src/test_ifaces.c @@ -32,70 +32,58 @@ static struct dummy_api test_iface_api = { * iface a1 and a2 share L2 connectivity implementation a * iface b uses connectivity implementation b */ -NET_DEVICE_INIT(test_iface_a1, - "test_iface_a1", +NET_DEVICE_INSTANCE(test_iface_a1, NULL, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &test_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); -NET_DEVICE_INIT(test_iface_a2, - "test_iface_a2", +NET_DEVICE_INSTANCE(test_iface_a2, NULL, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &test_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); -NET_DEVICE_INIT(test_iface_b, - "test_iface_b", +NET_DEVICE_INSTANCE(test_iface_b, NULL, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &test_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); /* Create an ifaces with NULL implementation, NULL init, and no connectivity at all */ -NET_DEVICE_INIT(test_iface_null, - "test_iface_null", +NET_DEVICE_INSTANCE(test_iface_null, NULL, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &test_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); -NET_DEVICE_INIT(test_iface_ni, - "test_iface_ni", +NET_DEVICE_INSTANCE(test_iface_ni, NULL, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &test_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); -NET_DEVICE_INIT(test_iface_none, - "test_iface_none", +NET_DEVICE_INSTANCE(test_iface_none, NULL, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &test_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), diff --git a/tests/net/conn_mgr_monitor/src/test_ifaces.c b/tests/net/conn_mgr_monitor/src/test_ifaces.c index 1b7a5080ec1f4..93f91e4983a87 100644 --- a/tests/net/conn_mgr_monitor/src/test_ifaces.c +++ b/tests/net/conn_mgr_monitor/src/test_ifaces.c @@ -46,49 +46,41 @@ static struct ethernet_api dummy_eth_api = { .iface_api.init = test_iface_init, }; -NET_DEVICE_INIT(test_if_simple_a, - "test_if_simple_a", +NET_DEVICE_INSTANCE(test_if_simple_a, test_iface_netdev_init, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &test_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); -NET_DEVICE_INIT(test_if_simple_b, - "test_if_simple_b", +NET_DEVICE_INSTANCE(test_if_simple_b, test_iface_netdev_init, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &test_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); -NET_DEVICE_INIT(test_if_connected_a, - "test_if_connected_a", +NET_DEVICE_INSTANCE(test_if_connected_a, test_iface_netdev_init, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &test_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); -NET_DEVICE_INIT(test_if_connected_b, - "test_if_connected_b", +NET_DEVICE_INSTANCE(test_if_connected_b, test_iface_netdev_init, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &test_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), @@ -97,13 +89,11 @@ NET_DEVICE_INIT(test_if_connected_b, /* A dummy ETHERNET_L2 iface so that we can test L2 ignore. * This iface is not properly defined, do not attempt to use it. */ -NET_DEVICE_INIT(test_if_dummy_eth, - "test_if_dummy_eth", +NET_DEVICE_INSTANCE(test_if_dummy_eth, test_iface_netdev_init, NULL, NULL, NULL, - CONFIG_ETH_INIT_PRIORITY, &dummy_eth_api, ETHERNET_L2, NET_L2_GET_CTX_TYPE(ETHERNET_L2), diff --git a/tests/net/context/src/main.c b/tests/net/context/src/main.c index 47a553a59340d..1232237992c6b 100644 --- a/tests/net/context/src/main.c +++ b/tests/net/context/src/main.c @@ -1078,10 +1078,8 @@ static struct dummy_api net_context_if_api = { #define _ETH_L2_LAYER DUMMY_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT(net_context_test, "net_context_test", - net_context_dev_init, NULL, +NET_DEVICE_INSTANCE(net_context_test, net_context_dev_init, NULL, &net_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_context_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); diff --git a/tests/net/dhcpv4/client/src/main.c b/tests/net/dhcpv4/client/src/main.c index ceddbbe9e6982..7bba1d67461a4 100644 --- a/tests/net/dhcpv4/client/src/main.c +++ b/tests/net/dhcpv4/client/src/main.c @@ -455,10 +455,8 @@ static struct dummy_api net_dhcpv4_if_api = { .send = tester_send, }; -NET_DEVICE_INIT(net_dhcpv4_test, "net_dhcpv4_test", - net_dhcpv4_dev_init, NULL, +NET_DEVICE_INSTANCE(net_dhcpv4_test, net_dhcpv4_dev_init, NULL, &net_dhcpv4_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_dhcpv4_if_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); diff --git a/tests/net/dhcpv4/server/src/main.c b/tests/net/dhcpv4/server/src/main.c index 49478c991d2c2..b86080845d480 100644 --- a/tests/net/dhcpv4/server/src/main.c +++ b/tests/net/dhcpv4/server/src/main.c @@ -128,8 +128,8 @@ static struct dummy_api server_if_api = { .send = server_send, }; -NET_DEVICE_INIT(server_iface, "server_iface", NULL, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &server_if_api, +NET_DEVICE_INSTANCE(server_iface, NULL, NULL, NULL, NULL, + &server_if_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), NET_IPV4_MTU); static const uint8_t cookie[4] = { 0x63, 0x82, 0x53, 0x63 }; diff --git a/tests/net/dhcpv6/src/main.c b/tests/net/dhcpv6/src/main.c index c5046a2746a21..5bd12d6614152 100644 --- a/tests/net/dhcpv6/src/main.c +++ b/tests/net/dhcpv6/src/main.c @@ -73,8 +73,8 @@ static struct dummy_api test_if_api = { .send = test_send, }; -NET_DEVICE_INIT(test_dhcpv6, "test_dhcpv6", NULL, NULL, &test_ctx, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &test_if_api, +NET_DEVICE_INSTANCE(test_dhcpv6, NULL, NULL, &test_ctx, NULL, + &test_if_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), NET_IPV6_MTU); static void set_dhcpv6_test_fn(test_dhcpv6_pkt_fn_t test_fn) diff --git a/tests/net/ethernet_mgmt/src/main.c b/tests/net/ethernet_mgmt/src/main.c index f020480ae8116..1ee6d59f30d8e 100644 --- a/tests/net/ethernet_mgmt/src/main.c +++ b/tests/net/ethernet_mgmt/src/main.c @@ -539,9 +539,8 @@ static int eth_fake_init(const struct device *dev) return 0; } -ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", eth_fake_init, NULL, - ð_fake_data, NULL, CONFIG_ETH_INIT_PRIORITY, - ð_fake_api_funcs, NET_ETH_MTU); +ETH_NET_DEVICE_INSTANCE(eth_fake, eth_fake_init, NULL, + ð_fake_data, NULL, ð_fake_api_funcs, NET_ETH_MTU); #if NET_LOG_LEVEL >= LOG_LEVEL_DBG static const char *iface2str(struct net_if *iface) diff --git a/tests/net/hostname/src/main.c b/tests/net/hostname/src/main.c index 762bc0efbb18a..0f92d95712d7e 100644 --- a/tests/net/hostname/src/main.c +++ b/tests/net/hostname/src/main.c @@ -139,14 +139,12 @@ static struct ethernet_api net_iface_api = { #define _ETH_L2_LAYER ETHERNET_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(ETHERNET_L2) -NET_DEVICE_INIT_INSTANCE(net_iface1_test, - "iface1", +NET_DEVICE_INSTANCE_MULTI(net_iface1_test, iface1, NULL, NULL, &net_iface1_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_iface_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, @@ -205,9 +203,8 @@ static int eth_fake_init(const struct device *dev) return 0; } -ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", eth_fake_init, NULL, - ð_fake_data, NULL, CONFIG_ETH_INIT_PRIORITY, - ð_fake_api_funcs, NET_ETH_MTU); +ETH_NET_DEVICE_INSTANCE(eth_fake, eth_fake_init, NULL, + ð_fake_data, NULL, ð_fake_api_funcs, NET_ETH_MTU); #if NET_LOG_LEVEL >= LOG_LEVEL_DBG static const char *iface2str(struct net_if *iface) diff --git a/tests/net/icmp/src/main.c b/tests/net/icmp/src/main.c index b8f077bdc10d7..6b46a1c97a28d 100644 --- a/tests/net/icmp/src/main.c +++ b/tests/net/icmp/src/main.c @@ -139,12 +139,12 @@ static struct dummy_api recv_if_api = { .send = test_receiver, }; -NET_DEVICE_INIT(test_sender_icmp, "test_sender_icmp", NULL, NULL, &send_ctx, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &send_if_api, +NET_DEVICE_INSTANCE(test_sender_icmp, NULL, NULL, &send_ctx, NULL, + &send_if_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), NET_IPV6_MTU); -NET_DEVICE_INIT(test_receiver_icmp, "test_receiver_icmp", NULL, NULL, &recv_ctx, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &recv_if_api, +NET_DEVICE_INSTANCE(test_receiver_icmp, NULL, NULL, &recv_ctx, NULL, + &recv_if_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), NET_IPV6_MTU); #if defined(CONFIG_NET_OFFLOADING_SUPPORT) @@ -419,8 +419,8 @@ static const struct net_wifi_mgmt_offload offload_api = { .wifi_iface.get_type = offload_get_type, }; -NET_DEVICE_OFFLOAD_INIT(test_offload, "test_offload", NULL, NULL, &offload_ctx, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &offload_api, 1500); +NET_DEVICE_OFFLOAD_INSTANCE(test_offload, NULL, NULL, &offload_ctx, NULL, + &offload_api, 1500); #endif /* CONFIG_NET_OFFLOADING_SUPPORT */ static int icmp_handler(struct net_icmp_ctx *ctx, diff --git a/tests/net/icmpv4/src/main.c b/tests/net/icmpv4/src/main.c index 36e9436065dba..b36cc3955b57e 100644 --- a/tests/net/icmpv4/src/main.c +++ b/tests/net/icmpv4/src/main.c @@ -306,10 +306,8 @@ static struct dummy_api net_icmpv4_if_api = { .send = tester_send, }; -NET_DEVICE_INIT(net_icmpv4_test, "net_icmpv4_test", - net_icmpv4_dev_init, NULL, +NET_DEVICE_INSTANCE(net_icmpv4_test, net_icmpv4_dev_init, NULL, &net_icmpv4_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_icmpv4_if_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); diff --git a/tests/net/icmpv6/src/main.c b/tests/net/icmpv6/src/main.c index 0ee9d3ba1276e..f8f1283ff4fab 100644 --- a/tests/net/icmpv6/src/main.c +++ b/tests/net/icmpv6/src/main.c @@ -115,10 +115,8 @@ static struct dummy_api net_icmpv6_if_api = { .send = tester_send, }; -NET_DEVICE_INIT(net_icmpv6_test, "net_icmpv6_test", - net_icmpv6_dev_init, NULL, +NET_DEVICE_INSTANCE(net_icmpv6_test, net_icmpv6_dev_init, NULL, &net_icmpv6_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_icmpv6_if_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); diff --git a/tests/net/ieee802154/6lo_fragment/src/main.c b/tests/net/ieee802154/6lo_fragment/src/main.c index 650abbed11433..8942b3d00cf9b 100644 --- a/tests/net/ieee802154/6lo_fragment/src/main.c +++ b/tests/net/ieee802154/6lo_fragment/src/main.c @@ -181,9 +181,7 @@ static struct dummy_api net_fragment_if_api = { .send = tester_send, }; -NET_DEVICE_INIT(net_fragment_test, "net_fragment_test", - net_fragment_dev_init, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, +NET_DEVICE_INSTANCE(net_fragment_test, net_fragment_dev_init, NULL, NULL, NULL, &net_fragment_if_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); diff --git a/tests/net/ieee802154/custom_l2/src/main.c b/tests/net/ieee802154/custom_l2/src/main.c index 2cecdffac167a..f32970a9f3e86 100644 --- a/tests/net/ieee802154/custom_l2/src/main.c +++ b/tests/net/ieee802154/custom_l2/src/main.c @@ -62,8 +62,7 @@ static struct ieee802154_radio_api dummy_radio_api = { .iface_api.init = dummy_iface_init, }; -NET_DEVICE_INIT(dummy, "dummy_ieee802154", NULL, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, +NET_DEVICE_INSTANCE(dummy, NULL, NULL, NULL, NULL, &dummy_radio_api, CUSTOM_IEEE802154_L2, NET_L2_GET_CTX_TYPE(CUSTOM_IEEE802154_L2), CONFIG_NET_L2_CUSTOM_IEEE802154_MTU); diff --git a/tests/net/ieee802154/l2/prj.conf b/tests/net/ieee802154/l2/prj.conf index c3a43f8a8f6b3..2ff7597b9654b 100644 --- a/tests/net/ieee802154/l2/prj.conf +++ b/tests/net/ieee802154/l2/prj.conf @@ -10,7 +10,7 @@ CONFIG_NET_LOG=y CONFIG_NET_L2_IEEE802154=y CONFIG_NET_L2_IEEE802154_SECURITY=y -CONFIG_NET_L2_IEEE802154_SECURITY_CRYPTO_DEV_NAME="CRYPTO_MTLS" +CONFIG_NET_L2_IEEE802154_SECURITY_CRYPTO_DEV_NAME="crypto_mtls" CONFIG_NET_SOCKETS=y CONFIG_NET_SOCKETS_PACKET=y diff --git a/tests/net/ieee802154/l2/service_and_device_init.yaml b/tests/net/ieee802154/l2/service_and_device_init.yaml new file mode 100644 index 0000000000000..da485c0ed943a --- /dev/null +++ b/tests/net/ieee802154/l2/service_and_device_init.yaml @@ -0,0 +1,5 @@ +device: + fake_ieee80154: + init: + dependencies: + - crypto_mtls diff --git a/tests/net/ieee802154/l2/src/ieee802154_fake_driver.c b/tests/net/ieee802154/l2/src/ieee802154_fake_driver.c index a9d36e0a3900e..324e05f4982de 100644 --- a/tests/net/ieee802154/l2/src/ieee802154_fake_driver.c +++ b/tests/net/ieee802154/l2/src/ieee802154_fake_driver.c @@ -169,8 +169,6 @@ static struct ieee802154_radio_api fake_radio_api = { .attr_get = fake_attr_get, }; -NET_DEVICE_INIT(fake, "fake_ieee802154", - fake_init, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, +NET_DEVICE_INSTANCE(fake_ieee802154, fake_init, NULL, NULL, NULL, &fake_radio_api, IEEE802154_L2, NET_L2_GET_CTX_TYPE(IEEE802154_L2), IEEE802154_MTU); diff --git a/tests/net/iface/src/main.c b/tests/net/iface/src/main.c index e47318288646b..bd4442ca516bf 100644 --- a/tests/net/iface/src/main.c +++ b/tests/net/iface/src/main.c @@ -153,40 +153,34 @@ static struct dummy_api net_iface_api = { #define _ETH_L2_LAYER DUMMY_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT_INSTANCE(net_iface1_test, - "iface1", +NET_DEVICE_INSTANCE_MULTI(net_iface1_test, iface1, dev_init, NULL, &net_iface1_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_iface_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); -NET_DEVICE_INIT_INSTANCE(net_iface2_test, - "iface2", +NET_DEVICE_INSTANCE_MULTI(net_iface2_test, iface2, NULL, NULL, &net_iface2_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_iface_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); -NET_DEVICE_INIT_INSTANCE(net_iface3_test, - "iface3", +NET_DEVICE_INSTANCE_MULTI(net_iface3_test, iface3, NULL, NULL, &net_iface3_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_iface_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, @@ -268,9 +262,8 @@ static int eth_fake_init(const struct device *dev) return 0; } -ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", eth_fake_init, NULL, - ð_fake_data, NULL, CONFIG_ETH_INIT_PRIORITY, - ð_fake_api_funcs, NET_ETH_MTU); +ETH_NET_DEVICE_INSTANCE(eth_fake, eth_fake_init, NULL, + ð_fake_data, NULL, ð_fake_api_funcs, NET_ETH_MTU); #if NET_LOG_LEVEL >= LOG_LEVEL_DBG static const char *iface2str(struct net_if *iface) diff --git a/tests/net/igmp/src/main.c b/tests/net/igmp/src/main.c index 63f4f3ea70b4b..09c0a5abb54bc 100644 --- a/tests/net/igmp/src/main.c +++ b/tests/net/igmp/src/main.c @@ -220,9 +220,7 @@ static struct dummy_api net_test_if_api = { #define _ETH_L2_LAYER DUMMY_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT(net_test_igmp, "net_test_igmp", - net_test_dev_init, NULL, &net_test_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, +NET_DEVICE_INSTANCE(net_test_igmp, net_test_dev_init, NULL, &net_test_data, NULL, &net_test_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); diff --git a/tests/net/ip-addr/src/main.c b/tests/net/ip-addr/src/main.c index 9d98c540515c3..449526dba7bf0 100644 --- a/tests/net/ip-addr/src/main.c +++ b/tests/net/ip-addr/src/main.c @@ -157,17 +157,15 @@ static struct dummy_api net_test_if_api = { #define _ETH_L2_LAYER DUMMY_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT_INSTANCE(net_addr_test1, "net_addr_test1", iface1, +NET_DEVICE_INSTANCE_MULTI(net_addr_test1, iface1, net_test_init, NULL, &net_test_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_test_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); -NET_DEVICE_INIT_INSTANCE(net_addr_test2, "net_addr_test2", iface2, +NET_DEVICE_INSTANCE_MULTI(net_addr_test2, iface2, net_test_init, NULL, &net_test_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_test_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); diff --git a/tests/net/ipv4_fragment/src/main.c b/tests/net/ipv4_fragment/src/main.c index 8e496e8097d1e..2c9475d4fc4f6 100644 --- a/tests/net/ipv4_fragment/src/main.c +++ b/tests/net/ipv4_fragment/src/main.c @@ -158,14 +158,12 @@ static struct dummy_api net_iface_api = { .send = sender_iface, }; -NET_DEVICE_INIT_INSTANCE(net_iface1_test, - "iface1", +NET_DEVICE_INSTANCE_MULTI(net_iface1_test, iface1, NULL, NULL, &net_iface_dummy_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), diff --git a/tests/net/ipv6/src/main.c b/tests/net/ipv6/src/main.c index 1dd40afcde8c4..c26a09b45a5f4 100644 --- a/tests/net/ipv6/src/main.c +++ b/tests/net/ipv6/src/main.c @@ -388,9 +388,7 @@ static const struct ethernet_api net_test_if_api = { #define _ETH_L2_LAYER ETHERNET_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(ETHERNET_L2) -NET_DEVICE_INIT(eth_ipv6_net, "eth_ipv6_net", - net_test_dev_init, NULL, &net_test_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, +NET_DEVICE_INSTANCE(eth_ipv6_net, net_test_dev_init, NULL, &net_test_data, NULL, &net_test_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, NET_ETH_MTU); @@ -437,10 +435,8 @@ static const struct dummy_api net_dummy_if_api = { #define _DUMMY_L2_LAYER DUMMY_L2 #define _DUMMY_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT(eth_ipv6_net_dummy, "eth_ipv6_net_dummy", - net_test_dev_init, NULL, &net_dummy_data, - NULL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &net_dummy_if_api, _DUMMY_L2_LAYER, _DUMMY_L2_CTX_TYPE, +NET_DEVICE_INSTANCE(eth_ipv6_net_dummy, net_test_dev_init, NULL, &net_dummy_data, + NULL, &net_dummy_if_api, _DUMMY_L2_LAYER, _DUMMY_L2_CTX_TYPE, 127); /** diff --git a/tests/net/ipv6_fragment/src/main.c b/tests/net/ipv6_fragment/src/main.c index 572d70d94d05b..bf22b4d003964 100644 --- a/tests/net/ipv6_fragment/src/main.c +++ b/tests/net/ipv6_fragment/src/main.c @@ -1583,14 +1583,12 @@ static struct dummy_api net_iface_api = { #define _ETH_L2_LAYER DUMMY_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT_INSTANCE(net_iface1_test, - "iface1", +NET_DEVICE_INSTANCE_MULTI(net_iface1_test, iface1, NULL, NULL, &net_iface1_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_iface_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, diff --git a/tests/net/lib/dns_addremove/src/main.c b/tests/net/lib/dns_addremove/src/main.c index eb8d25a5fa51a..abb366f9df44f 100644 --- a/tests/net/lib/dns_addremove/src/main.c +++ b/tests/net/lib/dns_addremove/src/main.c @@ -125,14 +125,12 @@ static struct dummy_api net_iface_api = { #define _ETH_L2_LAYER DUMMY_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT_INSTANCE(net_iface1_test, - "iface1", +NET_DEVICE_INSTANCE_MULTI(net_iface1_test, iface1, NULL, NULL, &net_iface1_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_iface_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, diff --git a/tests/net/lib/dns_resolve/src/main.c b/tests/net/lib/dns_resolve/src/main.c index c5d17941087b2..308f9e5dcd527 100644 --- a/tests/net/lib/dns_resolve/src/main.c +++ b/tests/net/lib/dns_resolve/src/main.c @@ -187,14 +187,12 @@ static struct dummy_api net_iface_api = { #define _ETH_L2_LAYER DUMMY_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT_INSTANCE(net_iface1_test, - "iface1", +NET_DEVICE_INSTANCE_MULTI(net_iface1_test, iface1, NULL, NULL, &net_iface1_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_iface_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, diff --git a/tests/net/lib/mdns_responder/src/main.c b/tests/net/lib/mdns_responder/src/main.c index 25a50ffe5cfbe..1e146da68a348 100644 --- a/tests/net/lib/mdns_responder/src/main.c +++ b/tests/net/lib/mdns_responder/src/main.c @@ -169,14 +169,12 @@ static struct dummy_api net_iface_api = { #define _ETH_L2_LAYER DUMMY_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT_INSTANCE(net_iface1_test, - "iface1", +NET_DEVICE_INSTANCE_MULTI(net_iface1_test, iface1, NULL, NULL, &net_iface1_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_iface_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, diff --git a/tests/net/mgmt/src/mgmt.c b/tests/net/mgmt/src/mgmt.c index 004b60adb9710..883888dc31d88 100644 --- a/tests/net/mgmt/src/mgmt.c +++ b/tests/net/mgmt/src/mgmt.c @@ -120,10 +120,8 @@ static struct dummy_api fake_iface_api = { .send = fake_iface_send, }; -NET_DEVICE_INIT(net_event_test, "net_event_test", - fake_dev_init, NULL, - NULL, NULL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &fake_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); +NET_DEVICE_INSTANCE(net_event_test, fake_dev_init, NULL, + NULL, NULL, &fake_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); void test_requesting_nm(void) { diff --git a/tests/net/mld/src/main.c b/tests/net/mld/src/main.c index 1c95fe5409dcf..f44ceaac8fced 100644 --- a/tests/net/mld/src/main.c +++ b/tests/net/mld/src/main.c @@ -202,15 +202,13 @@ static struct dummy_api net_test_null_if_api = { #define _ETH_L2_LAYER DUMMY_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT(net_test_mld, "net_test_mld", - net_test_dev_init, NULL, &net_test_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, +NET_DEVICE_INSTANCE(net_test_mld, net_test_dev_init, NULL, &net_test_data, NULL, &net_test_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); /* Interface without a device or API, only for usage of `struct net_if` */ -NET_DEVICE_INIT(net_test_null_iface, "net_test_null_iface", net_test_dev_init, NULL, - &net_test_null_data, NULL, 99, &net_test_null_if_api, _ETH_L2_LAYER, +NET_DEVICE_INSTANCE(net_test_null_iface, net_test_dev_init, NULL, + &net_test_null_data, NULL, &net_test_null_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); static void test_iface_down_up(void) diff --git a/tests/net/net_pkt/src/main.c b/tests/net/net_pkt/src/main.c index ca50aafc98e85..4b3e9fb23d08d 100644 --- a/tests/net/net_pkt/src/main.c +++ b/tests/net/net_pkt/src/main.c @@ -75,9 +75,7 @@ static const struct dummy_api fake_dev_api = { #define L2_HDR_SIZE 0 #endif -NET_DEVICE_INIT(fake_dev, "fake_dev", - fake_dev_init, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, +NET_DEVICE_INSTANCE(fake_dev, fake_dev_init, NULL, NULL, NULL, &fake_dev_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, NET_ETH_MTU); diff --git a/tests/net/npf/src/main.c b/tests/net/npf/src/main.c index 39aa63daac201..ba71ff157a377 100644 --- a/tests/net/npf/src/main.c +++ b/tests/net/npf/src/main.c @@ -104,12 +104,10 @@ static struct net_pkt *build_test_ip_pkt(void *src, void *dst, * Declare some fake interfaces and test their filter conditions. */ -ETH_NET_DEVICE_INIT(dummy_iface_a, "dummy_a", NULL, NULL, - NULL, NULL, CONFIG_ETH_INIT_PRIORITY, - NULL, NET_ETH_MTU); -ETH_NET_DEVICE_INIT(dummy_iface_b, "dummy_b", NULL, NULL, - NULL, NULL, CONFIG_ETH_INIT_PRIORITY, - NULL, NET_ETH_MTU); +ETH_NET_DEVICE_INSTANCE(dummy_iface_a, NULL, NULL, + NULL, NULL, NULL, NET_ETH_MTU); +ETH_NET_DEVICE_INSTANCE(dummy_iface_b, NULL, NULL, + NULL, NULL, NULL, NET_ETH_MTU); #define dummy_iface_a NET_IF_GET_NAME(dummy_iface_a, 0)[0] #define dummy_iface_b NET_IF_GET_NAME(dummy_iface_b, 0)[0] diff --git a/tests/net/offloaded_netdev/src/main.c b/tests/net/offloaded_netdev/src/main.c index becc0488102f1..4ae895e979350 100644 --- a/tests/net/offloaded_netdev/src/main.c +++ b/tests/net/offloaded_netdev/src/main.c @@ -100,25 +100,17 @@ static struct offloaded_if_api net_offloaded_no_impl_api = { /* Socket-offloaded netdevs, with and without .enable */ -NET_DEVICE_OFFLOAD_INIT(sock_offload_test_impl, "sock_offload_test_impl", - NULL, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, +NET_DEVICE_OFFLOAD_INSTANCE(sock_offload_test_impl, NULL, NULL, NULL, NULL, &sock_offloaded_impl_api, 0); -NET_DEVICE_OFFLOAD_INIT(sock_offload_test_no_impl, "sock_offload_test_no_impl", - NULL, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, +NET_DEVICE_OFFLOAD_INSTANCE(sock_offload_test_no_impl, NULL, NULL, NULL, NULL, &sock_offloaded_no_impl_api, 0); /* Net-offloaded netdevs, with and without .enable */ -NET_DEVICE_OFFLOAD_INIT(net_offload_test_impl, "net_offload_test_impl", - NULL, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, +NET_DEVICE_OFFLOAD_INSTANCE(net_offload_test_impl, NULL, NULL, NULL, NULL, &net_offloaded_impl_api, 0); -NET_DEVICE_OFFLOAD_INIT(net_offload_test_no_impl, "net_offload_test_no_impl", - NULL, NULL, NULL, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, +NET_DEVICE_OFFLOAD_INSTANCE(net_offload_test_no_impl, NULL, NULL, NULL, NULL, &net_offloaded_no_impl_api, 0); static void net_offloaded_netdev_before(void *fixture) diff --git a/tests/net/pm/src/main.c b/tests/net/pm/src/main.c index 17078406a4d40..27c70a418b47a 100644 --- a/tests/net/pm/src/main.c +++ b/tests/net/pm/src/main.c @@ -95,10 +95,8 @@ static struct dummy_api fake_dev_if_api = { PM_DEVICE_DEFINE(fake_dev, fake_dev_pm_action); -NET_DEVICE_INIT(fake_dev, "fake_dev", - NULL, PM_DEVICE_GET(fake_dev), +NET_DEVICE_INSTANCE(fake_dev, NULL, PM_DEVICE_GET(fake_dev), &fake_dev_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &fake_dev_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); void *test_setup(void) diff --git a/tests/net/promiscuous/src/main.c b/tests/net/promiscuous/src/main.c index 364917b7de34f..2c5ed635e880b 100644 --- a/tests/net/promiscuous/src/main.c +++ b/tests/net/promiscuous/src/main.c @@ -142,15 +142,11 @@ static int eth_fake_init(const struct device *dev) return 0; } -ETH_NET_DEVICE_INIT(eth_fake1, "eth_fake1", - eth_fake_init, NULL, - ð_fake_data1, NULL, CONFIG_ETH_INIT_PRIORITY, - ð_fake_api_funcs, NET_ETH_MTU); - -ETH_NET_DEVICE_INIT(eth_fake2, "eth_fake2", - eth_fake_init, NULL, - ð_fake_data2, NULL, CONFIG_ETH_INIT_PRIORITY, - ð_fake_api_funcs, NET_ETH_MTU); +ETH_NET_DEVICE_INSTANCE(eth_fake1, eth_fake_init, NULL, + ð_fake_data1, NULL, ð_fake_api_funcs, NET_ETH_MTU); + +ETH_NET_DEVICE_INSTANCE(eth_fake2, eth_fake_init, NULL, + ð_fake_data2, NULL, ð_fake_api_funcs, NET_ETH_MTU); #if NET_LOG_LEVEL >= LOG_LEVEL_DBG static const char *iface2str(struct net_if *iface) diff --git a/tests/net/ptp/clock/src/main.c b/tests/net/ptp/clock/src/main.c index 53d46db76c62d..65ad7e2df47d0 100644 --- a/tests/net/ptp/clock/src/main.c +++ b/tests/net/ptp/clock/src/main.c @@ -159,16 +159,16 @@ static int eth_init(const struct device *dev) return 0; } -ETH_NET_DEVICE_INIT(eth3_test, "eth3_test", eth_init, NULL, - ð_context_3, NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs, +ETH_NET_DEVICE_INSTANCE(eth3_test, eth_init, NULL, + ð_context_3, NULL, &api_funcs, NET_ETH_MTU); -ETH_NET_DEVICE_INIT(eth2_test, "eth2_test", eth_init, NULL, - ð_context_2, NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs, +ETH_NET_DEVICE_INSTANCE(eth2_test, eth_init, NULL, + ð_context_2, NULL, &api_funcs, NET_ETH_MTU); -ETH_NET_DEVICE_INIT(eth1_test, "eth1_test", eth_init, NULL, - ð_context_1, NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs, +ETH_NET_DEVICE_INSTANCE(eth1_test, eth_init, NULL, + ð_context_1, NULL, &api_funcs, NET_ETH_MTU); static uint64_t timestamp_to_nsec(struct net_ptp_time *ts) @@ -245,9 +245,9 @@ static int ptp_test_1_init(const struct device *port) return 0; } -DEVICE_DEFINE(ptp_clock_1, PTP_VIRT_CLOCK_NAME, ptp_test_1_init, +DEVICE_INSTANCE(ptp_clock_1, ptp_test_1_init, NULL, &ptp_test_1_context, NULL, - POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY, &api); + POST_KERNEL, &api); static int ptp_test_2_init(const struct device *port) { @@ -261,9 +261,9 @@ static int ptp_test_2_init(const struct device *port) return 0; } -DEVICE_DEFINE(ptp_clock_2, PTP_VIRT_CLOCK_NAME, ptp_test_2_init, +DEVICE_INSTANCE(ptp_clock_2, ptp_test_2_init, NULL, &ptp_test_2_context, NULL, - POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY, &api); + POST_KERNEL, &api); struct user_data { int eth_if_count; diff --git a/tests/net/route/src/main.c b/tests/net/route/src/main.c index dcdf48cb12e80..645ccc0482e72 100644 --- a/tests/net/route/src/main.c +++ b/tests/net/route/src/main.c @@ -221,17 +221,15 @@ static struct dummy_api net_route_if_api_peer = { #define _ETH_L2_LAYER DUMMY_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT_INSTANCE(net_route_test, "net_route_test", host, +NET_DEVICE_INSTANCE_MULTI(net_route_test, host, net_route_dev_init, NULL, &net_route_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_route_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); -NET_DEVICE_INIT_INSTANCE(net_route_test_peer, "net_route_test_peer", peer, +NET_DEVICE_INSTANCE_MULTI(net_route_test_peer, peer, net_route_dev_init, NULL, &net_route_data_peer, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_route_if_api_peer, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); diff --git a/tests/net/route_mcast/src/main.c b/tests/net/route_mcast/src/main.c index be30a79462d8e..586095d0b1e1a 100644 --- a/tests/net/route_mcast/src/main.c +++ b/tests/net/route_mcast/src/main.c @@ -266,24 +266,21 @@ static struct dummy_api net_route_mcast_if_api_3 = { #define _ETH_L2_LAYER DUMMY_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT_INSTANCE(mcast_iface_1, "mcast_iface_1", iface_1, +NET_DEVICE_INSTANCE_MULTI(mcast_iface_1, iface_1, net_route_mcast_dev_init, NULL, &net_route_data_if1, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_route_mcast_if_api_1, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); -NET_DEVICE_INIT_INSTANCE(mcast_iface_2, "mcast_iface_2", iface_2, +NET_DEVICE_INSTANCE_MULTI(mcast_iface_2, iface_2, net_route_mcast_dev_init, NULL, &net_route_data_if2, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_route_mcast_if_api_2, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); -NET_DEVICE_INIT_INSTANCE(mcast_iface_3, "mcast_iface_3", iface_3, +NET_DEVICE_INSTANCE_MULTI(mcast_iface_3, iface_3, net_route_mcast_dev_init, NULL, &net_route_data_if3, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_route_mcast_if_api_3, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); diff --git a/tests/net/shell/src/main.c b/tests/net/shell/src/main.c index 39ef093b4e3df..b7eb0e05eb032 100644 --- a/tests/net/shell/src/main.c +++ b/tests/net/shell/src/main.c @@ -135,10 +135,8 @@ static struct dummy_api net_udp_if_api = { #define _ETH_L2_LAYER DUMMY_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT(net_udp_test, "net_udp_test", - net_udp_dev_init, NULL, +NET_DEVICE_INSTANCE(net_udp_test, net_udp_dev_init, NULL, &net_udp_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_udp_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); static void *test_setup(void) diff --git a/tests/net/socket/af_packet/src/main.c b/tests/net/socket/af_packet/src/main.c index df0cb8de5334f..86247e3fa609b 100644 --- a/tests/net/socket/af_packet/src/main.c +++ b/tests/net/socket/af_packet/src/main.c @@ -95,12 +95,12 @@ static struct ethernet_api eth_fake_api_funcs = { .send = eth_fake_send, }; -ETH_NET_DEVICE_INIT(eth_fake1, "eth_fake1", NULL, NULL, ð_fake_data1, NULL, - CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs, +ETH_NET_DEVICE_INSTANCE(eth_fake1, NULL, NULL, ð_fake_data1, NULL, + ð_fake_api_funcs, NET_ETH_MTU); -ETH_NET_DEVICE_INIT(eth_fake2, "eth_fake2", NULL, NULL, ð_fake_data2, NULL, - CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs, +ETH_NET_DEVICE_INSTANCE(eth_fake2, NULL, NULL, ð_fake_data2, NULL, + ð_fake_api_funcs, NET_ETH_MTU); static int setup_socket(struct net_if *iface, int type, int proto) diff --git a/tests/net/socket/af_packet_ipproto_raw/src/main.c b/tests/net/socket/af_packet_ipproto_raw/src/main.c index 4eb28edb70ffc..99a6c52687d4d 100644 --- a/tests/net/socket/af_packet_ipproto_raw/src/main.c +++ b/tests/net/socket/af_packet_ipproto_raw/src/main.c @@ -90,8 +90,8 @@ static struct dummy_api fake_dev_if_api = { #define _ETH_L2_LAYER DUMMY_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT(fake_dev, "fake_dev", fake_dev_init, NULL, &fake_dev_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &fake_dev_if_api, _ETH_L2_LAYER, +NET_DEVICE_INSTANCE(fake_dev, fake_dev_init, NULL, &fake_dev_context_data, NULL, + &fake_dev_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); static void *test_setup(void) diff --git a/tests/net/socket/misc/src/main.c b/tests/net/socket/misc/src/main.c index 32b0430aeabd0..085c87f53d743 100644 --- a/tests/net/socket/misc/src/main.c +++ b/tests/net/socket/misc/src/main.c @@ -146,21 +146,17 @@ static struct dummy_api dummy_api_funcs = { .send = dummy_send, }; -#if defined(CONFIG_NET_INTERFACE_NAME) #define DEV1_NAME "dummy0" #define DEV2_NAME "dummy1" -#else -#define DEV1_NAME "dummy_1" -#define DEV2_NAME "dummy_2" -#endif -NET_DEVICE_INIT(dummy_1, DEV1_NAME, NULL, NULL, &dummy_data1, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &dummy_api_funcs, + +NET_DEVICE_INSTANCE(dummy0, NULL, NULL, &dummy_data1, NULL, + &dummy_api_funcs, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); -NET_DEVICE_INIT(dummy_2, DEV2_NAME, NULL, NULL, &dummy_data2, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &dummy_api_funcs, +NET_DEVICE_INSTANCE(dummy1, NULL, NULL, &dummy_data2, NULL, + &dummy_api_funcs, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); #define DST_PORT 4242 diff --git a/tests/net/socket/net_mgmt/src/main.c b/tests/net/socket/net_mgmt/src/main.c index 455ae3e0d049a..e7c591e553574 100644 --- a/tests/net/socket/net_mgmt/src/main.c +++ b/tests/net/socket/net_mgmt/src/main.c @@ -264,9 +264,8 @@ static int eth_fake_init(const struct device *dev) return 0; } -ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", eth_fake_init, NULL, - ð_fake_data, NULL, CONFIG_ETH_INIT_PRIORITY, - ð_fake_api_funcs, NET_ETH_MTU); +ETH_NET_DEVICE_INSTANCE(eth_fake, eth_fake_init, NULL, + ð_fake_data, NULL, ð_fake_api_funcs, NET_ETH_MTU); /* A test thread that spits out events that we can catch and show to user */ static void trigger_events(void) diff --git a/tests/net/socket/offload_dispatcher/src/main.c b/tests/net/socket/offload_dispatcher/src/main.c index 2437ee1e11814..d0c96a4037e2c 100644 --- a/tests/net/socket/offload_dispatcher/src/main.c +++ b/tests/net/socket/offload_dispatcher/src/main.c @@ -303,8 +303,8 @@ static struct offloaded_if_api offloaded_1_if_api = { .iface_api.init = offloaded_1_iface_init, }; -NET_DEVICE_OFFLOAD_INIT(offloaded_1, "offloaded_1", NULL, NULL, - NULL, NULL, 0, &offloaded_1_if_api, 1500); +NET_DEVICE_OFFLOAD_INSTANCE(offloaded_1, NULL, NULL, + NULL, NULL, &offloaded_1_if_api, 1500); /* Offloaded interface 2 - low priority */ @@ -365,8 +365,8 @@ static struct offloaded_if_api offloaded_2_if_api = { .iface_api.init = offloaded_2_iface_init, }; -NET_DEVICE_OFFLOAD_INIT(offloaded_2, "offloaded_2", NULL, NULL, - NULL, NULL, 0, &offloaded_2_if_api, 1500); +NET_DEVICE_OFFLOAD_INSTANCE(offloaded_2, NULL, NULL, + NULL, NULL, &offloaded_2_if_api, 1500); /* Native dummy interface */ @@ -396,8 +396,8 @@ static const struct dummy_api dummy_native_dev_api = { .send = dummy_native_dev_send, }; -NET_DEVICE_INIT(dummy_native, "dummy_native", NULL, NULL, NULL, - NULL, 0, &dummy_native_dev_api, DUMMY_L2, +NET_DEVICE_INSTANCE(dummy_native, NULL, NULL, NULL, + NULL, &dummy_native_dev_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 1500); /* Actual tests */ diff --git a/tests/net/socket/udp/src/main.c b/tests/net/socket/udp/src/main.c index ac06590c71ce3..d50b333473f5d 100644 --- a/tests/net/socket/udp/src/main.c +++ b/tests/net/socket/udp/src/main.c @@ -1004,8 +1004,8 @@ static struct ethernet_api eth_fake_api_funcs = { .send = eth_fake_send, }; -ETH_NET_DEVICE_INIT(eth_fake, "eth_fake", NULL, NULL, ð_fake_data, NULL, - CONFIG_ETH_INIT_PRIORITY, ð_fake_api_funcs, NET_ETH_MTU); +ETH_NET_DEVICE_INSTANCE(eth_fake, NULL, NULL, ð_fake_data, NULL, + ð_fake_api_funcs, NET_ETH_MTU); static void iface_cb(struct net_if *iface, void *user_data) { diff --git a/tests/net/tcp/src/main.c b/tests/net/tcp/src/main.c index bf6764b9c86b8..256044018875b 100644 --- a/tests/net/tcp/src/main.c +++ b/tests/net/tcp/src/main.c @@ -197,10 +197,8 @@ static struct dummy_api net_tcp_if_api = { .send = tester_send, }; -NET_DEVICE_INIT(net_tcp_test, "net_tcp_test", - net_tcp_dev_init, NULL, +NET_DEVICE_INSTANCE(net_tcp_test, net_tcp_dev_init, NULL, &net_tcp_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_tcp_if_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); diff --git a/tests/net/traffic_class/src/main.c b/tests/net/traffic_class/src/main.c index 3ef933e8e23f2..d22d59e8cce47 100644 --- a/tests/net/traffic_class/src/main.c +++ b/tests/net/traffic_class/src/main.c @@ -270,8 +270,8 @@ static int eth_init(const struct device *dev) * is quite unlikely that this would be done in real life but for testing * purposes create it here. */ -NET_DEVICE_INIT(eth_test, "eth_test", eth_init, NULL, - ð_context, NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs, +NET_DEVICE_INSTANCE(eth_test, eth_init, NULL, + ð_context, NULL, &api_funcs, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), NET_ETH_MTU); diff --git a/tests/net/tx_timestamp/src/main.c b/tests/net/tx_timestamp/src/main.c index 05e670ec4ced7..66619e75eb47c 100644 --- a/tests/net/tx_timestamp/src/main.c +++ b/tests/net/tx_timestamp/src/main.c @@ -153,12 +153,12 @@ static int eth_init(const struct device *dev) return 0; } -ETH_NET_DEVICE_INIT(eth_test, "eth_test", eth_init, NULL, - ð_context, NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs, +ETH_NET_DEVICE_INSTANCE(eth_test, eth_init, NULL, + ð_context, NULL, &api_funcs, NET_ETH_MTU); -ETH_NET_DEVICE_INIT(eth_test2, "eth_test2", eth_init, NULL, - ð_context2, NULL, CONFIG_ETH_INIT_PRIORITY, &api_funcs, +ETH_NET_DEVICE_INSTANCE(eth_test2, eth_init, NULL, + ð_context2, NULL, &api_funcs, NET_ETH_MTU); static void timestamp_callback(struct net_pkt *pkt) diff --git a/tests/net/udp/src/main.c b/tests/net/udp/src/main.c index f06ee2edc77c4..bc747feaae594 100644 --- a/tests/net/udp/src/main.c +++ b/tests/net/udp/src/main.c @@ -137,10 +137,8 @@ static struct dummy_api net_udp_if_api = { #define _ETH_L2_LAYER DUMMY_L2 #define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2) -NET_DEVICE_INIT(net_udp_test, "net_udp_test", - net_udp_dev_init, NULL, +NET_DEVICE_INSTANCE(net_udp_test, net_udp_dev_init, NULL, &net_udp_context_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_udp_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127); struct ud { diff --git a/tests/net/virtual/src/main.c b/tests/net/virtual/src/main.c index 12dacdaea063c..f8cf5c3e7604b 100644 --- a/tests/net/virtual/src/main.c +++ b/tests/net/virtual/src/main.c @@ -187,10 +187,8 @@ static int eth_init(const struct device *dev) return 0; } -ETH_NET_DEVICE_INIT(eth_test, "eth_test", - eth_init, NULL, - ð_context, NULL, CONFIG_ETH_INIT_PRIORITY, - &api_funcs, NET_ETH_MTU); +ETH_NET_DEVICE_INSTANCE(eth_test, eth_init, NULL, + ð_context, NULL, &api_funcs, NET_ETH_MTU); struct net_if_test { uint8_t idx; /* not used for anything, just a dummy value */ @@ -242,27 +240,23 @@ static struct dummy_api net_iface_api = { /* For testing purposes, create two dummy network interfaces so we can check * that attaching virtual interface work ok. */ -NET_DEVICE_INIT_INSTANCE(eth_test_dummy1, - "iface1", +NET_DEVICE_INSTANCE_MULTI(eth_test_dummy1, iface1, NULL, NULL, &net_iface1_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); -NET_DEVICE_INIT_INSTANCE(eth_test_dummy2, - "iface2", +NET_DEVICE_INSTANCE_MULTI(eth_test_dummy2, iface2, NULL, NULL, &net_iface2_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), diff --git a/tests/net/vlan/src/main.c b/tests/net/vlan/src/main.c index a6d2f88a892e2..8c8536f0d2de4 100644 --- a/tests/net/vlan/src/main.c +++ b/tests/net/vlan/src/main.c @@ -191,10 +191,8 @@ static int eth_vlan_init(const struct device *dev) return 0; } -ETH_NET_DEVICE_INIT(eth_vlan_test, "eth_vlan_test", - eth_vlan_init, NULL, - ð_vlan_context, NULL, CONFIG_ETH_INIT_PRIORITY, - &api_funcs, NET_ETH_MTU); +ETH_NET_DEVICE_INSTANCE(eth_vlan_test, eth_vlan_init, NULL, + ð_vlan_context, NULL, &api_funcs, NET_ETH_MTU); static int eth_init(const struct device *dev) { @@ -205,9 +203,8 @@ static int eth_init(const struct device *dev) return 0; } -ETH_NET_DEVICE_INIT(eth_test, "eth_test", eth_init, NULL, - ð_vlan_context, NULL, CONFIG_ETH_INIT_PRIORITY, - &api_funcs, NET_ETH_MTU); +ETH_NET_DEVICE_INSTANCE(eth_test, eth_init, NULL, + ð_vlan_context, NULL, &api_funcs, NET_ETH_MTU); struct net_if_test { uint8_t idx; /* not used for anything, just a dummy value */ @@ -257,27 +254,23 @@ static struct dummy_api net_iface_api = { /* For testing purposes, create two dummy network interfaces so we can check * that no VLANs are created for it. */ -NET_DEVICE_INIT_INSTANCE(net_iface1_test, - "iface1", +NET_DEVICE_INSTANCE_MULTI(net_iface1_test, iface1, NULL, NULL, &net_iface1_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127); -NET_DEVICE_INIT_INSTANCE(net_iface2_test, - "iface2", +NET_DEVICE_INSTANCE_MULTI(net_iface2_test, iface2, NULL, NULL, &net_iface2_data, NULL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &net_iface_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), diff --git a/tests/net/wifi/wifi_nm/src/main.c b/tests/net/wifi/wifi_nm/src/main.c index fb67601823d08..dcf147a0cdcf7 100644 --- a/tests/net/wifi/wifi_nm/src/main.c +++ b/tests/net/wifi/wifi_nm/src/main.c @@ -101,10 +101,8 @@ static int wifi_init(const struct device *dev) return 0; } -ETH_NET_DEVICE_INIT(wlan0, "wifi_test", - wifi_init, NULL, - &wifi_context, NULL, CONFIG_ETH_INIT_PRIORITY, - &api_funcs, NET_ETH_MTU); +ETH_NET_DEVICE_INSTANCE(wlan0, wifi_init, NULL, + &wifi_context, NULL, &api_funcs, NET_ETH_MTU); static int wifi_nm_scan(const struct device *dev, struct wifi_scan_params *params, scan_result_cb_t cb) diff --git a/tests/subsys/edac/ibecc/src/dummy.c b/tests/subsys/edac/ibecc/src/dummy.c index f9ea4beca2375..5da0d7dcc7efa 100644 --- a/tests/subsys/edac/ibecc/src/dummy.c +++ b/tests/subsys/edac/ibecc/src/dummy.c @@ -16,10 +16,9 @@ static const struct edac_driver_api edac_dummy_api = { 0 }; -DEVICE_DEFINE(dummy_edac, "dummy_edac", NULL, NULL, +DEVICE_INSTANCE(dummy_edac, NULL, NULL, NULL, NULL, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, - &edac_dummy_api); + POST_KERNEL, &edac_dummy_api); ZTEST(ibecc, test_edac_dummy_api) { diff --git a/tests/subsys/fs/multi-fs/src/test_ram_backend.c b/tests/subsys/fs/multi-fs/src/test_ram_backend.c index 94f4c354a39e7..2f07e05003052 100644 --- a/tests/subsys/fs/multi-fs/src/test_ram_backend.c +++ b/tests/subsys/fs/multi-fs/src/test_ram_backend.c @@ -84,5 +84,5 @@ static const struct flash_driver_api flash_ram_api = { .page_layout = test_flash_ram_pages_layout, }; -DEVICE_DEFINE(flash_ram_test, "ram_flash_test_drv", NULL, NULL, NULL, NULL, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &flash_ram_api); +DEVICE_INSTANCE(flash_ram_test, NULL, NULL, NULL, NULL, + POST_KERNEL, &flash_ram_api); diff --git a/tests/subsys/input/kbd_matrix_state_dump/src/main.c b/tests/subsys/input/kbd_matrix_state_dump/src/main.c index 42e3f532cdc30..b58e0a7f4a7fa 100644 --- a/tests/subsys/input/kbd_matrix_state_dump/src/main.c +++ b/tests/subsys/input/kbd_matrix_state_dump/src/main.c @@ -16,9 +16,9 @@ static const struct input_kbd_matrix_common_config test_cfg = { .col_size = 4, }; -DEVICE_DEFINE(kbd_matrix, "kbd-matrix", NULL, NULL, +DEVICE_INSTANCE(kbd_matrix, NULL, NULL, NULL, &test_cfg, - POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, NULL); + POST_KERNEL, NULL); static void report_matrix_entry(int row, int col, int val) { @@ -34,7 +34,7 @@ int main(void) const struct shell *sh = shell_backend_dummy_get_ptr(); int err; - err = shell_execute_cmd(sh, "input kbd_matrix_state_dump kbd-matrix"); + err = shell_execute_cmd(sh, "input kbd_matrix_state_dump kbd_matrix"); if (err) { printf("Failed to execute the shell command: %d\n", err); } diff --git a/tests/subsys/ipc/ipc_service/src/backend.c b/tests/subsys/ipc/ipc_service/src/backend.c index a7e055edb809a..0d3e92b6e16f3 100644 --- a/tests/subsys/ipc/ipc_service/src/backend.c +++ b/tests/subsys/ipc/ipc_service/src/backend.c @@ -75,13 +75,12 @@ const static struct ipc_service_backend backend_ops = { \ static struct backend_data_t backend_data_##i; \ \ - DEVICE_DT_INST_DEFINE(i, \ + DEVICE_INSTANCE_FROM_DT_INST(i, \ NULL, \ NULL, \ &backend_data_##i, \ &backend_config_##i, \ POST_KERNEL, \ - CONFIG_IPC_SERVICE_REG_BACKEND_PRIORITY, \ &backend_ops); DT_INST_FOREACH_STATUS_OKAY(DEFINE_BACKEND_DEVICE) diff --git a/tests/subsys/openthread/radio_test.c b/tests/subsys/openthread/radio_test.c index 8c7a9fcb79e48..26c9f5a804f48 100644 --- a/tests/subsys/openthread/radio_test.c +++ b/tests/subsys/openthread/radio_test.c @@ -71,7 +71,7 @@ static struct ieee802154_radio_api rapi = {.get_capabilities = get_capabilities, .ed_scan = scan_mock}; #define DT_DRV_COMPAT vnd_ieee802154 -DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, NULL, POST_KERNEL, 0, &rapi); +DEVICE_INSTANCE_FROM_DT_INST(0, NULL, NULL, NULL, NULL, POST_KERNEL, &rapi); static const struct device *const radio = DEVICE_DT_INST_GET(0); diff --git a/tests/subsys/pm/device_power_domains/src/main.c b/tests/subsys/pm/device_power_domains/src/main.c index 6b19d33a57ab9..0e04d98081329 100644 --- a/tests/subsys/pm/device_power_domains/src/main.c +++ b/tests/subsys/pm/device_power_domains/src/main.c @@ -26,8 +26,8 @@ int dev_pm_control(const struct device *dev, enum pm_device_action action) } PM_DEVICE_DT_DEFINE(DT_NODELABEL(test_dev), dev_pm_control); -DEVICE_DT_DEFINE(DT_NODELABEL(test_dev), dev_init, PM_DEVICE_DT_GET(DT_NODELABEL(test_dev)), - NULL, NULL, POST_KERNEL, 80, NULL); +DEVICE_INSTANCE(DT_NODELABEL(test_dev), dev_init, PM_DEVICE_DT_GET(DT_NODELABEL(test_dev)), + NULL, NULL, POST_KERNEL, NULL); ZTEST(device_power_domain, test_device_power_domain) { diff --git a/tests/subsys/pm/device_runtime_api/src/main.c b/tests/subsys/pm/device_runtime_api/src/main.c index ba4482ac8f300..e586d4698cf75 100644 --- a/tests/subsys/pm/device_runtime_api/src/main.c +++ b/tests/subsys/pm/device_runtime_api/src/main.c @@ -261,8 +261,8 @@ ZTEST(device_runtime_api, test_api) zassert_equal(pm_device_runtime_usage(test_dev), -ENOTSUP); } -DEVICE_DEFINE(pm_unsupported_device, "PM Unsupported", NULL, NULL, NULL, NULL, - POST_KERNEL, 0, NULL); +DEVICE_INSTANCE(pm_unsupported_device, NULL, NULL, NULL, NULL, + POST_KERNEL, NULL); ZTEST(device_runtime_api, test_unsupported) { @@ -285,8 +285,8 @@ int dev_pm_control(const struct device *dev, enum pm_device_action action) } PM_DEVICE_DT_DEFINE(DT_NODELABEL(test_dev), dev_pm_control); -DEVICE_DT_DEFINE(DT_NODELABEL(test_dev), NULL, PM_DEVICE_DT_GET(DT_NODELABEL(test_dev)), - NULL, NULL, POST_KERNEL, 80, NULL); +DEVICE_INSTANCE(DT_NODELABEL(test_dev), NULL, PM_DEVICE_DT_GET(DT_NODELABEL(test_dev)), + NULL, NULL, POST_KERNEL, NULL); ZTEST(device_runtime_api, test_pm_device_runtime_auto) { diff --git a/tests/subsys/pm/device_runtime_api/src/test_driver.c b/tests/subsys/pm/device_runtime_api/src/test_driver.c index 48dd4385cbc03..5762518e331c5 100644 --- a/tests/subsys/pm/device_runtime_api/src/test_driver.c +++ b/tests/subsys/pm/device_runtime_api/src/test_driver.c @@ -80,6 +80,6 @@ PM_DEVICE_DEFINE(test_driver, test_driver_action, PM_DEVICE_TYPE); static struct test_driver_data data; -DEVICE_DEFINE(test_driver, "test_driver", &test_driver_init, +DEVICE_INSTANCE(test_driver, &test_driver_init, PM_DEVICE_GET(test_driver), &data, NULL, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, NULL); + NULL); diff --git a/tests/subsys/pm/power_domain/src/main.c b/tests/subsys/pm/power_domain/src/main.c index 3c4e1882890dc..70962fb691a5b 100644 --- a/tests/subsys/pm/power_domain/src/main.c +++ b/tests/subsys/pm/power_domain/src/main.c @@ -92,20 +92,20 @@ static int devb_pm_action(const struct device *dev, PM_DEVICE_DT_DEFINE(TEST_DOMAIN, domain_pm_action); -DEVICE_DT_DEFINE(TEST_DOMAIN, NULL, PM_DEVICE_DT_GET(TEST_DOMAIN), - NULL, NULL, POST_KERNEL, 10, NULL); +DEVICE_INSTANCE(TEST_DOMAIN, NULL, PM_DEVICE_DT_GET(TEST_DOMAIN), + NULL, NULL, POST_KERNEL, NULL); PM_DEVICE_DT_DEFINE(TEST_DEVA, deva_pm_action); -DEVICE_DT_DEFINE(TEST_DEVA, NULL, PM_DEVICE_DT_GET(TEST_DEVA), - NULL, NULL, POST_KERNEL, 20, NULL); +DEVICE_INSTANCE(TEST_DEVA, NULL, PM_DEVICE_DT_GET(TEST_DEVA), + NULL, NULL, POST_KERNEL, NULL); PM_DEVICE_DT_DEFINE(TEST_DEVB, devb_pm_action); -DEVICE_DT_DEFINE(TEST_DEVB, NULL, PM_DEVICE_DT_GET(TEST_DEVB), - NULL, NULL, POST_KERNEL, 30, NULL); +DEVICE_INSTANCE(TEST_DEVB, NULL, PM_DEVICE_DT_GET(TEST_DEVB), + NULL, NULL, POST_KERNEL, NULL); PM_DEVICE_DEFINE(devc, deva_pm_action); -DEVICE_DEFINE(devc, "devc", NULL, PM_DEVICE_GET(devc), - NULL, NULL, POST_KERNEL, 40, NULL); +DEVICE_INSTANCE(devc, NULL, PM_DEVICE_GET(devc), + NULL, NULL, POST_KERNEL, NULL); /** * @brief Test the power domain behavior @@ -226,12 +226,12 @@ ZTEST(power_domain_1cpu, test_power_domain_device_runtime) #define TEST_DEV_BALANCED DT_NODELABEL(test_dev_balanced) PM_DEVICE_DT_DEFINE(TEST_DOMAIN_BALANCED, domain_pm_action); -DEVICE_DT_DEFINE(TEST_DOMAIN_BALANCED, NULL, PM_DEVICE_DT_GET(TEST_DOMAIN_BALANCED), - NULL, NULL, POST_KERNEL, 10, NULL); +DEVICE_INSTANCE(TEST_DOMAIN_BALANCED, NULL, PM_DEVICE_DT_GET(TEST_DOMAIN_BALANCED), + NULL, NULL, POST_KERNEL, NULL); PM_DEVICE_DT_DEFINE(TEST_DEV_BALANCED, deva_pm_action); -DEVICE_DT_DEFINE(TEST_DEV_BALANCED, NULL, PM_DEVICE_DT_GET(TEST_DEV_BALANCED), - NULL, NULL, POST_KERNEL, 20, NULL); +DEVICE_INSTANCE(TEST_DEV_BALANCED, NULL, PM_DEVICE_DT_GET(TEST_DEV_BALANCED), + NULL, NULL, POST_KERNEL, NULL); /** * @brief Test power domain requests are balanced diff --git a/tests/subsys/pm/power_mgmt/src/dummy_driver.c b/tests/subsys/pm/power_mgmt/src/dummy_driver.c index 81a053ce1d328..1120862b7ea39 100644 --- a/tests/subsys/pm/power_mgmt/src/dummy_driver.c +++ b/tests/subsys/pm/power_mgmt/src/dummy_driver.c @@ -38,6 +38,6 @@ int dummy_init(const struct device *dev) PM_DEVICE_DEFINE(dummy_driver, dummy_device_pm_action); -DEVICE_DEFINE(dummy_driver, DUMMY_DRIVER_NAME, &dummy_init, +DEVICE_INSTANCE(dummy_driver, &dummy_init, PM_DEVICE_GET(dummy_driver), NULL, NULL, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &funcs); + &funcs); diff --git a/tests/subsys/pm/power_states_api/src/test_driver.c b/tests/subsys/pm/power_states_api/src/test_driver.c index d5c90b5af279d..041783d66d94f 100644 --- a/tests/subsys/pm/power_states_api/src/test_driver.c +++ b/tests/subsys/pm/power_states_api/src/test_driver.c @@ -65,6 +65,6 @@ PM_DEVICE_DT_DEFINE(DT_NODELABEL(test_dev), test_driver_action); static struct test_driver_data data; -DEVICE_DT_DEFINE(DT_NODELABEL(test_dev), test_driver_init, +DEVICE_INSTANCE(DT_NODELABEL(test_dev), test_driver_init, PM_DEVICE_DT_GET(DT_NODELABEL(test_dev)), &data, NULL, POST_KERNEL, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, NULL); + NULL); diff --git a/tests/subsys/shell/shell_device/service_and_device_init.yaml b/tests/subsys/shell/shell_device/service_and_device_init.yaml new file mode 100644 index 0000000000000..e6c7c3df2858d --- /dev/null +++ b/tests/subsys/shell/shell_device/service_and_device_init.yaml @@ -0,0 +1,24 @@ +# Copyright (c) 2024, Tomasz Bursztyka +# +# SPDX-License-Identifier: Apache-2.0 + +device: + device_1: + init: + dependencies: + - device_0 + + device_2: + init: + dependencies: + - device_1 + + device_3: + init: + dependencies: + - device_2 + + device_4: + init: + dependencies: + - device_3 diff --git a/tests/subsys/shell/shell_device/src/main.c b/tests/subsys/shell/shell_device/src/main.c index d18c2c8098d4f..09cea7c151529 100644 --- a/tests/subsys/shell/shell_device/src/main.c +++ b/tests/subsys/shell/shell_device/src/main.c @@ -24,25 +24,25 @@ PM_DEVICE_DEFINE(dummy_pm_driver_3, dummy_device_pm_action); PM_DEVICE_DEFINE(dummy_pm_driver_4, dummy_device_pm_action); #endif -DEVICE_DEFINE(device_0, "device@0", NULL, NULL, +DEVICE_INSTANCE(device_0, NULL, NULL, NULL, NULL, - POST_KERNEL, 0, NULL); + POST_KERNEL, NULL); -DEVICE_DEFINE(device_1, "device@1", NULL, PM_DEVICE_GET(dummy_pm_driver_1), +DEVICE_INSTANCE(device_1, NULL, PM_DEVICE_GET(dummy_pm_driver_1), NULL, NULL, - POST_KERNEL, 1, NULL); + POST_KERNEL, NULL); -DEVICE_DEFINE(device_2, "device@2", NULL, PM_DEVICE_GET(dummy_pm_driver_2), +DEVICE_INSTANCE(device_2, NULL, PM_DEVICE_GET(dummy_pm_driver_2), NULL, NULL, - POST_KERNEL, 2, NULL); + POST_KERNEL, NULL); -DEVICE_DEFINE(device_3, "device@3", NULL, PM_DEVICE_GET(dummy_pm_driver_3), +DEVICE_INSTANCE(device_3, NULL, PM_DEVICE_GET(dummy_pm_driver_3), NULL, NULL, - POST_KERNEL, 3, NULL); + POST_KERNEL, NULL); -DEVICE_DEFINE(device_4, "device@4", NULL, PM_DEVICE_GET(dummy_pm_driver_4), +DEVICE_INSTANCE(device_4, NULL, PM_DEVICE_GET(dummy_pm_driver_4), NULL, NULL, - POST_KERNEL, 4, NULL); + POST_KERNEL, NULL); #ifdef CONFIG_PM_DEVICE static const struct device *d2 = &DEVICE_NAME_GET(device_2); diff --git a/tests/subsys/shell/shell_device_filter/service_and_device_init.yaml b/tests/subsys/shell/shell_device_filter/service_and_device_init.yaml new file mode 100644 index 0000000000000..19a17b7ba0ca7 --- /dev/null +++ b/tests/subsys/shell/shell_device_filter/service_and_device_init.yaml @@ -0,0 +1,14 @@ +# Copyright (c) 2024, Tomasz Bursztyka +# +# SPDX-License-Identifier: Apache-2.0 + +device: + device_1: + init: + dependencies: + - device_0 + + xx_device_2: + init: + dependencies: + - device_1 diff --git a/tests/subsys/shell/shell_device_filter/src/main.c b/tests/subsys/shell/shell_device_filter/src/main.c index 3073232fcf8fc..172407c953387 100644 --- a/tests/subsys/shell/shell_device_filter/src/main.c +++ b/tests/subsys/shell/shell_device_filter/src/main.c @@ -10,21 +10,21 @@ #include #include -DEVICE_DEFINE(device_0, "device@0", NULL, NULL, +DEVICE_INSTANCE(device_0, NULL, NULL, NULL, NULL, - POST_KERNEL, 0, NULL); + POST_KERNEL, NULL); -DEVICE_DEFINE(device_1, "device@1", NULL, NULL, +DEVICE_INSTANCE(device_1, NULL, NULL, NULL, NULL, - POST_KERNEL, 1, NULL); + POST_KERNEL, NULL); -DEVICE_DEFINE(device_2, "xx_device@2", NULL, NULL, +DEVICE_INSTANCE(xx_device_2, NULL, NULL, NULL, NULL, - POST_KERNEL, 2, NULL); + POST_KERNEL, NULL); static const struct device *d0 = &DEVICE_NAME_GET(device_0); static const struct device *d1 = &DEVICE_NAME_GET(device_1); -static const struct device *d2 = &DEVICE_NAME_GET(device_2); +static const struct device *d2 = &DEVICE_NAME_GET(xx_device_2); ZTEST(shell_device_filter, test_unfiltered) { @@ -47,7 +47,7 @@ ZTEST(shell_device_filter, test_prefix) static bool pm_device_test_filter(const struct device *dev) { - return strstr(dev->name, "@1") != NULL; + return strstr(dev->name, "_1") != NULL; } ZTEST(shell_device_filter, test_filter)