Skip to content

Commit 582fdf7

Browse files
committed
tests: Switching DEVICE_<DT/DT_INST>_DEFINE macros to new ones
Switching to DEVICE_INSTANCE and DEVICE_INSTANCE_FROM_DT_INST, thus merging former DEVICE_DEFINE and DEVICE_DT_DEFINE into one, so removing the name parameter from the earier and finally removing the prio parameter on all. Signed-off-by: Tomasz Bursztyka <[email protected]>
1 parent a1d188a commit 582fdf7

File tree

39 files changed

+154
-175
lines changed

39 files changed

+154
-175
lines changed

tests/benchmarks/footprints/src/pm_device.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ static int dummy_device_pm_action(const struct device *dev,
2525
/* Define a driver with and without power management enabled */
2626
PM_DEVICE_DEFINE(dummy_pm_driver, dummy_device_pm_action);
2727

28-
DEVICE_DEFINE(dummy_pm_driver, DUMMY_PM_DRIVER_NAME, NULL,
28+
DEVICE_INSTANCE(dummy_pm_driver, NULL,
2929
PM_DEVICE_GET(dummy_pm_driver), NULL, NULL, POST_KERNEL,
30-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL);
30+
NULL);
3131

32-
DEVICE_DEFINE(dummy_driver, DUMMY_DRIVER_NAME, NULL, NULL, NULL, NULL,
33-
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL);
32+
DEVICE_INSTANCE(dummy_driver, NULL, NULL, NULL, NULL,
33+
POST_KERNEL, NULL);
3434

3535
void run_pm_device(void)
3636
{

tests/bluetooth/bluetooth/src/bluetooth.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ static const struct bt_hci_driver_api driver_api = {
4343
#define TEST_DEVICE_INIT(inst) \
4444
static struct driver_data driver_data_##inst = { \
4545
}; \
46-
DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &driver_data_##inst, NULL, \
47-
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &driver_api)
46+
DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &driver_data_##inst, NULL,\
47+
POST_KERNEL, &driver_api)
4848

4949
DT_INST_FOREACH_STATUS_OKAY(TEST_DEVICE_INIT)
5050

tests/bluetooth/hci_prop_evt/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ static const struct bt_hci_driver_api driver_api = {
243243
#define TEST_DEVICE_INIT(inst) \
244244
static struct driver_data driver_data_##inst = { \
245245
}; \
246-
DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &driver_data_##inst, NULL, \
247-
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &driver_api)
246+
DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &driver_data_##inst, NULL,\
247+
POST_KERNEL, &driver_api)
248248

249249
DT_INST_FOREACH_STATUS_OKAY(TEST_DEVICE_INIT)
250250

tests/bluetooth/hci_uart_async/src/test_hci_uart_async.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ static int drv_init(const struct device *dev)
5151
#define TEST_DEVICE_INIT(inst) \
5252
static struct drv_data drv_data_##inst = { \
5353
}; \
54-
DEVICE_DT_INST_DEFINE(inst, drv_init, NULL, &drv_data_##inst, NULL, \
55-
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &drv_api)
54+
DEVICE_INSTANCE_FROM_DT_INST(inst, drv_init, NULL, &drv_data_##inst, NULL,\
55+
POST_KERNEL, &drv_api)
5656

5757
DT_INST_FOREACH_STATUS_OKAY(TEST_DEVICE_INIT)
5858

tests/bluetooth/host_long_adv_recv/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ static const struct bt_hci_driver_api driver_api = {
257257
#define TEST_DEVICE_INIT(inst) \
258258
static struct driver_data driver_data_##inst = { \
259259
}; \
260-
DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &driver_data_##inst, NULL, \
261-
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &driver_api)
260+
DEVICE_INSTANCE_FROM_DT_INST(inst, NULL, NULL, &driver_data_##inst, NULL,\
261+
POST_KERNEL, &driver_api)
262262

263263
DT_INST_FOREACH_STATUS_OKAY(TEST_DEVICE_INIT)
264264

tests/drivers/espi/src/stub_espi_emul_host.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ static struct emul_espi_host_stub_dev_config stub_host_config;
3232
static struct emul_espi_host_stub_dev_api stub_host_api;
3333

