diff mbox series

[6/7] pm: runtime: Mark last busy stamp in pm_request_autosuspend()

Message ID 20250410153106.4146265-7-sakari.ailus@linux.intel.com (mailing list archive)
State New
Headers show
Series Update last busy timestamp in Runtime PM autosuspend callbacks | expand

Commit Message

Sakari Ailus April 10, 2025, 3:31 p.m. UTC
Set device's last busy timestamp to current time in
pm_request_autosuspend().

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 Documentation/power/runtime_pm.rst | 6 +++---
 include/linux/pm_runtime.h         | 8 +++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

Comments

Laurent Pinchart April 10, 2025, 8:28 p.m. UTC | #1
Hi Sakari,

Thank you for the patch.

On Thu, Apr 10, 2025 at 06:31:05PM +0300, Sakari Ailus wrote:
> Set device's last busy timestamp to current time in
> pm_request_autosuspend().
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>

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

> ---
>  Documentation/power/runtime_pm.rst | 6 +++---
>  include/linux/pm_runtime.h         | 8 +++++---
>  2 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/power/runtime_pm.rst b/Documentation/power/runtime_pm.rst
> index 39a0b62f6648..91bc93422262 100644
> --- a/Documentation/power/runtime_pm.rst
> +++ b/Documentation/power/runtime_pm.rst
> @@ -354,9 +354,9 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
>        success or error code if the request has not been queued up
>  
>    `int pm_request_autosuspend(struct device *dev);`
> -    - schedule the execution of the subsystem-level suspend callback for the
> -      device when the autosuspend delay has expired; if the delay has already
> -      expired then the work item is queued up immediately
> +    - Call pm_runtime_mark_last_busy() and schedule the execution of the
> +      subsystem-level suspend callback for the device when the autosuspend delay
> +      expires
>  
>    `int pm_schedule_suspend(struct device *dev, unsigned int delay);`
>      - schedule the execution of the subsystem-level suspend callback for the
> diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
> index 3d12cfb0bf00..61ca98cd0aa2 100644
> --- a/include/linux/pm_runtime.h
> +++ b/include/linux/pm_runtime.h
> @@ -444,11 +444,12 @@ static inline int pm_request_resume(struct device *dev)
>  }
>  
>  /**
> - * pm_request_autosuspend - Queue up autosuspend of a device.
> + * pm_request_autosuspend - Update the last access time and queue up autosuspend
> + * of a device.
>   * @dev: Target device.
>   *
> - * Queue up a work item to run an equivalent pm_runtime_autosuspend() for @dev
> - * asynchronously.
> + * Update the last access time of a device and queue up a work item to run an
> + * equivalent pm_runtime_autosuspend() for @dev asynchronously.
>   *
>   * Return:
>   * * 0: Success.
> @@ -463,6 +464,7 @@ static inline int pm_request_resume(struct device *dev)
>   */
>  static inline int pm_request_autosuspend(struct device *dev)
>  {
> +	pm_runtime_mark_last_busy(dev);
>  	return __pm_runtime_suspend(dev, RPM_ASYNC | RPM_AUTO);
>  }
>
diff mbox series

Patch

diff --git a/Documentation/power/runtime_pm.rst b/Documentation/power/runtime_pm.rst
index 39a0b62f6648..91bc93422262 100644
--- a/Documentation/power/runtime_pm.rst
+++ b/Documentation/power/runtime_pm.rst
@@ -354,9 +354,9 @@  drivers/base/power/runtime.c and include/linux/pm_runtime.h:
       success or error code if the request has not been queued up
 
   `int pm_request_autosuspend(struct device *dev);`
-    - schedule the execution of the subsystem-level suspend callback for the
-      device when the autosuspend delay has expired; if the delay has already
-      expired then the work item is queued up immediately
+    - Call pm_runtime_mark_last_busy() and schedule the execution of the
+      subsystem-level suspend callback for the device when the autosuspend delay
+      expires
 
   `int pm_schedule_suspend(struct device *dev, unsigned int delay);`
     - schedule the execution of the subsystem-level suspend callback for the
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 3d12cfb0bf00..61ca98cd0aa2 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -444,11 +444,12 @@  static inline int pm_request_resume(struct device *dev)
 }
 
 /**
- * pm_request_autosuspend - Queue up autosuspend of a device.
+ * pm_request_autosuspend - Update the last access time and queue up autosuspend
+ * of a device.
  * @dev: Target device.
  *
- * Queue up a work item to run an equivalent pm_runtime_autosuspend() for @dev
- * asynchronously.
+ * Update the last access time of a device and queue up a work item to run an
+ * equivalent pm_runtime_autosuspend() for @dev asynchronously.
  *
  * Return:
  * * 0: Success.
@@ -463,6 +464,7 @@  static inline int pm_request_resume(struct device *dev)
  */
 static inline int pm_request_autosuspend(struct device *dev)
 {
+	pm_runtime_mark_last_busy(dev);
 	return __pm_runtime_suspend(dev, RPM_ASYNC | RPM_AUTO);
 }