From: Brian Norris <briannorris@chromium.org>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-pm@vger.kernel.org, "Rafael J. Wysocki" <rafael@kernel.org>,
Len Brown <len.brown@intel.com>, Pavel Machek <pavel@kernel.org>,
Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Subject: Re: [PATCH v2 1/6] pm: runtime: Document return values of suspend related API functions
Date: Thu, 14 Aug 2025 15:56:16 -0700 [thread overview]
Message-ID: <aJ5pkEJuixTaybV4@google.com> (raw)
In-Reply-To: <20250616061212.2286741-2-sakari.ailus@linux.intel.com>
Hi,
On Mon, Jun 16, 2025 at 09:12:07AM +0300, Sakari Ailus wrote:
> Document return values for device suspend and idle related API functions.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
I appreciate the documentation attempt here. I've often found it a maze
trying to weave through the indirection and figure out the actual API
contract for some of these.
But I have a few questions below:
> ---
> include/linux/pm_runtime.h | 147 ++++++++++++++++++++++++++++++++++---
> 1 file changed, 138 insertions(+), 9 deletions(-)
>
> diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
> index e7cb70fcc0af..9dd2e4031a27 100644
> --- a/include/linux/pm_runtime.h
> +++ b/include/linux/pm_runtime.h
> @@ -464,6 +525,17 @@ static inline int pm_runtime_resume_and_get(struct device *dev)
> *
> * Decrement the runtime PM usage counter of @dev and if it turns out to be
> * equal to 0, queue up a work item for @dev like in pm_request_idle().
> + *
> + * Return:
> + * * 0: Success.
> + * * -EINVAL: Runtime PM error.
> + * * -EACCES: Runtime PM disabled.
> + * * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
^^ Is the "usage_count non-zero" true? For RPM_GET_PUT, we drop the
refcount, and if it's still nonzero, we simply return 0.
> + * * -EBUSY: Runtime PM child_count non-zero.
> + * * -EPERM: Device PM QoS resume latency 0.
> + * * -EINPROGRESS: Suspend already in progress.
> + * * -ENOSYS: CONFIG_PM not enabled.
> + * * 1: Device already suspended.
This part isn't very clear to me: can we even hit this case? If the
usage count was already 0, we'd hit EINVAL, since this is a PUT
operation. If the usage count was non-zero, we can't already be
suspended. At a minimum, we'd be RESUMING (e.g., an async resume), no?
> */
> static inline int pm_runtime_put(struct device *dev)
> {
If these are indeed errors, I expect they're repeated on some of the
other related APIs too (like pm_runtime_put_sync(), pm_runtime_idle(),
and probably more).
I ask mostly for my own understanding, but I might consider patching the
docs if I'm not hallucinating these errors.
Brian
next prev parent reply other threads:[~2025-08-14 22:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-16 6:12 [PATCH v2 0/6] Update last busy timestamp in Runtime PM autosuspend callbacks Sakari Ailus
2025-06-16 6:12 ` [PATCH v2 1/6] pm: runtime: Document return values of suspend related API functions Sakari Ailus
2025-08-14 22:56 ` Brian Norris [this message]
2025-08-29 0:46 ` Brian Norris
2025-08-29 10:23 ` Sakari Ailus
2025-06-16 6:12 ` [PATCH v2 2/6] pm: runtime: Mark last busy stamp in pm_runtime_put_autosuspend() Sakari Ailus
2025-06-16 6:12 ` [PATCH v2 3/6] pm: runtime: Mark last busy stamp in pm_runtime_put_sync_autosuspend() Sakari Ailus
2025-06-16 6:12 ` [PATCH v2 4/6] pm: runtime: Mark last busy stamp in pm_runtime_autosuspend() Sakari Ailus
2025-06-16 6:12 ` [PATCH v2 5/6] pm: runtime: Mark last busy stamp in pm_request_autosuspend() Sakari Ailus
2025-06-16 6:12 ` [PATCH v2 6/6] Documentation: PM: *_autosuspend() functions update last busy time Sakari Ailus
2025-06-16 11:21 ` [PATCH v2 0/6] Update last busy timestamp in Runtime PM autosuspend callbacks Rafael J. Wysocki
2025-06-16 19:20 ` Sakari Ailus
2025-06-16 20:10 ` Laurent Pinchart
2025-06-18 19:43 ` Rafael J. Wysocki
2025-06-25 9:15 ` Sakari Ailus
2025-06-23 13:28 ` Oliver Neukum
2025-06-25 6:59 ` 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=aJ5pkEJuixTaybV4@google.com \
--to=briannorris@chromium.org \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=len.brown@intel.com \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=rafael@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.