Re: [PATCH v2 2/5] media: i2c: ov5645: Use runtime PM
From: Lad, Prabhakar
Date: Thu Oct 27 2022 - 08:02:25 EST
Hi Sakari,
On Thu, Oct 27, 2022 at 12:20 PM Sakari Ailus
<sakari.ailus@xxxxxxxxxxxxxxx> wrote:
>
> Hi Prabhakar,
>
> One more comment.
>
> On Fri, Oct 14, 2022 at 07:34:56PM +0100, Prabhakar wrote:
> > @@ -1209,12 +1190,16 @@ static int ov5645_probe(struct i2c_client *client)
> >
> > dev_info(dev, "OV5645 detected at address 0x%02x\n", client->addr);
> >
> > + pm_runtime_set_active(dev);
> > + pm_runtime_get_noresume(dev);
> > + pm_runtime_enable(dev);
>
> You won't gain anything by eanbling runtime PM here. Just move it to the
> end of the function before the rest of the calls. Error handling becomes
> more simple.
>
If I move the above calls below I get the below warning:
[ 2.633386] ov5645 0-003c: Runtime PM usage count underflow!
This is because of the last patch which moves ov5645_entity_init_cfg()
before registering the subdev. ov5645_entity_init_cfg() calls s_ctrl
due to which we are seeing the above message. Please let me know how
to proceed on this.
Cheers,
Prabhakar