3434
#define EMUL_ESPI_HOST_DEVICE_STUB(n) \
35-
DEVICE_DT_INST_DEFINE(n, &emul_espi_host_init_stub, NULL, &stub_host_data, \
36-
&stub_host_config, POST_KERNEL, CONFIG_ESPI_INIT_PRIORITY, \
37-
&stub_host_api)
35+
DEVICE_INSTANCE_FROM_DT_INST(n, &emul_espi_host_init_stub, NULL, &stub_host_data, \
36+
&stub_host_config, POST_KERNEL, &stub_host_api)
3837

3938
DT_INST_FOREACH_STATUS_OKAY(EMUL_ESPI_HOST_DEVICE_STUB);

tests/drivers/gnss/gnss_dump/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#include <zephyr/drivers/gnss/gnss_publish.h>
99
#include <zephyr/device.h>
1010

11-
DEVICE_DEFINE(gnss_dev, "gnss_dev", NULL, NULL, NULL, NULL,
12-
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL);
11+
DEVICE_INSTANCE(gnss_dev, NULL, NULL, NULL, NULL,
12+
POST_KERNEL, NULL);
1313

1414
static const struct device *gnss_dev = &DEVICE_NAME_GET(gnss_dev);
1515
static struct gnss_data test_data;

tests/drivers/i2c/i2c_target_api/common/i2c_virtual.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ static int i2c_virtual_init(const struct device *dev)
222222

223223
static struct i2c_virtual_data i2c_virtual_dev_data_0;
224224

225-
DEVICE_DEFINE(i2c_virtual_0, CONFIG_I2C_VIRTUAL_NAME, &i2c_virtual_init,
225+
DEVICE_INSTANCE(i2c_virtual_0, &i2c_virtual_init,
226226
NULL, &i2c_virtual_dev_data_0, NULL,
227-
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
228-
&api_funcs);
227+
POST_KERNEL, &api_funcs);

tests/drivers/input/kbd_matrix/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ static const struct input_kbd_matrix_common_config
5757

5858
static struct input_kbd_matrix_common_data test_data;
5959

60-
DEVICE_DT_DEFINE(TEST_KBD_SCAN_NODE, input_kbd_matrix_common_init, NULL,
60+
DEVICE_INSTANCE(TEST_KBD_SCAN_NODE, input_kbd_matrix_common_init, NULL,
6161
&test_data, &test_cfg,
62-
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, NULL);
62+
POST_KERNEL, NULL);
6363

6464
static const struct device *const test_dev = DEVICE_DT_GET(TEST_KBD_SCAN_NODE);
6565

tests/drivers/ipm/src/main.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ extern struct ipm_driver_api ipm_dummy_api;
3232

3333
/* Set up the dummy IPM driver */
3434
struct ipm_dummy_driver_data ipm_dummy0_driver_data;
35-
DEVICE_DEFINE(ipm_dummy0, "ipm_dummy0", NULL,
35+
DEVICE_INSTANCE(ipm_dummy0, NULL,
3636
NULL, &ipm_dummy0_driver_data, NULL,
37-
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
37+
PRE_KERNEL_1,
3838
&ipm_dummy_api);
3939

4040
/* Sending side of the console IPM driver, will forward anything sent
@@ -44,9 +44,9 @@ static struct ipm_console_sender_config_info sender_config = {
4444
.bind_to = "ipm_dummy0",
4545
.flags = SOURCE
4646
};
47-
DEVICE_DEFINE(ipm_console_send0, "ipm_send0", ipm_console_sender_init,
47+
DEVICE_INSTANCE(ipm_console_send0, ipm_console_sender_init,
4848
NULL, NULL, &sender_config,
49-
POST_KERNEL, INIT_PRIO_IPM_SEND, NULL);
49+
POST_KERNEL, NULL);
5050

5151
/* Receiving side of the console IPM driver. These numbers are
5252
* more or less arbitrary
@@ -70,9 +70,9 @@ static struct ipm_console_receiver_config_info receiver_config = {
7070
};
7171

7272
struct ipm_console_receiver_runtime_data receiver_data;
73-
DEVICE_DEFINE(ipm_console_recv0, "ipm_recv0", ipm_console_receiver_init,
73+
DEVICE_INSTANCE(ipm_console_recv0, ipm_console_receiver_init,
7474
NULL, &receiver_data, &receiver_config,
75-
POST_KERNEL, INIT_PRIO_IPM_RECV, NULL);
75+
POST_KERNEL, NULL);
7676

7777
static const char thestr[] = "everything is awesome\n";
7878

0 commit comments

Comments
 (0)