linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] hwrng: stm32 - Fix issue and add default quality level
@ 2019-04-01 10:30 Lionel Debieve
  2019-04-01 10:30 ` [PATCH 1/2] hwrng: stm32 - fix unbalanced pm_runtime_enable Lionel Debieve
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lionel Debieve @ 2019-04-01 10:30 UTC (permalink / raw)
  To: Matt Mackall, Herbert Xu, Arnd Bergmann, Greg Kroah-Hartman,
	Maxime Coquelin, Alexandre Torgue, Rob Herring, linux-crypto,
	linux-arm-kernel, linux-kernel
  Cc: Benjamin Gaignard, Ludovic Barre, linux-stm32

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] hwrng: stm32 - fix unbalanced pm_runtime_enable
  2019-04-01 10:30 [PATCH 0/2] hwrng: stm32 - Fix issue and add default quality level Lionel Debieve
@ 2019-04-01 10:30 ` Lionel Debieve
  2019-04-01 10:30 ` [PATCH 2/2] hwrng: stm32 - set default random quality Lionel Debieve
  2019-04-15  9:41 ` [PATCH 0/2] hwrng: stm32 - Fix issue and add default quality level Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Lionel Debieve @ 2019-04-01 10:30 UTC (permalink / raw)
  To: Matt Mackall, Herbert Xu, Arnd Bergmann, Greg Kroah-Hartman,
	Maxime Coquelin, Alexandre Torgue, Rob Herring, linux-crypto,
	linux-arm-kernel, linux-kernel
  Cc: Benjamin Gaignard, Ludovic Barre, linux-stm32

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 <lionel.debieve@st.com>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] hwrng: stm32 - set default random quality
  2019-04-01 10:30 [PATCH 0/2] hwrng: stm32 - Fix issue and add default quality level Lionel Debieve
  2019-04-01 10:30 ` [PATCH 1/2] hwrng: stm32 - fix unbalanced pm_runtime_enable Lionel Debieve
@ 2019-04-01 10:30 ` Lionel Debieve
  2019-04-15  9:41 ` [PATCH 0/2] hwrng: stm32 - Fix issue and add default quality level Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Lionel Debieve @ 2019-04-01 10:30 UTC (permalink / raw)
  To: Matt Mackall, Herbert Xu, Arnd Bergmann, Greg Kroah-Hartman,
	Maxime Coquelin, Alexandre Torgue, Rob Herring, linux-crypto,
	linux-arm-kernel, linux-kernel
  Cc: Benjamin Gaignard, Ludovic Barre, linux-stm32

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 <lionel.debieve@st.com>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] hwrng: stm32 - Fix issue and add default quality level
  2019-04-01 10:30 [PATCH 0/2] hwrng: stm32 - Fix issue and add default quality level Lionel Debieve
  2019-04-01 10:30 ` [PATCH 1/2] hwrng: stm32 - fix unbalanced pm_runtime_enable Lionel Debieve
  2019-04-01 10:30 ` [PATCH 2/2] hwrng: stm32 - set default random quality Lionel Debieve
@ 2019-04-15  9:41 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2019-04-15  9:41 UTC (permalink / raw)
  To: Lionel Debieve
  Cc: Matt Mackall, Arnd Bergmann, Greg Kroah-Hartman, Maxime Coquelin,
	Alexandre Torgue, Rob Herring, linux-crypto, linux-arm-kernel,
	linux-kernel, Benjamin Gaignard, Ludovic Barre, linux-stm32

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 <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-15  9:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-01 10:30 [PATCH 0/2] hwrng: stm32 - Fix issue and add default quality level Lionel Debieve
2019-04-01 10:30 ` [PATCH 1/2] hwrng: stm32 - fix unbalanced pm_runtime_enable Lionel Debieve
2019-04-01 10:30 ` [PATCH 2/2] hwrng: stm32 - set default random quality Lionel Debieve
2019-04-15  9:41 ` [PATCH 0/2] hwrng: stm32 - Fix issue and add default quality level Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).