Linux Media Controller development
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Tarang Raval <tarang.raval@siliconsignals.io>
Cc: kieran.bingham@ideasonboard.com, Shravan.Chippa@microchip.com,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Julien Massot <julien.massot@collabora.com>,
	Zhi Mao <zhi.mao@mediatek.com>,
	Mikhail Rudenko <mike.rudenko@gmail.com>,
	Benjamin Mugnier <benjamin.mugnier@foss.st.com>,
	Luis Garcia <git@luigi311.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/6] media: i2c: imx334: Enable runtime PM before sub-device registration
Date: Thu, 27 Mar 2025 10:06:37 +0000	[thread overview]
Message-ID: <Z-UjLSsATevtLT2k@kekkonen.localdomain> (raw)
In-Reply-To: <20250310071751.151382-7-tarang.raval@siliconsignals.io>

Hi Tarang,

On Mon, Mar 10, 2025 at 12:47:48PM +0530, Tarang Raval wrote:
> Runtime PM is fully initialized before calling
> v4l2_async_register_subdev_sensor(). Moving the runtime PM initialization
> earlier prevents potential access to an uninitialized or powered-down device.
> 
> Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
> ---
>  drivers/media/i2c/imx334.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c
> index ffa39bb317f7..8964d60324e2 100644
> --- a/drivers/media/i2c/imx334.c
> +++ b/drivers/media/i2c/imx334.c
> @@ -1295,6 +1295,9 @@ static int imx334_probe(struct i2c_client *client)
>  		goto error_handler_free;
>  	}
>  
> +	pm_runtime_set_active(imx334->dev);
> +	pm_runtime_enable(imx334->dev);
> +
>  	ret = v4l2_async_register_subdev_sensor(&imx334->sd);
>  	if (ret < 0) {
>  		dev_err(imx334->dev,
> @@ -1302,8 +1305,6 @@ static int imx334_probe(struct i2c_client *client)
>  		goto error_media_entity;
>  	}
>  
> -	pm_runtime_set_active(imx334->dev);
> -	pm_runtime_enable(imx334->dev);

Please also change error handling accordingly.

Btw. the remove function calls pm_runtime_suspended() that does nothing
(use pm_runtime_set_suspended() instead). Could you add a patch to fix it?

>  	pm_runtime_idle(imx334->dev);
>  
>  	return 0;

-- 
Regards,

Sakari Ailus

  reply	other threads:[~2025-03-27 10:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-10  7:17 [PATCH 0/6] media: i2c: imx334: Miscellaneous cleanups and improvements Tarang Raval
2025-03-10  7:17 ` [PATCH 1/6] media: i2c: imx334: Simplify with dev_err_probe() Tarang Raval
2025-03-10  7:17 ` [PATCH 2/6] media: i2c: imx334: Convert to CCI register access helpers Tarang Raval
2025-03-11  6:14   ` Shravan.Chippa
2025-03-11  6:38     ` Laurent Pinchart
2025-03-11  6:51       ` Shravan.Chippa
2025-03-11  9:46         ` Sakari Ailus
2025-03-11  9:59           ` Shravan.Chippa
2025-03-11 10:05           ` Tarang Raval
2025-03-11 10:13             ` Sakari Ailus
2025-03-10  7:17 ` [PATCH 3/6] media: i2c: imx334: Remove redundant register entries Tarang Raval
2025-03-10  7:17 ` [PATCH 4/6] media: i2c: imx334: Support 4 or 8 lane operation modes Tarang Raval
2025-03-27 10:09   ` Sakari Ailus
2025-03-27 10:54     ` Tarang Raval
2025-03-27 14:32       ` Dave Stevenson
2025-03-27 15:38         ` Tarang Raval
2025-03-10  7:17 ` [PATCH 5/6] media: i2c: imx334: Fix power management and control handling Tarang Raval
2025-03-10  7:17 ` [PATCH 6/6] media: i2c: imx334: Enable runtime PM before sub-device registration Tarang Raval
2025-03-27 10:06   ` Sakari Ailus [this message]
2025-03-27 11:02     ` Tarang Raval
2025-03-27 11:14       ` 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=Z-UjLSsATevtLT2k@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=Shravan.Chippa@microchip.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=benjamin.mugnier@foss.st.com \
    --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=mike.rudenko@gmail.com \
    --cc=tarang.raval@siliconsignals.io \
    --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