Skip to content

Commit

Permalink
hwrng: ingenic - don't disable the rng in ingenic_trng_remove
Browse files Browse the repository at this point in the history
There's no need to disable the rng in ingenic_trng_remove.

The driver's init function sets the CFG_GEN_EN bit to enable the
rng. The cleanup function clears CFG_GEN_EN to revert this.

The remove function calls hwrng_unregister. If the ingenic-trng is not
the current rng at this point, CFG_GEN_EN has already been cleared. If
the ingenic-trng is the current rng, drop_current_rng will call the
cleanup function.

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 6257490 commit 71839a6
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions drivers/char/hw_random/ingenic-trng.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,9 @@ static int ingenic_trng_probe(struct platform_device *pdev)
static int ingenic_trng_remove(struct platform_device *pdev)
{
struct ingenic_trng *trng = platform_get_drvdata(pdev);
unsigned int ctrl;

hwrng_unregister(&trng->rng);

ctrl = readl(trng->base + TRNG_REG_CFG_OFFSET);
ctrl &= ~CFG_GEN_EN;
writel(ctrl, trng->base + TRNG_REG_CFG_OFFSET);

return 0;
}

Expand Down

0 comments on commit 71839a6

Please sign in to comment.