public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
	Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org,
	Biju Das <biju.das.jz@bp.renesas.com>,
	Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH v2 03/11] media: i2c: ov5645: Enable runtime PM after v4l2_async_register_subdev()
Date: Wed, 25 Sep 2024 01:37:40 +0300	[thread overview]
Message-ID: <20240924223740.GL7165@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20240910170610.226189-4-prabhakar.mahadev-lad.rj@bp.renesas.com>

Hi Prabhakar,

Thank you for the patch.

On Tue, Sep 10, 2024 at 06:06:02PM +0100, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> To simplify the probe error path, enable runtime PM after the
> v4l2_async_register_subdev() call.
> 
> This change ensures that runtime PM is only enabled once the subdevice
> registration is successful, avoiding unnecessary cleanup in the error
> path.

The subdev could start being used as soon as it gets registered, so
runtime PM initialization should happen before
v4l2_async_register_subdev().

> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
>  drivers/media/i2c/ov5645.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
> index ab3a419df2df..78b86438c798 100644
> --- a/drivers/media/i2c/ov5645.c
> +++ b/drivers/media/i2c/ov5645.c
> @@ -1239,18 +1239,17 @@ static int ov5645_probe(struct i2c_client *client)
>  		goto power_down;
>  	}
>  
> -	pm_runtime_set_active(dev);
> -	pm_runtime_get_noresume(dev);
> -	pm_runtime_enable(dev);
> -
>  	ov5645_init_state(&ov5645->sd, NULL);
>  
>  	ret = v4l2_async_register_subdev(&ov5645->sd);
>  	if (ret < 0) {
>  		dev_err(dev, "could not register v4l2 device\n");
> -		goto err_pm_runtime;
> +		goto power_down;
>  	}
>  
> +	pm_runtime_set_active(dev);
> +	pm_runtime_get_noresume(dev);
> +	pm_runtime_enable(dev);
>  	pm_runtime_set_autosuspend_delay(dev, 1000);
>  	pm_runtime_use_autosuspend(dev);
>  	pm_runtime_mark_last_busy(dev);
> @@ -1258,9 +1257,6 @@ static int ov5645_probe(struct i2c_client *client)
>  
>  	return 0;
>  
> -err_pm_runtime:
> -	pm_runtime_disable(dev);
> -	pm_runtime_put_noidle(dev);
>  power_down:
>  	ov5645_set_power_off(dev);
>  free_entity:

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2024-09-24 22:38 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-10 17:05 [PATCH v2 00/11] media: ov5645: Add support for streams Prabhakar
2024-09-10 17:06 ` [PATCH v2 01/11] media: i2c: ov5645: Add V4L2_SUBDEV_FL_HAS_EVENTS and subscribe hooks Prabhakar
2024-09-24 22:35   ` Laurent Pinchart
2024-09-10 17:06 ` [PATCH v2 02/11] media: i2c: ov5645: Use local `dev` pointer for subdev device assignment Prabhakar
2024-09-24 22:35   ` Laurent Pinchart
2024-09-10 17:06 ` [PATCH v2 03/11] media: i2c: ov5645: Enable runtime PM after v4l2_async_register_subdev() Prabhakar
2024-09-24 22:37   ` Laurent Pinchart [this message]
2024-09-25 15:22     ` Lad, Prabhakar
2024-09-10 17:06 ` [PATCH v2 04/11] media: i2c: ov5645: Use dev_err_probe instead of dev_err Prabhakar
2024-09-24 22:43   ` Laurent Pinchart
2024-09-25 15:24     ` Lad, Prabhakar
2024-09-10 17:06 ` [PATCH v2 05/11] media: i2c: ov5645: Use v4l2_async_register_subdev_sensor() Prabhakar
2024-09-24 22:44   ` Laurent Pinchart
2024-09-25 15:26     ` Lad, Prabhakar
2024-09-10 17:06 ` [PATCH v2 06/11] media: i2c: ov5645: Drop `power_lock` mutex Prabhakar
2024-09-24 22:46   ` Laurent Pinchart
2024-09-25 15:35     ` Lad, Prabhakar
2024-09-10 17:06 ` [PATCH v2 07/11] media: i2c: ov5645: Use subdev active state Prabhakar
2024-09-24 22:51   ` Laurent Pinchart
2024-09-10 17:06 ` [PATCH v2 08/11] media: i2c: ov5645: Switch to {enable,disable}_streams Prabhakar
2024-09-24 22:55   ` Laurent Pinchart
2024-09-10 17:06 ` [PATCH v2 09/11] media: i2c: ov5645: Add internal image sink pad Prabhakar
2024-09-25 16:21   ` Laurent Pinchart
2024-09-26 15:49     ` Sakari Ailus
2024-09-27 15:35       ` Lad, Prabhakar
2024-09-10 17:06 ` [PATCH v2 10/11] media: i2c: ov5645: Report internal routes to userspace Prabhakar
2024-09-10 17:06 ` [PATCH v2 11/11] media: i2c: ov5645: Report streams using frame descriptors Prabhakar
2024-09-25 16:26   ` Laurent Pinchart
2024-09-26 10:16     ` Lad, Prabhakar
2024-09-26 15:45   ` Sakari Ailus
2024-09-26 17:48     ` Laurent Pinchart
2024-09-26 18:57       ` Sakari Ailus
2024-09-27 15:31         ` Lad, Prabhakar
2024-09-27 16:01           ` 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=20240924223740.GL7165@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=prabhakar.csengg@gmail.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tomi.valkeinen@ideasonboard.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