Commit eaecce12 authored by Tony Lindgren's avatar Tony Lindgren Committed by Herbert Xu

hwrng: omap3-rom - Call clk_disable_unprepare() on exit only if not idled

When unloading omap3-rom-rng, we'll get the following:

WARNING: CPU: 0 PID: 100 at drivers/clk/clk.c:948 clk_core_disable

This is because the clock may be already disabled by omap3_rom_rng_idle().
Let's fix the issue by checking for rng_idle on exit.

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Adam Ford <aford173@gmail.com>
Cc: Pali Rohár <pali.rohar@gmail.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Tero Kristo <t-kristo@ti.com>
Fixes: 1c6b7c21 ("hwrng: OMAP3 ROM Random Number Generator support")
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 0c0ef9ea
...@@ -127,7 +127,8 @@ static int omap3_rom_rng_remove(struct platform_device *pdev) ...@@ -127,7 +127,8 @@ static int omap3_rom_rng_remove(struct platform_device *pdev)
{ {
cancel_delayed_work_sync(&idle_work); cancel_delayed_work_sync(&idle_work);
hwrng_unregister(&omap3_rom_rng_ops); hwrng_unregister(&omap3_rom_rng_ops);
clk_disable_unprepare(rng_clk); if (!rng_idle)
clk_disable_unprepare(rng_clk);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment