This series will fix two missing parts in the current driver.
The first one will fix a missing function in the rng driver that
need to call a proper removal to notify the pm_runtime framework.
Second is an improvement for driver to be used as default entropy
source early in the boot processing.
Lionel Debieve (2):
hwrng: stm32 - fix unbalanced pm_runtime_enable
hwrng: stm32 - set default random quality
drivers/char/hw_random/stm32-rng.c | 9 +++++++++
1 file changed, 9 insertions(+)
--
2.7.4
No remove function implemented yet in the driver.
Without remove function, the pm_runtime implementation
complains when removing and probing again the driver.
Signed-off-by: Lionel Debieve <[email protected]>
---
drivers/char/hw_random/stm32-rng.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c
index 042860d..37b338a 100644
--- a/drivers/char/hw_random/stm32-rng.c
+++ b/drivers/char/hw_random/stm32-rng.c
@@ -169,6 +169,13 @@ static int stm32_rng_probe(struct platform_device *ofdev)
return devm_hwrng_register(dev, &priv->rng);
}
+static int stm32_rng_remove(struct platform_device *ofdev)
+{
+ pm_runtime_disable(&ofdev->dev);
+
+ return 0;
+}
+
#ifdef CONFIG_PM
static int stm32_rng_runtime_suspend(struct device *dev)
{
@@ -210,6 +217,7 @@ static struct platform_driver stm32_rng_driver = {
.of_match_table = stm32_rng_match,
},
.probe = stm32_rng_probe,
+ .remove = stm32_rng_remove,
};
module_platform_driver(stm32_rng_driver);
--
2.7.4
Add a default quality to hw_random device to be
automatically set as new default entropy. Setting
random quality will decrease the crng init time by
switching to this hardware random source.
Signed-off-by: Lionel Debieve <[email protected]>
---
drivers/char/hw_random/stm32-rng.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c
index 37b338a..0ef5b6a 100644
--- a/drivers/char/hw_random/stm32-rng.c
+++ b/drivers/char/hw_random/stm32-rng.c
@@ -161,6 +161,7 @@ static int stm32_rng_probe(struct platform_device *ofdev)
#endif
priv->rng.read = stm32_rng_read,
priv->rng.priv = (unsigned long) dev;
+ priv->rng.quality = 900;
pm_runtime_set_autosuspend_delay(dev, 100);
pm_runtime_use_autosuspend(dev);
--
2.7.4
On Mon, Apr 01, 2019 at 12:30:44PM +0200, Lionel Debieve wrote:
> This series will fix two missing parts in the current driver.
> The first one will fix a missing function in the rng driver that
> need to call a proper removal to notify the pm_runtime framework.
>
> Second is an improvement for driver to be used as default entropy
> source early in the boot processing.
>
> Lionel Debieve (2):
> hwrng: stm32 - fix unbalanced pm_runtime_enable
> hwrng: stm32 - set default random quality
>
> drivers/char/hw_random/stm32-rng.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
All applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt