Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Martin Kaiser and committed by
Herbert Xu
d5eb916d 6a2bc448

+1 -11
+1 -11
drivers/char/hw_random/imx-rngc.c
··· 292 292 } 293 293 } 294 294 295 - ret = hwrng_register(&rngc->rng); 295 + ret = devm_hwrng_register(&pdev->dev, &rngc->rng); 296 296 if (ret) { 297 297 dev_err(&pdev->dev, "hwrng registration failed\n"); 298 298 return ret; ··· 302 302 "Freescale RNG%c registered (HW revision %d.%02d)\n", 303 303 rng_type == RNGC_TYPE_RNGB ? 'B' : 'C', 304 304 (ver_id >> RNGC_VER_MAJ_SHIFT) & 0xff, ver_id & 0xff); 305 - return 0; 306 - } 307 - 308 - static int __exit imx_rngc_remove(struct platform_device *pdev) 309 - { 310 - struct imx_rngc *rngc = platform_get_drvdata(pdev); 311 - 312 - hwrng_unregister(&rngc->rng); 313 - 314 305 return 0; 315 306 } 316 307 ··· 337 346 .pm = &imx_rngc_pm_ops, 338 347 .of_match_table = imx_rngc_dt_ids, 339 348 }, 340 - .remove = __exit_p(imx_rngc_remove), 341 349 }; 342 350 343 351 module_platform_driver_probe(imx_rngc_driver, imx_rngc_probe);