Linux Media Controller development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH 1/1] media: Documentation: Use right function to test device power state
Date: Tue, 5 May 2026 16:02:58 +0300	[thread overview]
Message-ID: <20260505130258.GA1601351@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20260326104611.1586131-1-sakari.ailus@linux.intel.com>

Hi Sakari,

Thank you for the patch.

On Thu, Mar 26, 2026 at 12:46:11PM +0200, Sakari Ailus wrote:
> Tell driver authors to use pm_runtime_get_if_active() instead of
> pm_runtime_get_if_in_use() to check the device's power state in the s_ctrl
> callback. pm_runtime_get_if_active() is the right function to use here
> since it returns non-zero if the device is powered on rather than its
> PM runtime usage_count is non-zero.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  Documentation/driver-api/media/camera-sensor.rst | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/driver-api/media/camera-sensor.rst b/Documentation/driver-api/media/camera-sensor.rst
> index 94bd1dae82d5..c8552f70f496 100644
> --- a/Documentation/driver-api/media/camera-sensor.rst
> +++ b/Documentation/driver-api/media/camera-sensor.rst
> @@ -114,7 +114,7 @@ of the device. This is because the power state of the device is only changed
>  after the power state transition has taken place. The ``s_ctrl`` callback can be
>  used to obtain device's power state after the power state transition:
>  
> -.. c:function:: int pm_runtime_get_if_in_use(struct device *dev);
> +.. c:function:: int pm_runtime_get_if_active(struct device *dev);

This looks fine, but I think we should also mass-convert drivers. There
are more drivers using pm_runtime_get_if_in_use() than
pm_runtime_get_if_active(), so we'll keep seeing new code using the
former due to cargo cult.

For this patch,

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Should I submit a series to mass-convert drivers, or will you do it ?

>  
>  The function returns a non-zero value if it succeeded getting the power count or
>  runtime PM was disabled, in either of which cases the driver may proceed to

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2026-05-05 13:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26 10:46 [PATCH 1/1] media: Documentation: Use right function to test device power state Sakari Ailus
2026-05-05 13:02 ` Laurent Pinchart [this message]
2026-05-05 19:32   ` 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=20260505130258.GA1601351@killaraus.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.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