Skip to content

Commit 08071e6

Browse files
Sakari Ailusrafaeljw
authored andcommitted
PM: runtime: Mark last busy stamp in pm_runtime_autosuspend()
Set device's last busy timestamp to current time in pm_runtime_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 e24e063 commit 08071e6

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

Documentation/power/runtime_pm.rst

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,9 @@ suspending the device are satisfied) and to queue up a suspend request for the
154154
device in that case. If there is no idle callback, or if the callback returns
155155
0, then the PM core will attempt to carry out a runtime suspend of the device,
156156
also respecting devices configured for autosuspend. In essence this means a
157-
call to pm_runtime_autosuspend() (do note that drivers needs to update the
158-
device last busy mark, pm_runtime_mark_last_busy(), to control the delay under
159-
this circumstance). To prevent this (for example, if the callback routine has
160-
started a delayed suspend), the routine must return a non-zero value. Negative
161-
error return codes are ignored by the PM core.
157+
call to pm_runtime_autosuspend(). To prevent this (for example, if the callback
158+
routine has started a delayed suspend), the routine must return a non-zero
159+
value. Negative error return codes are ignored by the PM core.
162160

163161
The helper functions provided by the PM core, described in Section 4, guarantee
164162
that the following constraints are met with respect to runtime PM callbacks for
@@ -330,10 +328,9 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
330328
'power.disable_depth' is different from 0
331329

332330
`int pm_runtime_autosuspend(struct device *dev);`
333-
- same as pm_runtime_suspend() except that the autosuspend delay is taken
334-
`into account;` if pm_runtime_autosuspend_expiration() says the delay has
335-
not yet expired then an autosuspend is scheduled for the appropriate time
336-
and 0 is returned
331+
- same as pm_runtime_suspend() except that a call to
332+
pm_runtime_mark_last_busy() is made and an autosuspend is scheduled for
333+
the appropriate time and 0 is returned
337334

338335
`int pm_runtime_resume(struct device *dev);`
339336
- execute the subsystem-level resume callback for the device; returns 0 on

include/linux/pm_runtime.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,13 @@ static inline int pm_runtime_suspend(struct device *dev)
379379
}
380380

381381
/**
382-
* pm_runtime_autosuspend - Set up autosuspend of a device or suspend it.
382+
* pm_runtime_autosuspend - Update the last access time and set up autosuspend
383+
* of a device.
383384
* @dev: Target device.
384385
*
385-
* Set up autosuspend of @dev or suspend it (depending on whether or not
386-
* autosuspend is enabled for it) without engaging its "idle check" callback.
386+
* First update the last access time, then set up autosuspend of @dev or suspend
387+
* it (depending on whether or not autosuspend is enabled for it) without
388+
* engaging its "idle check" callback.
387389
*
388390
* Return:
389391
* * 0: Success.
@@ -399,6 +401,7 @@ static inline int pm_runtime_suspend(struct device *dev)
399401
*/
400402
static inline int pm_runtime_autosuspend(struct device *dev)
401403
{
404+
pm_runtime_mark_last_busy(dev);
402405
return __pm_runtime_suspend(dev, RPM_AUTO);
403406
}
404407

0 commit comments

Comments
 (0)