All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwrng: optee -: Use device-managed registration API
@ 2021-02-03  9:24 Tian Tao
  2021-02-03 12:17 ` Sumit Garg
  0 siblings, 1 reply; 2+ messages in thread
From: Tian Tao @ 2021-02-03  9:24 UTC (permalink / raw)
  To: sumit.garg, herbert; +Cc: op-tee, linux-crypto

Use devm_hwrng_register to get rid of manual unregistration.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/char/hw_random/optee-rng.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/char/hw_random/optee-rng.c b/drivers/char/hw_random/optee-rng.c
index a99d829..135a825 100644
--- a/drivers/char/hw_random/optee-rng.c
+++ b/drivers/char/hw_random/optee-rng.c
@@ -243,7 +243,7 @@ static int optee_rng_probe(struct device *dev)
 	if (err)
 		goto out_sess;
 
-	err = hwrng_register(&pvt_data.optee_rng);
+	err = devm_hwrng_register(dev, &pvt_data.optee_rng);
 	if (err) {
 		dev_err(dev, "hwrng registration failed (%d)\n", err);
 		goto out_sess;
@@ -263,7 +263,6 @@ static int optee_rng_probe(struct device *dev)
 
 static int optee_rng_remove(struct device *dev)
 {
-	hwrng_unregister(&pvt_data.optee_rng);
 	tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
 	tee_client_close_context(pvt_data.ctx);
 
-- 
2.7.4


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

* Re: [PATCH] hwrng: optee -: Use device-managed registration API
  2021-02-03  9:24 [PATCH] hwrng: optee -: Use device-managed registration API Tian Tao
@ 2021-02-03 12:17 ` Sumit Garg
  0 siblings, 0 replies; 2+ messages in thread
From: Sumit Garg @ 2021-02-03 12:17 UTC (permalink / raw)
  To: Tian Tao
  Cc: Herbert Xu, op-tee, open list:HARDWARE RANDOM NUMBER GENERATOR CORE

On Wed, 3 Feb 2021 at 14:55, Tian Tao <tiantao6@hisilicon.com> wrote:
>
> Use devm_hwrng_register to get rid of manual unregistration.
>
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
>  drivers/char/hw_random/optee-rng.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>

Fix up subject line as s/hwrng: optee -:/hwrng: optee:/

With that fixed you can add:

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>

-Sumit

> diff --git a/drivers/char/hw_random/optee-rng.c b/drivers/char/hw_random/optee-rng.c
> index a99d829..135a825 100644
> --- a/drivers/char/hw_random/optee-rng.c
> +++ b/drivers/char/hw_random/optee-rng.c
> @@ -243,7 +243,7 @@ static int optee_rng_probe(struct device *dev)
>         if (err)
>                 goto out_sess;
>
> -       err = hwrng_register(&pvt_data.optee_rng);
> +       err = devm_hwrng_register(dev, &pvt_data.optee_rng);
>         if (err) {
>                 dev_err(dev, "hwrng registration failed (%d)\n", err);
>                 goto out_sess;
> @@ -263,7 +263,6 @@ static int optee_rng_probe(struct device *dev)
>
>  static int optee_rng_remove(struct device *dev)
>  {
> -       hwrng_unregister(&pvt_data.optee_rng);
>         tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
>         tee_client_close_context(pvt_data.ctx);
>
> --
> 2.7.4
>

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

end of thread, other threads:[~2021-02-03 12:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03  9:24 [PATCH] hwrng: optee -: Use device-managed registration API Tian Tao
2021-02-03 12:17 ` Sumit Garg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.