aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorMartin Kaiser <martin@kaiser.cx>2022-08-15 21:37:43 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2022-08-26 18:49:10 +0800
commitd5eb916d889f12f27275e2049b9c4df43b7cfa13 (patch)
tree9ac9ddf5ff966afc09e0e50ccd01016706704918 /drivers/char
parenthwrng: imx-rngc - use devm_clk_get_enabled (diff)
downloadlinux-dev-d5eb916d889f12f27275e2049b9c4df43b7cfa13.tar.xz
linux-dev-d5eb916d889f12f27275e2049b9c4df43b7cfa13.zip
hwrng: imx-rngc - use devres for hwrng registration
Replace hwrng_register with devm_hwrng_register and let devres unregister our hwrng when the device is removed. It's possible to do this now that devres also handles clock disable+uprepare. When we had to disable+unprepare the clock ourselves, we had to unregister the hwrng before this and couldn't use devres. There's nothing left to do for imx_rngc_remove, this function can go. Signed-off-by: Martin Kaiser <martin@kaiser.cx> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/hw_random/imx-rngc.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
index 9b243356d4db..f5d07b472d8a 100644
--- a/drivers/char/hw_random/imx-rngc.c
+++ b/drivers/char/hw_random/imx-rngc.c
@@ -292,7 +292,7 @@ static int imx_rngc_probe(struct platform_device *pdev)
}
}
- ret = hwrng_register(&rngc->rng);
+ ret = devm_hwrng_register(&pdev->dev, &rngc->rng);
if (ret) {
dev_err(&pdev->dev, "hwrng registration failed\n");
return ret;
@@ -305,15 +305,6 @@ static int imx_rngc_probe(struct platform_device *pdev)
return 0;
}
-static int __exit imx_rngc_remove(struct platform_device *pdev)
-{
- struct imx_rngc *rngc = platform_get_drvdata(pdev);
-
- hwrng_unregister(&rngc->rng);
-
- return 0;
-}
-
static int __maybe_unused imx_rngc_suspend(struct device *dev)
{
struct imx_rngc *rngc = dev_get_drvdata(dev);
@@ -346,7 +337,6 @@ static struct platform_driver imx_rngc_driver = {
.pm = &imx_rngc_pm_ops,
.of_match_table = imx_rngc_dt_ids,
},
- .remove = __exit_p(imx_rngc_remove),
};
module_platform_driver_probe(imx_rngc_driver, imx_rngc_probe);