From adfd34ed08f0c2fb6a6b2b3975515808c3eea84d Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Tue, 19 Oct 2021 23:14:27 +0200 Subject: [PATCH] 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 --- drivers/entropy/Kconfig | 10 ++++++++++ drivers/entropy/entropy_b91_trng.c | 2 +- drivers/entropy/entropy_cc13xx_cc26xx.c | 2 +- drivers/entropy/entropy_esp32.c | 2 +- drivers/entropy/entropy_gecko_trng.c | 2 +- drivers/entropy/entropy_litex.c | 2 +- drivers/entropy/entropy_mcux_rng.c | 2 +- drivers/entropy/entropy_mcux_rnga.c | 2 +- drivers/entropy/entropy_mcux_trng.c | 2 +- drivers/entropy/entropy_nrf5.c | 2 +- drivers/entropy/entropy_rv32m1_trng.c | 2 +- drivers/entropy/entropy_sam.c | 2 +- drivers/entropy/entropy_stm32.c | 2 +- drivers/entropy/fake_entropy_native_posix.c | 2 +- 14 files changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/entropy/Kconfig b/drivers/entropy/Kconfig index e73945b921a..f1e1255b19d 100644 --- a/drivers/entropy/Kconfig +++ b/drivers/entropy/Kconfig @@ -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" diff --git a/drivers/entropy/entropy_b91_trng.c b/drivers/entropy/entropy_b91_trng.c index 20cacea6436..01cf034d97e 100644 --- a/drivers/entropy/entropy_b91_trng.c +++ b/drivers/entropy/entropy_b91_trng.c @@ -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); diff --git a/drivers/entropy/entropy_cc13xx_cc26xx.c b/drivers/entropy/entropy_cc13xx_cc26xx.c index c8e411d8526..eabbd8e15f1 100644 --- a/drivers/entropy/entropy_cc13xx_cc26xx.c +++ b/drivers/entropy/entropy_cc13xx_cc26xx.c @@ -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); diff --git a/drivers/entropy/entropy_esp32.c b/drivers/entropy/entropy_esp32.c index 30884d2e0f6..c46d7258ee6 100644 --- a/drivers/entropy/entropy_esp32.c +++ b/drivers/entropy/entropy_esp32.c @@ -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); diff --git a/drivers/entropy/entropy_gecko_trng.c b/drivers/entropy/entropy_gecko_trng.c index f02fb8a0882..b71da09fd7a 100644 --- a/drivers/entropy/entropy_gecko_trng.c +++ b/drivers/entropy/entropy_gecko_trng.c @@ -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); diff --git a/drivers/entropy/entropy_litex.c b/drivers/entropy/entropy_litex.c index 6c720f7e623..6de135bb9b4 100644 --- a/drivers/entropy/entropy_litex.c +++ b/drivers/entropy/entropy_litex.c @@ -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); diff --git a/drivers/entropy/entropy_mcux_rng.c b/drivers/entropy/entropy_mcux_rng.c index ab9eb7b7269..fe93f3ba5c8 100644 --- a/drivers/entropy/entropy_mcux_rng.c +++ b/drivers/entropy/entropy_mcux_rng.c @@ -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) diff --git a/drivers/entropy/entropy_mcux_rnga.c b/drivers/entropy/entropy_mcux_rnga.c index 2df9264ce1c..29ce5095946 100644 --- a/drivers/entropy/entropy_mcux_rnga.c +++ b/drivers/entropy/entropy_mcux_rnga.c @@ -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) diff --git a/drivers/entropy/entropy_mcux_trng.c b/drivers/entropy/entropy_mcux_trng.c index d3cfb2d663f..9950ecc6be5 100644 --- a/drivers/entropy/entropy_mcux_trng.c +++ b/drivers/entropy/entropy_mcux_trng.c @@ -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) diff --git a/drivers/entropy/entropy_nrf5.c b/drivers/entropy/entropy_nrf5.c index dad76cdbe07..2fc5c194060 100644 --- a/drivers/entropy/entropy_nrf5.c +++ b/drivers/entropy/entropy_nrf5.c @@ -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) diff --git a/drivers/entropy/entropy_rv32m1_trng.c b/drivers/entropy/entropy_rv32m1_trng.c index 2d3dcf6f8f8..a4fce813158 100644 --- a/drivers/entropy/entropy_rv32m1_trng.c +++ b/drivers/entropy/entropy_rv32m1_trng.c @@ -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) diff --git a/drivers/entropy/entropy_sam.c b/drivers/entropy/entropy_sam.c index 48f276a294f..021b5209805 100644 --- a/drivers/entropy/entropy_sam.c +++ b/drivers/entropy/entropy_sam.c @@ -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); diff --git a/drivers/entropy/entropy_stm32.c b/drivers/entropy/entropy_stm32.c index 44c421c7a5e..8f911ea1d69 100644 --- a/drivers/entropy/entropy_stm32.c +++ b/drivers/entropy/entropy_stm32.c @@ -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); diff --git a/drivers/entropy/fake_entropy_native_posix.c b/drivers/entropy/fake_entropy_native_posix.c index 3f3cdeed7d5..c7e6b8419a4 100644 --- a/drivers/entropy/fake_entropy_native_posix.c +++ b/drivers/entropy/fake_entropy_native_posix.c @@ -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)