bus: sunxi-rsb: Fix shutdown
Jernej Skrabec
maintainerPATCH 1/1 bus: sunxi-rsb: Fix shutdown
Function sunxi_rsb_hw_exit() is sometimes called with pm runtime disabled, so in such cases pm_runtime_resume() will fail with -EACCES.
Instead of doing whole dance of enabling pm runtime and thus clock just to disable it again immediately, just check if disabling clock is needed. That way calling pm_runtime_resume() is not needed at all.
--- drivers/bus/sunxi-rsb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/bus/sunxi-rsb.c +4 -4
@@ -687,11 +687,11 @@ static int sunxi_rsb_hw_init(struct sunxi_rsb *rsb)static void sunxi_rsb_hw_exit (struct sunxi_rsb *rsb) { -/* Keep the clock and PM reference counts consistent. */ -if (pm_runtime_status_suspended (rsb->dev)) -pm_runtime_resume (rsb->dev);reset_control_assert (rsb->rstc); -clk_disable_unprepare (rsb->clk); + +/* Keep the clock and PM reference counts consistent. */ +if (!pm_runtime_status_suspended (rsb->dev)) +clk_disable_unprepare (rsb->clk); }static int __maybe_unused sunxi_rsb_runtime_suspend (struct device *dev)
Signature · 1 line
2.34.0
Maxime Ripard
AppliedQuoted 8 lines · Jernej Skrabec
Function
sunxi_rsb_hw_exit()is sometimes called with pm runtime disabled, so in such casespm_runtime_resume()will fail with-EACCES.Instead of doing whole dance of enabling pm runtime and thus clock just to disable it again immediately, just check if disabling clock is needed. That way calling
pm_runtime_resume()is not needed at all.[...]
Applied to sunxi/linux.git (sunxi/drivers-for-5.17).
Thanks!
Maxime