summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2025-04-22 17:05:31 -0600
committerBjorn Helgaas <bhelgaas@google.com>2025-04-23 16:05:50 -0500
commitbfa4477751e9909bb121eca860f44d1b4259d871 (patch)
treede096f2214204af651a6f638f3100fd9dcee3091 /include
parent0af2f6be1b4281385b618cb86ad946eded089ac8 (diff)
PM: runtime: Define pm_runtime_put cleanup helper
Define a cleanup helper for use with __free to automatically drop the device usage count when the pointer goes out of scope. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Rafael J. Wysocki <rafael@kernel.org> Link: https://patch.msgid.link/20250422230534.2295291-2-alex.williamson@redhat.com
Diffstat (limited to 'include')
-rw-r--r--include/linux/pm_runtime.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 7fb5a459847e..69d4b2929ee6 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -466,6 +466,8 @@ static inline int pm_runtime_put(struct device *dev)
return __pm_runtime_idle(dev, RPM_GET_PUT | RPM_ASYNC);
}
+DEFINE_FREE(pm_runtime_put, struct device *, if (_T) pm_runtime_put(_T))
+
/**
* __pm_runtime_put_autosuspend - Drop device usage counter and queue autosuspend if 0.
* @dev: Target device.