summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalakrishnan Sambath <balakrishnan.s@microchip.com>2026-08-19 11:49:20 +0530
committerHans Verkuil <hverkuil+cisco@kernel.org>2026-09-09 09:16:32 +0200
commit61490ff518c7b3ea3ff1cd16bbc012e9e4f1ab74 (patch)
tree51c6e2c228126c68a84dfcdada255e712542683f
parent6e9eaa3b93870e4edac1bd2539fe113c24663eaf (diff)
downloadlinux-next-61490ff518c7b3ea3ff1cd16bbc012e9e4f1ab74.tar.gz
linux-next-61490ff518c7b3ea3ff1cd16bbc012e9e4f1ab74.zip
media: microchip-isc: don't sleep in the clk .is_enabled callback
isc_clk_is_enabled() calls pm_runtime_resume_and_get() and pm_runtime_put_sync(), which can sleep and are not safe here, as .is_enabled must run in atomic context. clk_disable_unused() calls it so at boot, and CONFIG_DEBUG_ATOMIC_SLEEP reports a "sleeping function called from invalid context" BUG. Use the atomic-safe pm_runtime_get_if_active() and pm_runtime_put() instead. A suspended ISC has its clocks gated, so report the clock disabled when the device is not already active. Fixes: 01192aa1c5c2 ("media: atmel-isc: Enable the clocks during probe") Cc: stable@vger.kernel.org Signed-off-by: Balakrishnan Sambath <balakrishnan.s@microchip.com> Reviewed-by: Eugen Hristev <ehristev@kernel.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
-rw-r--r--drivers/media/platform/microchip/microchip-isc-clk.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/media/platform/microchip/microchip-isc-clk.c b/drivers/media/platform/microchip/microchip-isc-clk.c
index 24358d804e75..66dc522a6190 100644
--- a/drivers/media/platform/microchip/microchip-isc-clk.c
+++ b/drivers/media/platform/microchip/microchip-isc-clk.c
@@ -98,15 +98,14 @@ static int isc_clk_is_enabled(struct clk_hw *hw)
{
struct isc_clk *isc_clk = to_isc_clk(hw);
u32 status;
- int ret;
- ret = pm_runtime_resume_and_get(isc_clk->dev);
- if (ret < 0)
+ /* Runs in atomic context, so must not sleep to resume the ISC. */
+ if (pm_runtime_get_if_active(isc_clk->dev) <= 0)
return 0;
regmap_read(isc_clk->regmap, ISC_CLKSR, &status);
- pm_runtime_put_sync(isc_clk->dev);
+ pm_runtime_put(isc_clk->dev);
return status & ISC_CLK(isc_clk->id) ? 1 : 0;
}