diff mbox series

hwrng: cctrng - Use device-managed registration API

Message ID 1614566628-52886-1-git-send-email-tiantao6@hisilicon.com
State Accepted
Commit ae8351284b74bf93eb4d2b67178f2e9a09c19932
Headers show
Series hwrng: cctrng - Use device-managed registration API | expand

Commit Message

Tian Tao March 1, 2021, 2:43 a.m. UTC
Use devm_hwrng_register to get rid of manual unregistration.

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

Comments

Herbert Xu March 12, 2021, 1:10 p.m. UTC | #1
On Mon, Mar 01, 2021 at 10:43:48AM +0800, Tian Tao wrote:
> Use devm_hwrng_register to get rid of manual unregistration.

> 

> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>

> ---

>  drivers/char/hw_random/cctrng.c | 4 +---

>  1 file changed, 1 insertion(+), 3 deletions(-)


Patch 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
diff mbox series

Patch

diff --git a/drivers/char/hw_random/cctrng.c b/drivers/char/hw_random/cctrng.c
index 7a293f2..0efb37a 100644
--- a/drivers/char/hw_random/cctrng.c
+++ b/drivers/char/hw_random/cctrng.c
@@ -585,7 +585,7 @@  static int cctrng_probe(struct platform_device *pdev)
 	atomic_set(&drvdata->pending_hw, 1);
 
 	/* registration of the hwrng device */
-	rc = hwrng_register(&drvdata->rng);
+	rc = devm_hwrng_register(dev, &drvdata->rng);
 	if (rc) {
 		dev_err(dev, "Could not register hwrng device.\n");
 		goto post_pm_err;
@@ -618,8 +618,6 @@  static int cctrng_remove(struct platform_device *pdev)
 
 	dev_dbg(dev, "Releasing cctrng resources...\n");
 
-	hwrng_unregister(&drvdata->rng);
-
 	cc_trng_pm_fini(drvdata);
 
 	cc_trng_clk_fini(drvdata);