device: convert DEVICE_INIT to DEVICE_DEFINE or SYS_DEVICE_DEFINE

Convert handful of users of DEVICE_INIT to DEVICE_DEFINE or
SYS_DEVICE_DEFINE to allow deprecation of DEVICE_INIT.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2020-11-05 06:08:30 -06:00 committed by Kumar Gala
parent d439478805
commit 5e97d779bb
8 changed files with 28 additions and 24 deletions

View file

@ -52,8 +52,10 @@ static const struct pwr_ctrl_cfg vdd_pwr_ctrl_cfg = {
.pin = VDD_PWR_CTRL_GPIO_PIN,
};
DEVICE_INIT(vdd_pwr_ctrl_init, "", pwr_ctrl_init, NULL, &vdd_pwr_ctrl_cfg,
POST_KERNEL, CONFIG_BOARD_VDD_PWR_CTRL_INIT_PRIORITY);
DEVICE_DEFINE(vdd_pwr_ctrl_init, "", pwr_ctrl_init, NULL, NULL,
&vdd_pwr_ctrl_cfg,
POST_KERNEL, CONFIG_BOARD_VDD_PWR_CTRL_INIT_PRIORITY,
NULL);
#ifdef CONFIG_SENSOR
@ -70,8 +72,8 @@ static const struct pwr_ctrl_cfg ccs_vdd_pwr_ctrl_cfg = {
.pin = CCS_VDD_PWR_CTRL_GPIO_PIN,
};
DEVICE_INIT(ccs_vdd_pwr_ctrl_init, "", pwr_ctrl_init, NULL,
&ccs_vdd_pwr_ctrl_cfg, POST_KERNEL,
CONFIG_BOARD_CCS_VDD_PWR_CTRL_INIT_PRIORITY);
DEVICE_DEFINE(ccs_vdd_pwr_ctrl_init, "", pwr_ctrl_init, NULL, NULL,
&ccs_vdd_pwr_ctrl_cfg, POST_KERNEL,
CONFIG_BOARD_CCS_VDD_PWR_CTRL_INIT_PRIORITY, NULL);
#endif

View file

@ -649,6 +649,6 @@ static int gpio_stm32_afio_init(const struct device *device)
return 0;
}
DEVICE_INIT(gpio_stm32_afio, "", gpio_stm32_afio_init, NULL, NULL, PRE_KERNEL_2, 0);
SYS_DEVICE_DEFINE("gpio_stm32_afio", gpio_stm32_afio_init, NULL, PRE_KERNEL_2, 0);
#endif /* CONFIG_SOC_SERIES_STM32F1X */

View file

@ -402,9 +402,10 @@ static int stm32_exti_init(const struct device *dev)
}
static struct stm32_exti_data exti_data;
DEVICE_INIT(exti_stm32, STM32_EXTI_NAME, stm32_exti_init,
&exti_data, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
DEVICE_DEFINE(exti_stm32, STM32_EXTI_NAME, stm32_exti_init,
NULL, &exti_data, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
NULL);
/**
* @brief set & unset for the interrupt callbacks

View file

@ -413,6 +413,7 @@ static int sam0_eic_init(const struct device *dev)
}
static struct sam0_eic_data eic_data;
DEVICE_INIT(sam0_eic, DT_INST_LABEL(0), sam0_eic_init,
&eic_data, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
DEVICE_DEFINE(sam0_eic, DT_INST_LABEL(0), sam0_eic_init,
NULL, &eic_data, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
NULL);

View file

@ -789,5 +789,5 @@ static int gsm_init(const struct device *device)
return 0;
}
DEVICE_INIT(gsm_ppp, GSM_MODEM_DEVICE_NAME, gsm_init, &gsm, NULL, POST_KERNEL,
CONFIG_MODEM_GSM_INIT_PRIORITY);
DEVICE_DEFINE(gsm_ppp, GSM_MODEM_DEVICE_NAME, gsm_init, &gsm, NULL, NULL,
POST_KERNEL, CONFIG_MODEM_GSM_INIT_PRIORITY, NULL);

View file

@ -263,8 +263,8 @@ static int hci_spi_init(const struct device *unused)
return 0;
}
DEVICE_INIT(hci_spi, "hci_spi", &hci_spi_init, NULL, NULL,
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
SYS_DEVICE_DEFINE("hci_spi", hci_spi_init, NULL,
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
void main(void)
{

View file

@ -323,8 +323,8 @@ static int hci_uart_init(const struct device *unused)
return 0;
}
DEVICE_INIT(hci_uart, "hci_uart", &hci_uart_init, NULL, NULL,
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
SYS_DEVICE_DEFINE("hci_uart", hci_uart_init, NULL,
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
void main(void)
{

View file

@ -41,9 +41,9 @@ static struct ipm_console_sender_config_info sender_config = {
.bind_to = "ipm_dummy0",
.flags = SOURCE
};
DEVICE_INIT(ipm_console_send0, "ipm_send0", ipm_console_sender_init,
NULL, &sender_config,
APPLICATION, INIT_PRIO_IPM_SEND);
DEVICE_DEFINE(ipm_console_send0, "ipm_send0", ipm_console_sender_init,
NULL, NULL, &sender_config,
APPLICATION, INIT_PRIO_IPM_SEND, NULL);
/* Receiving side of the console IPM driver. These numbers are
* more or less arbitrary
@ -67,9 +67,9 @@ static struct ipm_console_receiver_config_info receiver_config = {
};
struct ipm_console_receiver_runtime_data receiver_data;
DEVICE_INIT(ipm_console_recv0, "ipm_recv0", ipm_console_receiver_init,
&receiver_data, &receiver_config,
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
DEVICE_DEFINE(ipm_console_recv0, "ipm_recv0", ipm_console_receiver_init,
NULL, &receiver_data, &receiver_config,
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL);
static const char thestr[] = "everything is awesome\n";