drivers: entropy: introduce shared init priority and logging

Introduce Kconfig for setting the driver initialization priority across
the entropy drivers and add a call to the logging template.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
This commit is contained in:
Henrik Brix Andersen 2021-10-19 23:14:27 +02:00 committed by Maureen Helm
commit adfd34ed08
14 changed files with 23 additions and 13 deletions

View file

@ -10,6 +10,16 @@ menuconfig ENTROPY_GENERATOR
if ENTROPY_GENERATOR
module = ENTROPY
module-str = entropy
source "subsys/logging/Kconfig.template.log_config"
config ENTROPY_INIT_PRIORITY
int "Entropy driver init priority"
default KERNEL_INIT_PRIORITY_DEVICE
help
Entropy driver device initialization priority.
source "drivers/entropy/Kconfig.b91"
source "drivers/entropy/Kconfig.cc13xx_cc26xx"
source "drivers/entropy/Kconfig.mcux"

View file

@ -67,5 +67,5 @@ static const struct entropy_driver_api entropy_b91_trng_api = {
/* Entropy driver registration */
DEVICE_DT_INST_DEFINE(0, entropy_b91_trng_init,
NULL, NULL, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY,
&entropy_b91_trng_api);

View file

@ -353,5 +353,5 @@ DEVICE_DT_INST_DEFINE(0,
entropy_cc13xx_cc26xx_init,
entropy_cc13xx_cc26xx_pm_control,
&entropy_cc13xx_cc26xx_data, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY,
&entropy_cc13xx_cc26xx_driver_api);

View file

@ -70,5 +70,5 @@ static const struct entropy_driver_api entropy_esp32_api_funcs = {
DEVICE_DT_INST_DEFINE(0,
entropy_esp32_init, NULL, NULL, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY,
&entropy_esp32_api_funcs);

View file

@ -102,5 +102,5 @@ static struct entropy_driver_api entropy_gecko_trng_api_funcs = {
DEVICE_DT_INST_DEFINE(0,
entropy_gecko_trng_init, NULL,
NULL, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY,
&entropy_gecko_trng_api_funcs);

View file

@ -61,5 +61,5 @@ static const struct entropy_driver_api entropy_prbs_api = {
DEVICE_DT_INST_DEFINE(0,
entropy_prbs_init, NULL, NULL, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY,
&entropy_prbs_api);

View file

@ -45,7 +45,7 @@ static int entropy_mcux_rng_init(const struct device *);
DEVICE_DT_INST_DEFINE(0,
entropy_mcux_rng_init, NULL, NULL,
&entropy_mcux_config,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY,
&entropy_mcux_rng_api_funcs);
static int entropy_mcux_rng_init(const struct device *dev)

View file

@ -61,7 +61,7 @@ static int entropy_mcux_rnga_init(const struct device *);
DEVICE_DT_INST_DEFINE(0,
entropy_mcux_rnga_init, NULL, NULL, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY,
&entropy_mcux_rnga_api_funcs);
static int entropy_mcux_rnga_init(const struct device *dev)

View file

@ -45,7 +45,7 @@ static int entropy_mcux_trng_init(const struct device *);
DEVICE_DT_INST_DEFINE(0,
entropy_mcux_trng_init, NULL, NULL,
&entropy_mcux_config,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY,
&entropy_mcux_trng_api_funcs);
static int entropy_mcux_trng_init(const struct device *dev)

View file

@ -334,7 +334,7 @@ static const struct entropy_driver_api entropy_nrf5_api_funcs = {
DEVICE_DT_INST_DEFINE(0,
entropy_nrf5_init, NULL,
&entropy_nrf5_data, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY,
&entropy_nrf5_api_funcs);
static int entropy_nrf5_init(const struct device *dev)

View file

@ -45,7 +45,7 @@ static int entropy_rv32m1_trng_init(const struct device *);
DEVICE_DT_INST_DEFINE(0,
entropy_rv32m1_trng_init, NULL,
NULL, &entropy_rv32m1_config,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY,
&entropy_rv32m1_trng_api_funcs);
static int entropy_rv32m1_trng_init(const struct device *dev)

View file

@ -186,5 +186,5 @@ static const struct trng_sam_dev_cfg trng_sam_cfg = {
DEVICE_DT_INST_DEFINE(0,
entropy_sam_init, NULL,
NULL, &trng_sam_cfg,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY,
&entropy_sam_api);

View file

@ -520,5 +520,5 @@ static const struct entropy_driver_api entropy_stm32_rng_api = {
DEVICE_DT_INST_DEFINE(0,
entropy_stm32_rng_init, NULL,
&entropy_stm32_rng_data, &entropy_stm32_rng_config,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY,
&entropy_stm32_rng_api);

View file

@ -78,7 +78,7 @@ static const struct entropy_driver_api entropy_native_posix_api_funcs = {
DEVICE_DT_INST_DEFINE(0,
entropy_native_posix_init, NULL,
NULL, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
PRE_KERNEL_1, CONFIG_ENTROPY_INIT_PRIORITY,
&entropy_native_posix_api_funcs);
static void add_fake_entropy_option(void)