Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Francesco Saverio Pavone <pavone.lawyer@gmail.com>
To: Jonas Karlman <jonas@kwiboo.se>,
	Detlev Casanova <detlev.casanova@collabora.com>,
	Nicolas Dufresne <nicolas.dufresne@collabora.com>,
	Hans Verkuil <hverkuil@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
	Heiko Stuebner <heiko@sntech.de>,
	linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v5 3/3] media: rkvdec: suspend the device in remove when a usage count is held
Date: Fri,  4 Dec 2026 09:31:22 +0100	[thread overview]
Message-ID: <20261204083123.30740-4-pavone.lawyer@gmail.com> (raw)
In-Reply-To: <20261204083123.30740-1-pavone.lawyer@gmail.com>

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@gmail.com>
---
 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



      parent reply	other threads:[~2026-12-04  8:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  8:31 [PATCH v5 0/3] media: rkvdec: fix the clk leaks on unbind Francesco Saverio Pavone
2026-12-04  8:31 ` [PATCH v5 1/3] media: rkvdec: split the V4L2 teardown and unregister the devices first Francesco Saverio Pavone
2026-12-04  8:31 ` [PATCH v5 2/3] media: rkvdec: fix clk reference leak on unbind Francesco Saverio Pavone
2026-12-04  8:31 ` Francesco Saverio Pavone [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261204083123.30740-4-pavone.lawyer@gmail.com \
    --to=pavone.lawyer@gmail.com \
    --cc=detlev.casanova@collabora.com \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=heiko@sntech.de \
    --cc=hverkuil@kernel.org \
    --cc=jonas@kwiboo.se \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=nicolas.dufresne@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox