2019-07-23 14:45:52

by Chuhong Yuan

[permalink] [raw]
Subject: [PATCH] crypto: atmel-sha204a: Use device-managed registration API

Use devm_hwrng_register to get rid of manual
unregistration.

Signed-off-by: Chuhong Yuan <[email protected]>
---
drivers/crypto/atmel-sha204a.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/crypto/atmel-sha204a.c b/drivers/crypto/atmel-sha204a.c
index ea0d2068ea4f..c96c14e7dab1 100644
--- a/drivers/crypto/atmel-sha204a.c
+++ b/drivers/crypto/atmel-sha204a.c
@@ -109,7 +109,7 @@ static int atmel_sha204a_probe(struct i2c_client *client,
i2c_priv->hwrng.read = atmel_sha204a_rng_read;
i2c_priv->hwrng.quality = 1024;

- ret = hwrng_register(&i2c_priv->hwrng);
+ ret = devm_hwrng_register(&client->dev, &i2c_priv->hwrng);
if (ret)
dev_warn(&client->dev, "failed to register RNG (%d)\n", ret);

@@ -127,7 +127,6 @@ static int atmel_sha204a_remove(struct i2c_client *client)

if (i2c_priv->hwrng.priv)
kfree((void *)i2c_priv->hwrng.priv);
- hwrng_unregister(&i2c_priv->hwrng);

return 0;
}
--
2.20.1


2019-07-31 12:41:44

by Ludovic Desroches

[permalink] [raw]
Subject: Re: [PATCH] crypto: atmel-sha204a: Use device-managed registration API

On Tue, Jul 23, 2019 at 03:19:36PM +0800, Chuhong Yuan wrote:
>
> Use devm_hwrng_register to get rid of manual
> unregistration.
>
> Signed-off-by: Chuhong Yuan <[email protected]>
Acked-by: Ludovic Desroches <[email protected]>

Thanks

> ---
> drivers/crypto/atmel-sha204a.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/crypto/atmel-sha204a.c b/drivers/crypto/atmel-sha204a.c
> index ea0d2068ea4f..c96c14e7dab1 100644
> --- a/drivers/crypto/atmel-sha204a.c
> +++ b/drivers/crypto/atmel-sha204a.c
> @@ -109,7 +109,7 @@ static int atmel_sha204a_probe(struct i2c_client *client,
> i2c_priv->hwrng.read = atmel_sha204a_rng_read;
> i2c_priv->hwrng.quality = 1024;
>
> - ret = hwrng_register(&i2c_priv->hwrng);
> + ret = devm_hwrng_register(&client->dev, &i2c_priv->hwrng);
> if (ret)
> dev_warn(&client->dev, "failed to register RNG (%d)\n", ret);
>
> @@ -127,7 +127,6 @@ static int atmel_sha204a_remove(struct i2c_client *client)
>
> if (i2c_priv->hwrng.priv)
> kfree((void *)i2c_priv->hwrng.priv);
> - hwrng_unregister(&i2c_priv->hwrng);
>
> return 0;
> }
> --
> 2.20.1
>
>

2019-08-02 08:52:54

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: atmel-sha204a: Use device-managed registration API

On Tue, Jul 23, 2019 at 03:19:36PM +0800, Chuhong Yuan wrote:
> Use devm_hwrng_register to get rid of manual
> unregistration.
>
> Signed-off-by: Chuhong Yuan <[email protected]>
> ---
> drivers/crypto/atmel-sha204a.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)

Patch 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