spi: rockchip: Resolve unbalanced runtime PM / system PM handling
authorBrian Norris <briannorris@chromium.org>
Tue, 27 Aug 2024 17:11:16 +0000 (10:11 -0700)
committerMark Brown <broonie@kernel.org>
Wed, 28 Aug 2024 19:39:00 +0000 (20:39 +0100)
commitbe721b451affbecc4ba4eaac3b71cdbdcade1b1b
tree8c602f83f3f0154974fcb6c9689f92f55110f024
parent5be63fc19fcaa4c236b307420483578a56986a37
spi: rockchip: Resolve unbalanced runtime PM / system PM handling

Commit e882575efc77 ("spi: rockchip: Suspend and resume the bus during
NOIRQ_SYSTEM_SLEEP_PM ops") stopped respecting runtime PM status and
simply disabled clocks unconditionally when suspending the system. This
causes problems when the device is already runtime suspended when we go
to sleep -- in which case we double-disable clocks and produce a
WARNing.

Switch back to pm_runtime_force_{suspend,resume}(), because that still
seems like the right thing to do, and the aforementioned commit makes no
explanation why it stopped using it.

Also, refactor some of the resume() error handling, because it's not
actually a good idea to re-disable clocks on failure.

Fixes: e882575efc77 ("spi: rockchip: Suspend and resume the bus during NOIRQ_SYSTEM_SLEEP_PM ops")
Cc: stable@vger.kernel.org
Reported-by: Ondřej Jirman <megi@xff.cz>
Closes: https://lore.kernel.org/lkml/20220621154218.sau54jeij4bunf56@core/
Signed-off-by: Brian Norris <briannorris@chromium.org>
Link: https://patch.msgid.link/20240827171126.1115748-1-briannorris@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-rockchip.c