samples: convert DEVICE_AND_API_INIT to DEVICE_DEFINE

Convert samples 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:
Kumar Gala 2020-12-17 09:31:31 -06:00 committed by Anas Nashif
commit e2e882ab3e
2 changed files with 4 additions and 3 deletions

View file

@ -42,7 +42,7 @@ static inline void z_vrfy_hello_world_print(const struct device *dev)
#endif /* CONFIG_USERSPACE */
DEVICE_AND_API_INIT(hello_world, "CUSTOM_DRIVER",
init, &data, NULL,
DEVICE_DEFINE(hello_world, "CUSTOM_DRIVER",
init, device_pm_control_nop, &data, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&((struct hello_world_driver_api){ .print = print_impl }));

View file

@ -111,8 +111,9 @@ static int sample_driver_foo_init(const struct device *dev)
static struct sample_driver_foo_dev_data sample_driver_foo_dev_data_0;
DEVICE_AND_API_INIT(sample_driver_foo_0, SAMPLE_DRIVER_NAME_0,
DEVICE_DEFINE(sample_driver_foo_0, SAMPLE_DRIVER_NAME_0,
&sample_driver_foo_init,
device_pm_control_nop,
&sample_driver_foo_dev_data_0, NULL,
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&sample_driver_foo_api);