From: Michael Riesch <michael.riesch@collabora.com>
To: Elgin Perumbilly <elgin.perumbilly@siliconsignals.io>,
sakari.ailus@linux.intel.com
Cc: tarang.raval@siliconsignals.io,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: i2c: imx415: Drop redundant runtime PM callbacks
Date: Tue, 24 Mar 2026 20:42:31 +0100 [thread overview]
Message-ID: <1378ed13-6744-422a-b0b8-02621117238f@collabora.com> (raw)
In-Reply-To: <20260324124524.135278-1-elgin.perumbilly@siliconsignals.io>
Hi Elgin,
Thanks for the patch but...
On 3/24/26 13:45, Elgin Perumbilly wrote:
> Replace runtime_suspend/resume wrappers by using power helpers
> directly with DEFINE_RUNTIME_DEV_PM_OPS().
...why? What advantage does this refactoring bring?
Best regards,
Michael
>
> Signed-off-by: Elgin Perumbilly <elgin.perumbilly@siliconsignals.io>
> ---
> drivers/media/i2c/imx415.c | 44 +++++++++++++++-----------------------
> 1 file changed, 17 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/media/i2c/imx415.c b/drivers/media/i2c/imx415.c
> index 0b424c17e880..b7d44f3e165b 100644
> --- a/drivers/media/i2c/imx415.c
> +++ b/drivers/media/i2c/imx415.c
> @@ -1129,8 +1129,12 @@ static void imx415_subdev_cleanup(struct imx415 *sensor)
> v4l2_ctrl_handler_free(&sensor->ctrls);
> }
>
> -static int imx415_power_on(struct imx415 *sensor)
> +static int imx415_power_on(struct device *dev)
> {
> + struct i2c_client *client = to_i2c_client(dev);
> + struct v4l2_subdev *subdev = i2c_get_clientdata(client);
> + struct imx415 *sensor = to_imx415(subdev);
> +
> int ret;
>
> ret = regulator_bulk_enable(ARRAY_SIZE(sensor->supplies),
> @@ -1161,11 +1165,17 @@ static int imx415_power_on(struct imx415 *sensor)
> return ret;
> }
>
> -static void imx415_power_off(struct imx415 *sensor)
> +static int imx415_power_off(struct device *dev)
> {
> + struct i2c_client *client = to_i2c_client(dev);
> + struct v4l2_subdev *subdev = i2c_get_clientdata(client);
> + struct imx415 *sensor = to_imx415(subdev);
> +
> clk_disable_unprepare(sensor->clk);
> gpiod_set_value_cansleep(sensor->reset, 1);
> regulator_bulk_disable(ARRAY_SIZE(sensor->supplies), sensor->supplies);
> +
> + return 0;
> }
>
> static int imx415_identify_model(struct imx415 *sensor)
> @@ -1371,7 +1381,7 @@ static int imx415_probe(struct i2c_client *client)
> * work when runtime PM is disabled in the kernel. To that end, power
> * the sensor on manually here, identify it, and fully initialize it.
> */
> - ret = imx415_power_on(sensor);
> + ret = imx415_power_on(sensor->dev);
> if (ret)
> return ret;
>
> @@ -1411,7 +1421,7 @@ static int imx415_probe(struct i2c_client *client)
> pm_runtime_put_noidle(sensor->dev);
> imx415_subdev_cleanup(sensor);
> err_power:
> - imx415_power_off(sensor);
> + imx415_power_off(sensor->dev);
> return ret;
> }
>
> @@ -1430,32 +1440,12 @@ static void imx415_remove(struct i2c_client *client)
> */
> pm_runtime_disable(sensor->dev);
> if (!pm_runtime_status_suspended(sensor->dev))
> - imx415_power_off(sensor);
> + imx415_power_off(sensor->dev);
> pm_runtime_set_suspended(sensor->dev);
> }
>
> -static int imx415_runtime_resume(struct device *dev)
> -{
> - struct i2c_client *client = to_i2c_client(dev);
> - struct v4l2_subdev *subdev = i2c_get_clientdata(client);
> - struct imx415 *sensor = to_imx415(subdev);
> -
> - return imx415_power_on(sensor);
> -}
> -
> -static int imx415_runtime_suspend(struct device *dev)
> -{
> - struct i2c_client *client = to_i2c_client(dev);
> - struct v4l2_subdev *subdev = i2c_get_clientdata(client);
> - struct imx415 *sensor = to_imx415(subdev);
> -
> - imx415_power_off(sensor);
> -
> - return 0;
> -}
> -
> -static DEFINE_RUNTIME_DEV_PM_OPS(imx415_pm_ops, imx415_runtime_suspend,
> - imx415_runtime_resume, NULL);
> +static DEFINE_RUNTIME_DEV_PM_OPS(imx415_pm_ops, imx415_power_off,
> + imx415_power_on, NULL);
>
> static const struct of_device_id imx415_of_match[] = {
> { .compatible = "sony,imx415" },
> --
> 2.34.1
>
next prev parent reply other threads:[~2026-03-24 19:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 12:45 Elgin Perumbilly
2026-03-24 19:42 ` Michael Riesch [this message]
2026-03-25 12:28 ` Sakari Ailus
2026-03-25 19:36 ` Michael Riesch
2026-03-28 6:11 ` Elgin Perumbilly
2026-03-28 13:53 ` Sakari Ailus
2026-03-30 9:11 ` Elgin Perumbilly
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=1378ed13-6744-422a-b0b8-02621117238f@collabora.com \
--to=michael.riesch@collabora.com \
--cc=elgin.perumbilly@siliconsignals.io \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=tarang.raval@siliconsignals.io \
/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®