Re: [PATCH 6/6] media: i2c: imx334: Enable runtime PM before sub-device registration
From: Tarang Raval
Date: Thu Mar 27 2025 - 07:03:09 EST
Hi Sakari,
Thanks for the review.
> 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@xxxxxxxxxxxxxxxxx>
> > ---
> > 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.
Oh, I missed that.
> 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?
Should I include these changes in this patch, or should I create a separate
patch for them.
Best Regards,
Tarang
> > pm_runtime_idle(imx334->dev);
> >
> > return 0;
>
> --
> Regards,
>
> Sakari Ailus