Skip to content

Commit e24e063

Browse files
Sakari Ailusrafaeljw
authored andcommitted
PM: runtime: Mark last busy stamp in pm_runtime_put_sync_autosuspend()
Set device's last busy timestamp to current time in pm_runtime_put_sync_autosuspend(). Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent b3db492 commit e24e063

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Documentation/power/runtime_pm.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,8 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
428428
pm_runtime_suspend(dev) and return its result
429429

430430
`int pm_runtime_put_sync_autosuspend(struct device *dev);`
431-
- decrement the device's usage counter; if the result is 0 then run
431+
- set the power.last_busy field to the current time and decrement the
432+
device's usage counter; if the result is 0 then run
432433
pm_runtime_autosuspend(dev) and return its result
433434

434435
`void pm_runtime_enable(struct device *dev);`

include/linux/pm_runtime.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -651,12 +651,14 @@ static inline int pm_runtime_put_sync_suspend(struct device *dev)
651651
}
652652

653653
/**
654-
* pm_runtime_put_sync_autosuspend - Drop device usage counter and autosuspend if 0.
654+
* pm_runtime_put_sync_autosuspend - Update the last access time of a device,
655+
* drop device usage counter and autosuspend if 0.
655656
* @dev: Target device.
656657
*
657-
* Decrement the runtime PM usage counter of @dev and if it turns out to be
658-
* equal to 0, set up autosuspend of @dev or suspend it synchronously (depending
659-
* on whether or not autosuspend has been enabled for it).
658+
* Update the last access time of @dev, decrement the runtime PM usage counter
659+
* of @dev and if it turns out to be equal to 0, set up autosuspend of @dev or
660+
* suspend it synchronously (depending on whether or not autosuspend has been
661+
* enabled for it).
660662
*
661663
* The runtime PM usage counter of @dev remains decremented in all cases, even
662664
* if it returns an error code.
@@ -676,6 +678,7 @@ static inline int pm_runtime_put_sync_suspend(struct device *dev)
676678
*/
677679
static inline int pm_runtime_put_sync_autosuspend(struct device *dev)
678680
{
681+
pm_runtime_mark_last_busy(dev);
679682
return __pm_runtime_suspend(dev, RPM_GET_PUT | RPM_AUTO);
680683
}
681684

0 commit comments

Comments
 (0)