Skip to content

Commit

Permalink
hwrng: ingenic - switch to device managed registration
Browse files Browse the repository at this point in the history
Call devm_hwrng_register for device managed registration of the
ingenic-trng driver. ingenic_trng_remove can then be deleted.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
martin-kaiser authored and herbertx committed Jul 22, 2023
1 parent 71839a6 commit a40be5e
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions drivers/char/hw_random/ingenic-trng.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static int ingenic_trng_probe(struct platform_device *pdev)
trng->rng.cleanup = ingenic_trng_cleanup;
trng->rng.read = ingenic_trng_read;

ret = hwrng_register(&trng->rng);
ret = devm_hwrng_register(&pdev->dev, &trng->rng);
if (ret)
return dev_err_probe(&pdev->dev, ret, "Failed to register hwrng\n");

Expand All @@ -108,15 +108,6 @@ static int ingenic_trng_probe(struct platform_device *pdev)
return 0;
}

static int ingenic_trng_remove(struct platform_device *pdev)
{
struct ingenic_trng *trng = platform_get_drvdata(pdev);

hwrng_unregister(&trng->rng);

return 0;
}

static const struct of_device_id ingenic_trng_of_match[] = {
{ .compatible = "ingenic,x1830-dtrng" },
{ /* sentinel */ }
Expand All @@ -125,7 +116,6 @@ MODULE_DEVICE_TABLE(of, ingenic_trng_of_match);

static struct platform_driver ingenic_trng_driver = {
.probe = ingenic_trng_probe,
.remove = ingenic_trng_remove,
.driver = {
.name = "ingenic-trng",
.of_match_table = ingenic_trng_of_match,
Expand Down

0 comments on commit a40be5e

Please sign in to comment.