linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Dmitry Osipenko <digetx@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Peter Geis <pgwipeout@gmail.com>,
	Nicolas Chauvet <kwizart@gmail.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Kevin Hilman <khilman@kernel.org>,
	Peter De Schrijver <pdeschrijver@nvidia.com>,
	Viresh Kumar <vireshk@kernel.org>,
	Stephen Boyd <sboyd@kernel.org>, Nishanth Menon <nm@ti.com>,
	Yangtao Li <tiny.windzz@gmail.com>,
	Matt Merhar <mattmerhar@protonmail.com>,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH v3 08/12] opp: Add devm_pm_opp_register_set_opp_helper
Date: Mon, 18 Jan 2021 16:37:10 +0530	[thread overview]
Message-ID: <20210118110710.q55fa44cle5fuhfk@vireshk-i7> (raw)
In-Reply-To: <20210118005524.27787-9-digetx@gmail.com>

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@gmail.com>
> Tested-by: Nicolas Chauvet <kwizart@gmail.com>
> Tested-by: Matt Merhar <mattmerhar@protonmail.com>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.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

  reply	other threads:[~2021-01-18 11:10 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18  0:55 [PATCH v3 00/12] OPP API fixes and improvements Dmitry Osipenko
2021-01-18  0:55 ` [PATCH v3 01/12] opp: Fix adding OPP entries in a wrong order if rate is unavailable Dmitry Osipenko
2021-01-18  7:44   ` Viresh Kumar
2021-01-18 18:46     ` Dmitry Osipenko
2021-01-18  0:55 ` [PATCH v3 02/12] opp: Filter out OPPs based on availability of a required-OPP Dmitry Osipenko
2021-01-18  8:11   ` Viresh Kumar
2021-01-18  0:55 ` [PATCH v3 03/12] opp: Correct debug message in _opp_add_static_v2() Dmitry Osipenko
2021-01-18  8:14   ` Viresh Kumar
2021-01-18  0:55 ` [PATCH v3 04/12] opp: Add dev_pm_opp_sync_regulators() Dmitry Osipenko
2021-01-18  8:20   ` Viresh Kumar
2021-01-18 18:35     ` Dmitry Osipenko
2021-01-19  4:58       ` Viresh Kumar
2021-01-19 22:42         ` Dmitry Osipenko
2021-01-18 11:00   ` Viresh Kumar
2021-01-18 11:06     ` Viresh Kumar
2021-01-18  0:55 ` [PATCH v3 05/12] opp: Add dev_pm_opp_set_voltage() Dmitry Osipenko
2021-01-18  9:52   ` Viresh Kumar
2021-01-18 19:14     ` Dmitry Osipenko
2021-01-20 21:57       ` Dmitry Osipenko
2021-01-21 11:20         ` Viresh Kumar
2021-01-18  0:55 ` [PATCH v3 06/12] opp: Add dev_pm_opp_find_level_ceil() Dmitry Osipenko
2021-01-18  9:58   ` Viresh Kumar
2021-01-18  0:55 ` [PATCH v3 07/12] opp: Add dev_pm_opp_get_required_pstate() Dmitry Osipenko
2021-01-18 10:50   ` Viresh Kumar
2021-01-18  0:55 ` [PATCH v3 08/12] opp: Add devm_pm_opp_register_set_opp_helper Dmitry Osipenko
2021-01-18 11:07   ` Viresh Kumar [this message]
2021-01-18  0:55 ` [PATCH v3 09/12] opp: Add devm_pm_opp_attach_genpd Dmitry Osipenko
2021-01-18 11:14   ` Viresh Kumar
2021-01-18  0:55 ` [PATCH v3 10/12] opp: Support set_opp() customization without requiring to use regulators Dmitry Osipenko
2021-01-18 11:44   ` Viresh Kumar
2021-01-18 18:48     ` Dmitry Osipenko
2021-01-19  6:35       ` [PATCH] opp: Prepare for ->set_opp() helper to work without regulators Viresh Kumar
2021-01-19 17:16         ` Dmitry Osipenko
2021-01-20  7:39           ` Viresh Kumar
2021-01-20 14:50             ` Dmitry Osipenko
2021-01-21 11:25               ` Viresh Kumar
2021-01-19 17:18         ` Dmitry Osipenko
2021-01-20  8:08         ` Viresh Kumar
2021-01-21 11:28           ` Viresh Kumar
2021-01-19  6:36       ` [PATCH v3 10/12] opp: Support set_opp() customization without requiring to use regulators Viresh Kumar
2021-01-21 11:30       ` [PATCH V2] opp: Prepare for ->set_opp() helper to work without regulators Viresh Kumar
2021-01-21 21:02         ` Dmitry Osipenko
2021-01-22  3:05           ` Viresh Kumar
2021-01-18  0:55 ` [PATCH v3 11/12] opp: Handle missing OPP table in dev_pm_opp_xlate_performance_state() Dmitry Osipenko
2021-01-18 11:18   ` Viresh Kumar
2021-01-18  0:55 ` [PATCH v3 12/12] opp: Print OPP level in debug message of _opp_add_static_v2() Dmitry Osipenko
2021-01-18 11:18   ` Viresh Kumar
2021-01-18 11:46 ` [PATCH v3 00/12] OPP API fixes and improvements Viresh Kumar
2021-01-19 17:35   ` Dmitry Osipenko
2021-01-20 15:41     ` Dmitry Osipenko
2021-01-21  7:51       ` Viresh Kumar
2021-01-21 20:30         ` Dmitry Osipenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210118110710.q55fa44cle5fuhfk@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=broonie@kernel.org \
    --cc=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=khilman@kernel.org \
    --cc=kwizart@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mattmerhar@protonmail.com \
    --cc=nm@ti.com \
    --cc=pdeschrijver@nvidia.com \
    --cc=pgwipeout@gmail.com \
    --cc=rjw@rjwysocki.net \
    --cc=sboyd@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=tiny.windzz@gmail.com \
    --cc=ulf.hansson@linaro.org \
    --cc=vireshk@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).