tests: convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert tests to DEVICE_{DT_}DEFINE instead of DEVICE_AND_API_INIT so we can deprecate DEVICE_AND_API_INIT in the future. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
e2e882ab3e
commit
1706bd2b41
12 changed files with 67 additions and 63 deletions
|
@ -43,9 +43,9 @@ static const struct sensor_driver_api mock_temp_nrf5_driver_api = {
|
|||
.channel_get = mock_temp_nrf5_channel_get,
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(mock_temp_nrf5,
|
||||
DT_LABEL(DT_INST(0, nordic_nrf_temp)),
|
||||
DEVICE_DT_DEFINE(DT_INST(0, nordic_nrf_temp),
|
||||
mock_temp_nrf5_init,
|
||||
device_pm_control_nop,
|
||||
NULL,
|
||||
NULL,
|
||||
POST_KERNEL,
|
||||
|
|
|
@ -224,7 +224,7 @@ static int i2c_virtual_init(const struct device *dev)
|
|||
|
||||
static struct i2c_virtual_data i2c_virtual_dev_data_0;
|
||||
|
||||
DEVICE_AND_API_INIT(i2c_virtual_0, CONFIG_I2C_VIRTUAL_NAME, &i2c_virtual_init,
|
||||
&i2c_virtual_dev_data_0, NULL,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&api_funcs);
|
||||
DEVICE_DEFINE(i2c_virtual_0, CONFIG_I2C_VIRTUAL_NAME, &i2c_virtual_init,
|
||||
device_pm_control_nop, &i2c_virtual_dev_data_0, NULL,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&api_funcs);
|
||||
|
|
|
@ -30,9 +30,10 @@ extern struct ipm_driver_api ipm_dummy_api;
|
|||
|
||||
/* Set up the dummy IPM driver */
|
||||
struct ipm_dummy_driver_data ipm_dummy0_driver_data;
|
||||
DEVICE_AND_API_INIT(ipm_dummy0, "ipm_dummy0", ipm_dummy_init,
|
||||
&ipm_dummy0_driver_data, NULL,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &ipm_dummy_api);
|
||||
DEVICE_DEFINE(ipm_dummy0, "ipm_dummy0", ipm_dummy_init,
|
||||
device_pm_control_nop, &ipm_dummy0_driver_data, NULL,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&ipm_dummy_api);
|
||||
|
||||
/* Sending side of the console IPM driver, will forward anything sent
|
||||
* to printf() since we selected IPM_CONSOLE_STDOUT
|
||||
|
|
|
@ -53,11 +53,13 @@ static struct subsystem_api my_driver_B_api_funcs = {
|
|||
/**
|
||||
* @cond INTERNAL_HIDDEN
|
||||
*/
|
||||
DEVICE_AND_API_INIT(my_driver_A, MY_DRIVER_A, &common_driver_init, NULL, NULL,
|
||||
DEVICE_DEFINE(my_driver_A, MY_DRIVER_A, &common_driver_init,
|
||||
device_pm_control_nop, NULL, NULL,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&my_driver_A_api_funcs);
|
||||
|
||||
DEVICE_AND_API_INIT(my_driver_B, MY_DRIVER_B, &common_driver_init, NULL, NULL,
|
||||
DEVICE_DEFINE(my_driver_B, MY_DRIVER_B, &common_driver_init,
|
||||
device_pm_control_nop, NULL, NULL,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&my_driver_B_api_funcs);
|
||||
|
||||
|
|
|
@ -35,9 +35,9 @@ int bad_driver_init(const struct device *dev)
|
|||
/**
|
||||
* @cond INTERNAL_HIDDEN
|
||||
*/
|
||||
DEVICE_AND_API_INIT(bad_driver, BAD_DRIVER_NAME, &bad_driver_init,
|
||||
NULL, NULL, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&funcs);
|
||||
DEVICE_DEFINE(bad_driver, BAD_DRIVER_NAME, &bad_driver_init,
|
||||
device_pm_control_nop, NULL, NULL, POST_KERNEL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &funcs);
|
||||
|
||||
/**
|
||||
* @endcond
|
||||
|
|
|
@ -35,9 +35,9 @@ int dummy_init(const struct device *dev)
|
|||
/**
|
||||
* @cond INTERNAL_HIDDEN
|
||||
*/
|
||||
DEVICE_AND_API_INIT(dummy_driver, DUMMY_DRIVER_NAME, &dummy_init,
|
||||
NULL, NULL, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&funcs);
|
||||
DEVICE_DEFINE(dummy_driver, DUMMY_DRIVER_NAME, &dummy_init,
|
||||
device_pm_control_nop, NULL, NULL, POST_KERNEL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &funcs);
|
||||
|
||||
/**
|
||||
* @endcond
|
||||
|
|
|
@ -51,7 +51,7 @@ extern void test_mmio_device_map(void);
|
|||
* @ingroup kernel_device_tests
|
||||
*
|
||||
* @see device_get_binding(), device_busy_set(), device_busy_clear(),
|
||||
* DEVICE_AND_API_INIT()
|
||||
* DEVICE_DEFINE()
|
||||
*/
|
||||
void test_dummy_device(void)
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ void test_dummy_device(void)
|
|||
*
|
||||
* Validates device binding for an existing device object.
|
||||
*
|
||||
* @see device_get_binding(), DEVICE_AND_API_INIT()
|
||||
* @see device_get_binding(), DEVICE_DEFINE()
|
||||
*/
|
||||
static void test_dynamic_name(void)
|
||||
{
|
||||
|
@ -98,7 +98,7 @@ static void test_dynamic_name(void)
|
|||
* Validates binding of a random device driver(non-defined driver) named
|
||||
* "ANOTHER_BOGUS_NAME".
|
||||
*
|
||||
* @see device_get_binding(), DEVICE_AND_API_INIT()
|
||||
* @see device_get_binding(), DEVICE_DEFINE()
|
||||
*/
|
||||
static void test_bogus_dynamic_name(void)
|
||||
{
|
||||
|
|
|
@ -36,9 +36,10 @@ int foo_single_init(const struct device *device)
|
|||
}
|
||||
|
||||
/* fake API pointer, we don't use it at all for this suite */
|
||||
DEVICE_AND_API_INIT(foo0, "foo0", foo_single_init, &foo0_data, &foo0_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
(void *)0xDEADBEEF);
|
||||
DEVICE_DEFINE(foo0, "foo0", foo_single_init, device_pm_control_nop,
|
||||
&foo0_data, &foo0_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
(void *)0xDEADBEEF);
|
||||
|
||||
/**
|
||||
* @brief Test DEVICE_MMIO_* macros
|
||||
|
@ -129,9 +130,10 @@ int foo_mult_init(const struct device *device)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DEVICE_AND_API_INIT(foo12, "foo12", foo_mult_init, &foo12_data, &foo12_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
(void *)0xDEADBEEF);
|
||||
DEVICE_DEFINE(foo12, "foo12", foo_mult_init, device_pm_control_nop,
|
||||
&foo12_data, &foo12_config,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
(void *)0xDEADBEEF);
|
||||
|
||||
/**
|
||||
* @brief Test DEVICE_MMIO_NAMED_* macros
|
||||
|
|
|
@ -128,40 +128,40 @@ static int my_driver_pri_4_init(const struct device *dev)
|
|||
*
|
||||
* @details Test that kernel shall provide control over device driver
|
||||
* initalization order, using initialization level and priority for each
|
||||
* instance. We use DEVICE_AND_API_INIT to define device instances and set
|
||||
* instance. We use DEVICE_DEFINE 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_AND_API_INIT(my_driver_level_1, MY_DRIVER_LV_1, &my_driver_lv_1_init,
|
||||
NULL, NULL, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&funcs_my_drivers);
|
||||
DEVICE_DEFINE(my_driver_level_1, MY_DRIVER_LV_1, &my_driver_lv_1_init,
|
||||
device_pm_control_nop, NULL, NULL, PRE_KERNEL_1,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &funcs_my_drivers);
|
||||
|
||||
DEVICE_AND_API_INIT(my_driver_level_2, MY_DRIVER_LV_2, &my_driver_lv_2_init,
|
||||
NULL, NULL, PRE_KERNEL_2, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&funcs_my_drivers);
|
||||
DEVICE_DEFINE(my_driver_level_2, MY_DRIVER_LV_2, &my_driver_lv_2_init,
|
||||
device_pm_control_nop, NULL, NULL, PRE_KERNEL_2,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &funcs_my_drivers);
|
||||
|
||||
DEVICE_AND_API_INIT(my_driver_level_3, MY_DRIVER_LV_3, &my_driver_lv_3_init,
|
||||
NULL, NULL, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&funcs_my_drivers);
|
||||
DEVICE_DEFINE(my_driver_level_3, MY_DRIVER_LV_3, &my_driver_lv_3_init,
|
||||
device_pm_control_nop, NULL, NULL, POST_KERNEL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &funcs_my_drivers);
|
||||
|
||||
DEVICE_AND_API_INIT(my_driver_level_4, MY_DRIVER_LV_4, &my_driver_lv_4_init,
|
||||
NULL, NULL, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
|
||||
&funcs_my_drivers);
|
||||
DEVICE_DEFINE(my_driver_level_4, MY_DRIVER_LV_4, &my_driver_lv_4_init,
|
||||
device_pm_control_nop, NULL, NULL, APPLICATION,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &funcs_my_drivers);
|
||||
|
||||
DEVICE_AND_API_INIT(my_driver_priority_1, MY_DRIVER_PRI_1,
|
||||
&my_driver_pri_1_init, NULL, NULL, POST_KERNEL, 1,
|
||||
&funcs_my_drivers);
|
||||
DEVICE_DEFINE(my_driver_priority_1, MY_DRIVER_PRI_1,
|
||||
&my_driver_pri_1_init, device_pm_control_nop,
|
||||
NULL, NULL, POST_KERNEL, 1, &funcs_my_drivers);
|
||||
|
||||
DEVICE_AND_API_INIT(my_driver_priority_2, MY_DRIVER_PRI_2,
|
||||
&my_driver_pri_2_init, NULL, NULL, POST_KERNEL, 2,
|
||||
&funcs_my_drivers);
|
||||
DEVICE_DEFINE(my_driver_priority_2, MY_DRIVER_PRI_2,
|
||||
&my_driver_pri_2_init, device_pm_control_nop,
|
||||
NULL, NULL, POST_KERNEL, 2, &funcs_my_drivers);
|
||||
|
||||
DEVICE_AND_API_INIT(my_driver_priority_3, MY_DRIVER_PRI_3,
|
||||
&my_driver_pri_3_init, NULL, NULL, POST_KERNEL, 3,
|
||||
&funcs_my_drivers);
|
||||
DEVICE_DEFINE(my_driver_priority_3, MY_DRIVER_PRI_3,
|
||||
&my_driver_pri_3_init, device_pm_control_nop,
|
||||
NULL, NULL, POST_KERNEL, 3, &funcs_my_drivers);
|
||||
|
||||
DEVICE_AND_API_INIT(my_driver_priority_4, MY_DRIVER_PRI_4,
|
||||
&my_driver_pri_4_init, NULL, NULL, POST_KERNEL, 4,
|
||||
&funcs_my_drivers);
|
||||
DEVICE_DEFINE(my_driver_priority_4, MY_DRIVER_PRI_4,
|
||||
&my_driver_pri_4_init, device_pm_control_nop,
|
||||
NULL, NULL, POST_KERNEL, 4, &funcs_my_drivers);
|
||||
|
|
|
@ -1324,9 +1324,9 @@ static const struct gpio_driver_api test_api;
|
|||
.reg_addr = DT_REG_ADDR(INST(num)), \
|
||||
.reg_len = DT_REG_SIZE(INST(num)), \
|
||||
}; \
|
||||
DEVICE_AND_API_INIT(test_gpio_dev_##num, \
|
||||
DT_LABEL(INST(num)), \
|
||||
DEVICE_DT_DEFINE(INST(num), \
|
||||
test_gpio_init, \
|
||||
device_pm_control_nop, \
|
||||
&gpio_data_##num, \
|
||||
&gpio_info_##num, \
|
||||
POST_KERNEL, \
|
||||
|
|
|
@ -243,9 +243,9 @@ static int ptp_test_1_init(const struct device *port)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DEVICE_AND_API_INIT(ptp_clock_1, PTP_CLOCK_NAME, ptp_test_1_init,
|
||||
&ptp_test_1_context, NULL, POST_KERNEL,
|
||||
CONFIG_APPLICATION_INIT_PRIORITY, &api);
|
||||
DEVICE_DEFINE(ptp_clock_1, PTP_CLOCK_NAME, ptp_test_1_init,
|
||||
device_pm_control_nop, &ptp_test_1_context, NULL,
|
||||
POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY, &api);
|
||||
|
||||
static int ptp_test_2_init(const struct device *port)
|
||||
{
|
||||
|
@ -259,9 +259,9 @@ static int ptp_test_2_init(const struct device *port)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DEVICE_AND_API_INIT(ptp_clock_2, PTP_CLOCK_NAME, ptp_test_2_init,
|
||||
&ptp_test_2_context, NULL, POST_KERNEL,
|
||||
CONFIG_APPLICATION_INIT_PRIORITY, &api);
|
||||
DEVICE_DEFINE(ptp_clock_2, PTP_CLOCK_NAME, ptp_test_2_init,
|
||||
device_pm_control_nop, &ptp_test_2_context, NULL,
|
||||
POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY, &api);
|
||||
|
||||
struct user_data {
|
||||
int eth_if_count;
|
||||
|
|
|
@ -92,7 +92,6 @@ static const struct flash_driver_api flash_ram_api = {
|
|||
.page_layout = test_flash_ram_pages_layout,
|
||||
};
|
||||
|
||||
DEVICE_AND_API_INIT(flash_ram_test, "ram_flash_test_drv", test_ram_flash_init,
|
||||
NULL, NULL, POST_KERNEL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&flash_ram_api);
|
||||
DEVICE_DEFINE(flash_ram_test, "ram_flash_test_drv", test_ram_flash_init,
|
||||
device_pm_control_nop, NULL, NULL, POST_KERNEL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &flash_ram_api);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue