[PATCH v5 3/3] media: rkvdec: suspend the device in remove when a usage count is held

From: Francesco Saverio Pavone

Date: Fri Dec 04 2026 - 03:31:49 EST


rkvdec_remove() counts on pm_runtime_dont_use_autosuspend() to suspend
the device before runtime PM is disabled. That works only when the
usage count is zero. If something still holds a count, for example
power/control set to "on", the device stays active, the driver core
marks it suspended without calling the callback, and the clocks
enabled in rkvdec_runtime_resume() are never disabled. Each unbind in
that state leaves the enable count of the five clocks one higher.

Use pm_runtime_force_suspend() instead of pm_runtime_disable(). It
disables runtime PM and runs the suspend callback if the device is
still active.

The probe error path keeps pm_runtime_disable(): the driver has not
resumed the device at that point.

Fixes: cd33c830448b ("media: rkvdec: Add the rkvdec driver")
Signed-off-by: Francesco Saverio Pavone <pavone.lawyer@xxxxxxxxx>
---
drivers/media/platform/rockchip/rkvdec/rkvdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
index 8a0967f6f6895..476b545c89db2 100644
--- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c
+++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
@@ -1908,7 +1908,7 @@ static void rkvdec_remove(struct platform_device *pdev)
if (rkvdec->empty_domain)
iommu_domain_free(rkvdec->empty_domain);

- pm_runtime_disable(&pdev->dev);
+ pm_runtime_force_suspend(&pdev->dev);
rkvdec_v4l2_release(rkvdec);
}

--
2.54.0