hwrng: tx4939 - Use devm_hwrng_register instead of hwrng_register
authorPrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Sun, 28 Aug 2016 08:49:12 +0000 (14:19 +0530)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 31 Aug 2016 15:00:49 +0000 (23:00 +0800)
By using devm_hwrng_register instead of hwrng_register the .remove
callback in platform_driver can be removed. This reduces a few lines in
code.

Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/tx4939-rng.c

index a7b69491341665526fcd1ee3a3074c2383ff27ed..1093583b579c56852daeda0d8d5033f484a48443 100644 (file)
@@ -144,22 +144,13 @@ static int __init tx4939_rng_probe(struct platform_device *dev)
        }
 
        platform_set_drvdata(dev, rngdev);
-       return hwrng_register(&rngdev->rng);
-}
-
-static int __exit tx4939_rng_remove(struct platform_device *dev)
-{
-       struct tx4939_rng *rngdev = platform_get_drvdata(dev);
-
-       hwrng_unregister(&rngdev->rng);
-       return 0;
+       return devm_hwrng_register(&dev->dev, &rngdev->rng);
 }
 
 static struct platform_driver tx4939_rng_driver = {
        .driver         = {
                .name   = "tx4939-rng",
        },
-       .remove = tx4939_rng_remove,
 };
 
 module_platform_driver_probe(tx4939_rng_driver, tx4939_rng_probe);