hwrng: drivers - Use device-managed registration API

Use devm_hwrng_register to simplify the implementation.
Manual unregistration and some remove functions can be
removed now.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Acked-by: Łukasz Stelmach <l.stelmach@samsung.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Chuhong Yuan
2019-07-25 16:01:55 +08:00
committed by Herbert Xu
parent dec0fb3946
commit 3e75241be8
9 changed files with 9 additions and 36 deletions

View File

@@ -33,18 +33,11 @@ static struct hwrng powernv_hwrng = {
.read = powernv_rng_read,
};
static int powernv_rng_remove(struct platform_device *pdev)
{
hwrng_unregister(&powernv_hwrng);
return 0;
}
static int powernv_rng_probe(struct platform_device *pdev)
{
int rc;
rc = hwrng_register(&powernv_hwrng);
rc = devm_hwrng_register(&pdev->dev, &powernv_hwrng);
if (rc) {
/* We only register one device, ignore any others */
if (rc == -EEXIST)
@@ -70,7 +63,6 @@ static struct platform_driver powernv_rng_driver = {
.of_match_table = powernv_rng_match,
},
.probe = powernv_rng_probe,
.remove = powernv_rng_remove,
};
module_platform_driver(powernv_rng_driver);