Skip to content

Commit 271ff96

Browse files
Sakari Ailusrafaeljw
authored andcommitted
PM: runtime: Document return values of suspend-related API functions
Document return values for device suspend and idle related API functions. Signed-off-by: Sakari Ailus <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent e04c78d commit 271ff96

File tree

1 file changed

+138
-9
lines changed

1 file changed

+138
-9
lines changed

include/linux/pm_runtime.h

Lines changed: 138 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,20 @@ static inline void pm_runtime_release_supplier(struct device_link *link) {}
337337
* Invoke the "idle check" callback of @dev and, depending on its return value,
338338
* set up autosuspend of @dev or suspend it (depending on whether or not
339339
* autosuspend has been enabled for it).
340+
*
341+
* Return:
342+
* * 0: Success.
343+
* * -EINVAL: Runtime PM error.
344+
* * -EACCES: Runtime PM disabled.
345+
* * -EAGAIN: Runtime PM usage_count non-zero, Runtime PM status change ongoing
346+
* or device not in %RPM_ACTIVE state.
347+
* * -EBUSY: Runtime PM child_count non-zero.
348+
* * -EPERM: Device PM QoS resume latency 0.
349+
* * -EINPROGRESS: Suspend already in progress.
350+
* * -ENOSYS: CONFIG_PM not enabled.
351+
* * 1: Device already suspended.
352+
* Other values and conditions for the above values are possible as returned by
353+
* Runtime PM idle and suspend callbacks.
340354
*/
341355
static inline int pm_runtime_idle(struct device *dev)
342356
{
@@ -346,6 +360,18 @@ static inline int pm_runtime_idle(struct device *dev)
346360
/**
347361
* pm_runtime_suspend - Suspend a device synchronously.
348362
* @dev: Target device.
363+
*
364+
* Return:
365+
* * 0: Success.
366+
* * -EINVAL: Runtime PM error.
367+
* * -EACCES: Runtime PM disabled.
368+
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
369+
* * -EBUSY: Runtime PM child_count non-zero.
370+
* * -EPERM: Device PM QoS resume latency 0.
371+
* * -ENOSYS: CONFIG_PM not enabled.
372+
* * 1: Device already suspended.
373+
* Other values and conditions for the above values are possible as returned by
374+
* Runtime PM suspend callbacks.
349375
*/
350376
static inline int pm_runtime_suspend(struct device *dev)
351377
{
@@ -358,6 +384,18 @@ static inline int pm_runtime_suspend(struct device *dev)
358384
*
359385
* Set up autosuspend of @dev or suspend it (depending on whether or not
360386
* autosuspend is enabled for it) without engaging its "idle check" callback.
387+
*
388+
* Return:
389+
* * 0: Success.
390+
* * -EINVAL: Runtime PM error.
391+
* * -EACCES: Runtime PM disabled.
392+
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
393+
* * -EBUSY: Runtime PM child_count non-zero.
394+
* * -EPERM: Device PM QoS resume latency 0.
395+
* * -ENOSYS: CONFIG_PM not enabled.
396+
* * 1: Device already suspended.
397+
* Other values and conditions for the above values are possible as returned by
398+
* Runtime PM suspend callbacks.
361399
*/
362400
static inline int pm_runtime_autosuspend(struct device *dev)
363401
{
@@ -379,6 +417,18 @@ static inline int pm_runtime_resume(struct device *dev)
379417
*
380418
* Queue up a work item to run an equivalent of pm_runtime_idle() for @dev
381419
* asynchronously.
420+
*
421+
* Return:
422+
* * 0: Success.
423+
* * -EINVAL: Runtime PM error.
424+
* * -EACCES: Runtime PM disabled.
425+
* * -EAGAIN: Runtime PM usage_count non-zero, Runtime PM status change ongoing
426+
* or device not in %RPM_ACTIVE state.
427+
* * -EBUSY: Runtime PM child_count non-zero.
428+
* * -EPERM: Device PM QoS resume latency 0.
429+
* * -EINPROGRESS: Suspend already in progress.
430+
* * -ENOSYS: CONFIG_PM not enabled.
431+
* * 1: Device already suspended.
382432
*/
383433
static inline int pm_request_idle(struct device *dev)
384434
{
@@ -400,6 +450,17 @@ static inline int pm_request_resume(struct device *dev)
400450
*
401451
* Queue up a work item to run an equivalent pm_runtime_autosuspend() for @dev
402452
* asynchronously.
453+
*
454+
* Return:
455+
* * 0: Success.
456+
* * -EINVAL: Runtime PM error.
457+
* * -EACCES: Runtime PM disabled.
458+
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
459+
* * -EBUSY: Runtime PM child_count non-zero.
460+
* * -EPERM: Device PM QoS resume latency 0.
461+
* * -EINPROGRESS: Suspend already in progress.
462+
* * -ENOSYS: CONFIG_PM not enabled.
463+
* * 1: Device already suspended.
403464
*/
404465
static inline int pm_request_autosuspend(struct device *dev)
405466
{
@@ -464,6 +525,17 @@ static inline int pm_runtime_resume_and_get(struct device *dev)
464525
*
465526
* Decrement the runtime PM usage counter of @dev and if it turns out to be
466527
* equal to 0, queue up a work item for @dev like in pm_request_idle().
528+
*
529+
* Return:
530+
* * 0: Success.
531+
* * -EINVAL: Runtime PM error.
532+
* * -EACCES: Runtime PM disabled.
533+
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
534+
* * -EBUSY: Runtime PM child_count non-zero.
535+
* * -EPERM: Device PM QoS resume latency 0.
536+
* * -EINPROGRESS: Suspend already in progress.
537+
* * -ENOSYS: CONFIG_PM not enabled.
538+
* * 1: Device already suspended.
467539
*/
468540
static inline int pm_runtime_put(struct device *dev)
469541
{
@@ -478,6 +550,17 @@ DEFINE_FREE(pm_runtime_put, struct device *, if (_T) pm_runtime_put(_T))
478550
*
479551
* Decrement the runtime PM usage counter of @dev and if it turns out to be
480552
* equal to 0, queue up a work item for @dev like in pm_request_autosuspend().
553+
*
554+
* Return:
555+
* * 0: Success.
556+
* * -EINVAL: Runtime PM error.
557+
* * -EACCES: Runtime PM disabled.
558+
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
559+
* * -EBUSY: Runtime PM child_count non-zero.
560+
* * -EPERM: Device PM QoS resume latency 0.
561+
* * -EINPROGRESS: Suspend already in progress.
562+
* * -ENOSYS: CONFIG_PM not enabled.
563+
* * 1: Device already suspended.
481564
*/
482565
static inline int __pm_runtime_put_autosuspend(struct device *dev)
483566
{
@@ -490,6 +573,17 @@ static inline int __pm_runtime_put_autosuspend(struct device *dev)
490573
*
491574
* Decrement the runtime PM usage counter of @dev and if it turns out to be
492575
* equal to 0, queue up a work item for @dev like in pm_request_autosuspend().
576+
*
577+
* Return:
578+
* * 0: Success.
579+
* * -EINVAL: Runtime PM error.
580+
* * -EACCES: Runtime PM disabled.
581+
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
582+
* * -EBUSY: Runtime PM child_count non-zero.
583+
* * -EPERM: Device PM QoS resume latency 0.
584+
* * -EINPROGRESS: Suspend already in progress.
585+
* * -ENOSYS: CONFIG_PM not enabled.
586+
* * 1: Device already suspended.
493587
*/
494588
static inline int pm_runtime_put_autosuspend(struct device *dev)
495589
{
@@ -506,9 +600,20 @@ static inline int pm_runtime_put_autosuspend(struct device *dev)
506600
* return value, set up autosuspend of @dev or suspend it (depending on whether
507601
* or not autosuspend has been enabled for it).
508602
*
509-
* The possible return values of this function are the same as for
510-
* pm_runtime_idle() and the runtime PM usage counter of @dev remains
511-
* decremented in all cases, even if it returns an error code.
603+
* The runtime PM usage counter of @dev remains decremented in all cases, even
604+
* if it returns an error code.
605+
*
606+
* Return:
607+
* * 0: Success.
608+
* * -EINVAL: Runtime PM error.
609+
* * -EACCES: Runtime PM disabled.
610+
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
611+
* * -EBUSY: Runtime PM child_count non-zero.
612+
* * -EPERM: Device PM QoS resume latency 0.
613+
* * -ENOSYS: CONFIG_PM not enabled.
614+
* * 1: Device already suspended.
615+
* Other values and conditions for the above values are possible as returned by
616+
* Runtime PM suspend callbacks.
512617
*/
513618
static inline int pm_runtime_put_sync(struct device *dev)
514619
{
@@ -522,9 +627,21 @@ static inline int pm_runtime_put_sync(struct device *dev)
522627
* Decrement the runtime PM usage counter of @dev and if it turns out to be
523628
* equal to 0, carry out runtime-suspend of @dev synchronously.
524629
*
525-
* The possible return values of this function are the same as for
526-
* pm_runtime_suspend() and the runtime PM usage counter of @dev remains
527-
* decremented in all cases, even if it returns an error code.
630+
* The runtime PM usage counter of @dev remains decremented in all cases, even
631+
* if it returns an error code.
632+
*
633+
* Return:
634+
* * 0: Success.
635+
* * -EINVAL: Runtime PM error.
636+
* * -EACCES: Runtime PM disabled.
637+
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
638+
* * -EAGAIN: usage_count non-zero or Runtime PM status change ongoing.
639+
* * -EBUSY: Runtime PM child_count non-zero.
640+
* * -EPERM: Device PM QoS resume latency 0.
641+
* * -ENOSYS: CONFIG_PM not enabled.
642+
* * 1: Device already suspended.
643+
* Other values and conditions for the above values are possible as returned by
644+
* Runtime PM suspend callbacks.
528645
*/
529646
static inline int pm_runtime_put_sync_suspend(struct device *dev)
530647
{
@@ -539,9 +656,21 @@ static inline int pm_runtime_put_sync_suspend(struct device *dev)
539656
* equal to 0, set up autosuspend of @dev or suspend it synchronously (depending
540657
* on whether or not autosuspend has been enabled for it).
541658
*
542-
* The possible return values of this function are the same as for
543-
* pm_runtime_autosuspend() and the runtime PM usage counter of @dev remains
544-
* decremented in all cases, even if it returns an error code.
659+
* The runtime PM usage counter of @dev remains decremented in all cases, even
660+
* if it returns an error code.
661+
*
662+
* Return:
663+
* * 0: Success.
664+
* * -EINVAL: Runtime PM error.
665+
* * -EACCES: Runtime PM disabled.
666+
* * -EAGAIN: Runtime PM usage_count non-zero or Runtime PM status change ongoing.
667+
* * -EBUSY: Runtime PM child_count non-zero.
668+
* * -EPERM: Device PM QoS resume latency 0.
669+
* * -EINPROGRESS: Suspend already in progress.
670+
* * -ENOSYS: CONFIG_PM not enabled.
671+
* * 1: Device already suspended.
672+
* Other values and conditions for the above values are possible as returned by
673+
* Runtime PM suspend callbacks.
545674
*/
546675
static inline int pm_runtime_put_sync_autosuspend(struct device *dev)
547676
{

0 commit comments

Comments
 (0)