]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
PM: runtime: Mark last busy stamp in pm_runtime_put_sync_autosuspend()
authorSakari Ailus <sakari.ailus@linux.intel.com>
Mon, 16 Jun 2025 06:12:09 +0000 (09:12 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 18 Jun 2025 19:41:08 +0000 (21:41 +0200)
Set device's last busy timestamp to current time in
pm_runtime_put_sync_autosuspend().

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patch.msgid.link/20250616061212.2286741-4-sakari.ailus@linux.intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Documentation/power/runtime_pm.rst
include/linux/pm_runtime.h

index e7bbdc66d64cc0958f532745531309cc83b12f3a..9c21c913f9cf139ba2dffc98e9dea04e453c3059 100644 (file)
@@ -428,7 +428,8 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
       pm_runtime_suspend(dev) and return its result
 
   `int pm_runtime_put_sync_autosuspend(struct device *dev);`
-    - decrement the device's usage counter; if the result is 0 then run
+    - set the power.last_busy field to the current time and decrement the
+      device's usage counter; if the result is 0 then run
       pm_runtime_autosuspend(dev) and return its result
 
   `void pm_runtime_enable(struct device *dev);`
index 14ca7be96686cd061463e81e081605b4e4997c0d..3a0d5f0ea47199cf6759bf57d9b729c3845215e8 100644 (file)
@@ -651,12 +651,14 @@ static inline int pm_runtime_put_sync_suspend(struct device *dev)
 }
 
 /**
- * pm_runtime_put_sync_autosuspend - Drop device usage counter and autosuspend if 0.
+ * pm_runtime_put_sync_autosuspend - Update the last access time of a device,
+ * drop device usage counter and autosuspend if 0.
  * @dev: Target device.
  *
- * Decrement the runtime PM usage counter of @dev and if it turns out to be
- * equal to 0, set up autosuspend of @dev or suspend it synchronously (depending
- * on whether or not autosuspend has been enabled for it).
+ * Update the last access time of @dev, decrement the runtime PM usage counter
+ * of @dev and if it turns out to be equal to 0, set up autosuspend of @dev or
+ * suspend it synchronously (depending on whether or not autosuspend has been
+ * enabled for it).
  *
  * The runtime PM usage counter of @dev remains decremented in all cases, even
  * if it returns an error code.
@@ -676,6 +678,7 @@ static inline int pm_runtime_put_sync_suspend(struct device *dev)
  */
 static inline int pm_runtime_put_sync_autosuspend(struct device *dev)
 {
+       pm_runtime_mark_last_busy(dev);
        return __pm_runtime_suspend(dev, RPM_GET_PUT | RPM_AUTO);
 }