[PATCH 1/2] OPP: Introduce devm_pm_opp_set_config_regulators

From: Primoz Fiser
Date: Thu Jun 06 2024 - 07:33:50 EST


Introduce devm_pm_opp_set_config_regulators() function. This is device
managed version of dev_pm_opp_set_config_regulators so caller don't need
to worry about managing returned tokens.

Signed-off-by: Primoz Fiser <primoz.fiser@xxxxxxxxx>
---
include/linux/pm_opp.h | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index dd7c8441af42..fa515aab47c9 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -664,6 +664,16 @@ static inline int dev_pm_opp_set_config_regulators(struct device *dev,
return dev_pm_opp_set_config(dev, &config);
}

+static inline int devm_pm_opp_set_config_regulators(struct device *dev,
+ config_regulators_t helper)
+{
+ struct dev_pm_opp_config config = {
+ .config_regulators = helper,
+ };
+
+ return devm_pm_opp_set_config(dev, &config);
+}
+
static inline void dev_pm_opp_put_config_regulators(int token)
{
dev_pm_opp_clear_config(token);
--
2.25.1