hwrng: timeriomem - Use device-managed registration API
authorTian Tao <tiantao6@hisilicon.com>
Sun, 7 Feb 2021 02:39:05 +0000 (10:39 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 10 Feb 2021 06:56:01 +0000 (17:56 +1100)
Use devm_hwrng_register to get rid of manual unregistration.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/timeriomem-rng.c

index f35f0f3..8ea1fc8 100644 (file)
@@ -169,7 +169,7 @@ static int timeriomem_rng_probe(struct platform_device *pdev)
        priv->present = 1;
        complete(&priv->completion);
 
-       err = hwrng_register(&priv->rng_ops);
+       err = devm_hwrng_register(&pdev->dev, &priv->rng_ops);
        if (err) {
                dev_err(&pdev->dev, "problem registering\n");
                return err;
@@ -185,7 +185,6 @@ static int timeriomem_rng_remove(struct platform_device *pdev)
 {
        struct timeriomem_rng_private *priv = platform_get_drvdata(pdev);
 
-       hwrng_unregister(&priv->rng_ops);
        hrtimer_cancel(&priv->timer);
 
        return 0;