summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2025-04-23 11:51:28 +0300
committerViresh Kumar <viresh.kumar@linaro.org>2025-05-02 08:25:40 +0300
commit8c5d8c0b9e8184a86baede72ca392f90d867d22e (patch)
treef1a67e44505b0078a109826d2bd90b5c155cb24f /include/linux
parentf95c855306fe47e809ca7ad6b4f330535f8b34fb (diff)
downloadlinux-8c5d8c0b9e8184a86baede72ca392f90d867d22e.tar.xz
OPP: Define and use scope-based cleanup helpers
Define and use scope-based cleanup helpers for `struct opp` and `struct opp_table`. No intentional functional impact. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/pm_opp.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index 0deddfa91aca..8313ed981535 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -11,6 +11,7 @@
#ifndef __LINUX_OPP_H__
#define __LINUX_OPP_H__
+#include <linux/cleanup.h>
#include <linux/energy_model.h>
#include <linux/err.h>
#include <linux/notifier.h>
@@ -579,6 +580,12 @@ static inline int dev_pm_opp_of_find_icc_paths(struct device *dev, struct opp_ta
}
#endif
+/* Scope based cleanup macro for OPP reference counting */
+DEFINE_FREE(put_opp, struct dev_pm_opp *, if (!IS_ERR_OR_NULL(_T)) dev_pm_opp_put(_T))
+
+/* Scope based cleanup macro for OPP table reference counting */
+DEFINE_FREE(put_opp_table, struct opp_table *, if (!IS_ERR_OR_NULL(_T)) dev_pm_opp_put_opp_table(_T))
+
/* OPP Configuration helpers */
static inline int dev_pm_opp_add(struct device *dev, unsigned long freq,