[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210118110710.q55fa44cle5fuhfk@vireshk-i7>
Date: Mon, 18 Jan 2021 16:37:10 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Dmitry Osipenko <digetx@...il.com>
Cc: Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Mark Brown <broonie@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>,
Ulf Hansson <ulf.hansson@...aro.org>,
Peter Geis <pgwipeout@...il.com>,
Nicolas Chauvet <kwizart@...il.com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Kevin Hilman <khilman@...nel.org>,
Peter De Schrijver <pdeschrijver@...dia.com>,
Viresh Kumar <vireshk@...nel.org>,
Stephen Boyd <sboyd@...nel.org>, Nishanth Menon <nm@...com>,
Yangtao Li <tiny.windzz@...il.com>,
Matt Merhar <mattmerhar@...tonmail.com>,
linux-kernel@...r.kernel.org, linux-tegra@...r.kernel.org,
linux-pm@...r.kernel.org
Subject: Re: [PATCH v3 08/12] opp: Add devm_pm_opp_register_set_opp_helper
On 18-01-21, 03:55, Dmitry Osipenko wrote:
> Add resource-managed version of dev_pm_opp_register_set_opp_helper().
>
> Tested-by: Peter Geis <pgwipeout@...il.com>
> Tested-by: Nicolas Chauvet <kwizart@...il.com>
> Tested-by: Matt Merhar <mattmerhar@...tonmail.com>
> Signed-off-by: Dmitry Osipenko <digetx@...il.com>
> ---
> drivers/opp/core.c | 34 ++++++++++++++++++++++++++++++++++
> include/linux/pm_opp.h | 8 ++++++++
> 2 files changed, 42 insertions(+)
>
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index fde2ec00ab0e..8e0d2193fd5f 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -2857,3 +2857,37 @@ int dev_pm_opp_set_voltage(struct device *dev, struct dev_pm_opp *opp)
> return ret;
> }
> EXPORT_SYMBOL_GPL(dev_pm_opp_set_voltage);
> +
> +static void devm_pm_opp_unregister_set_opp_helper(void *data)
> +{
> + dev_pm_opp_unregister_set_opp_helper(data);
> +}
> +
> +/**
> + * devm_pm_opp_register_set_opp_helper() - Register custom set OPP helper
> + * @dev: Device for which the helper is getting registered.
> + * @set_opp: Custom set OPP helper.
> + *
> + * This is a resource-managed version of dev_pm_opp_register_set_opp_helper().
> + *
> + * Return: pointer to 'struct opp_table' on success and errorno otherwise.
> + */
> +struct opp_table *
> +devm_pm_opp_register_set_opp_helper(struct device *dev,
> + int (*set_opp)(struct dev_pm_set_opp_data *data))
> +{
> + struct opp_table *opp_table;
> + int err;
> +
> + opp_table = dev_pm_opp_register_set_opp_helper(dev, set_opp);
> + if (IS_ERR(opp_table))
> + return opp_table;
> +
> + err = devm_add_action_or_reset(dev, devm_pm_opp_unregister_set_opp_helper,
> + opp_table);
> + if (err)
> + return ERR_PTR(err);
> +
> + return opp_table;
> +}
> +EXPORT_SYMBOL_GPL(devm_pm_opp_register_set_opp_helper);
> diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
> index e072148ae0e1..6de5853aaada 100644
> --- a/include/linux/pm_opp.h
> +++ b/include/linux/pm_opp.h
> @@ -169,6 +169,7 @@ void dev_pm_opp_remove_table(struct device *dev);
> void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask);
> int dev_pm_opp_sync_regulators(struct device *dev);
> int dev_pm_opp_set_voltage(struct device *dev, struct dev_pm_opp *opp);
> +struct opp_table *devm_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data));
> #else
> static inline struct opp_table *dev_pm_opp_get_opp_table(struct device *dev)
> {
> @@ -428,6 +429,13 @@ static inline int dev_pm_opp_set_voltage(struct device *dev, struct dev_pm_opp *
> return -ENOTSUPP;
> }
>
> +static inline struct opp_table *
> +devm_pm_opp_register_set_opp_helper(struct device *dev,
> + int (*set_opp)(struct dev_pm_set_opp_data *data))
> +{
> + return ERR_PTR(-ENOTSUPP);
> +}
> +
> #endif /* CONFIG_PM_OPP */
>
> #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
Applied. Thanks.
I had to apply it manually, please make sure it works fine.
--
viresh
Powered by blists - more mailing lists