bus: sunxi-rsb: Fix shutdown
authorJernej Skrabec <jernej.skrabec@gmail.com>
Sun, 21 Nov 2021 08:35:37 +0000 (09:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Dec 2021 11:28:38 +0000 (12:28 +0100)
commit512dbc1a09acbc5a8d3301a248d03a69e303fcfa
treecb928cc3b5e99622d62df5e3d1d3ca5628fcf6da
parent115a291395df470bf0bb8f2521a9b0d515ea4805
bus: sunxi-rsb: Fix shutdown

[ Upstream commit 017a716e7b0e9d4ac06a4d7779bd04fca009bbc9 ]

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.

Fixes: 4a0dbc12e618 ("bus: sunxi-rsb: Implement runtime power management")
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20211121083537.612473-1-jernej.skrabec@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/bus/sunxi-rsb.c