Skip to content

Commit bfa4477

Browse files
awilliambjorn-helgaas
authored andcommitted
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 <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 0af2f6b commit bfa4477

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

include/linux/pm_runtime.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,8 @@ static inline int pm_runtime_put(struct device *dev)
466466
return __pm_runtime_idle(dev, RPM_GET_PUT | RPM_ASYNC);
467467
}
468468

469+
DEFINE_FREE(pm_runtime_put, struct device *, if (_T) pm_runtime_put(_T))
470+
469471
/**
470472
* __pm_runtime_put_autosuspend - Drop device usage counter and queue autosuspend if 0.
471473
* @dev: Target device.

0 commit comments

Comments
 (0)