From: Tarang Raval <tarang.raval@siliconsignals.io>
To: sakari.ailus@linux.intel.com, kieran.bingham@ideasonboard.com
Cc: Shravan.Chippa@microchip.com,
"Tarang Raval" <tarang.raval@siliconsignals.io>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Hans Verkuil" <hverkuil@xs4all.nl>,
"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
"Umang Jain" <umang.jain@ideasonboard.com>,
"Julien Massot" <julien.massot@collabora.com>,
"Zhi Mao" <zhi.mao@mediatek.com>,
"Luis Garcia" <git@luigi311.com>,
"André Apitzsch" <git@apitzsch.eu>,
"Benjamin Mugnier" <benjamin.mugnier@foss.st.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 6/9] media: i2c: imx334: Fix runtime PM handling in remove function
Date: Sat, 29 Mar 2025 11:13:28 +0530 [thread overview]
Message-ID: <20250329054335.19931-7-tarang.raval@siliconsignals.io> (raw)
In-Reply-To: <20250329054335.19931-1-tarang.raval@siliconsignals.io>
pm_runtime_suspended() only checks the current runtime PM status and does
not modify it, making it ineffective in this context. This could result in
improper power management if the device remains active when removed.
This patch fixes the issue by introducing a check with
pm_runtime_status_suspended() to determine if the device is already
suspended. If it is not, it calls imx334_power_off() to power down the
device and then uses pm_runtime_set_suspended() to correctly update the
runtime PM status to suspended.
Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
---
drivers/media/i2c/imx334.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c
index 56d5576ccf94..ad28f12c29b3 100644
--- a/drivers/media/i2c/imx334.c
+++ b/drivers/media/i2c/imx334.c
@@ -1328,7 +1328,10 @@ static void imx334_remove(struct i2c_client *client)
v4l2_ctrl_handler_free(sd->ctrl_handler);
pm_runtime_disable(&client->dev);
- pm_runtime_suspended(&client->dev);
+ if (!pm_runtime_status_suspended(&client->dev)) {
+ imx334_power_off(&client->dev);
+ pm_runtime_set_suspended(&client->dev);
+ }
mutex_destroy(&imx334->mutex);
}
--
2.34.1
next prev parent reply other threads:[~2025-03-29 5:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-29 5:43 [PATCH v2 0/9] media: i2c: imx334: Miscellaneous cleanups and improvements Tarang Raval
2025-03-29 5:43 ` [PATCH v2 1/9] media: i2c: imx334: Simplify with dev_err_probe() Tarang Raval
2025-03-29 5:43 ` [PATCH v2 2/9] media: i2c: imx334: Convert to CCI register access helpers Tarang Raval
2025-03-29 5:43 ` [PATCH v2 3/9] media: i2c: imx334: Remove redundant register entries Tarang Raval
2025-03-29 5:43 ` [PATCH v2 4/9] media: i2c: imx334: Configure lane mode Dynamically Tarang Raval
2025-03-29 5:43 ` [PATCH v2 5/9] media: i2c: imx334: Fix power management and control handling Tarang Raval
2025-03-29 5:43 ` Tarang Raval [this message]
2025-03-29 5:43 ` [PATCH v2 7/9] media: i2c: imx334: Enable runtime PM before sub-device registration Tarang Raval
2025-03-29 5:43 ` [PATCH v2 8/9] media: i2c: imx334: Use subdev state lock for synchronization Tarang Raval
2025-03-29 5:43 ` [PATCH v2 9/9] media: i2c: imx334: switch to {enable,disable}_streams Tarang Raval
2025-04-15 9:23 ` [PATCH v2 0/9] media: i2c: imx334: Miscellaneous cleanups and improvements Tarang Raval
2025-04-25 5:54 ` sakari.ailus
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=20250329054335.19931-7-tarang.raval@siliconsignals.io \
--to=tarang.raval@siliconsignals.io \
--cc=Shravan.Chippa@microchip.com \
--cc=benjamin.mugnier@foss.st.com \
--cc=git@apitzsch.eu \
--cc=git@luigi311.com \
--cc=hverkuil@xs4all.nl \
--cc=julien.massot@collabora.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=umang.jain@ideasonboard.com \
--cc=zhi.mao@mediatek.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
all inboxes | Powered by JetHome®