From: Chanwoo Choi <cwchoi00@gmail.com>
To: Dmitry Osipenko <digetx@gmail.com>,
Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
MyungJoo Ham <myungjoo.ham@samsung.com>,
Stephen Boyd <sboyd@kernel.org>,
Kyungmin Park <kyungmin.park@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>
Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org
Subject: Re: [PATCH v1 2/4] PM / devfreq: Add devm_devfreq_add_governor()
Date: Thu, 16 Sep 2021 03:23:34 +0900 [thread overview]
Message-ID: <504a75a9-3f39-3aed-2df5-4ca1e7f99afc@gmail.com> (raw)
In-Reply-To: <20210912184458.17995-3-digetx@gmail.com>
On 21. 9. 13. 오전 3:44, Dmitry Osipenko wrote:
> Add resource-managed variant of devfreq_add_governor().
>
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
> drivers/devfreq/devfreq.c | 26 ++++++++++++++++++++++++++
> drivers/devfreq/governor.h | 3 +++
> 2 files changed, 29 insertions(+)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 85faa7a5c7d1..d3af000ec290 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -1301,6 +1301,32 @@ int devfreq_add_governor(struct devfreq_governor *governor)
> }
> EXPORT_SYMBOL(devfreq_add_governor);
>
> +static void devm_devfreq_remove_governor(void *governor)
> +{
> + devfreq_remove_governor(governor);
Because devfreq_remove_governor has the return value,
you need to check the return value and then print error at least.
WARN_ON(devfreq_remove_governor(governor));
> +}
> +
> +/**
> + * devm_devfreq_add_governor() - Add devfreq governor
> + * @dev: device which adds devfreq governor
> + * @governor: the devfreq governor to be added
> + *
> + * This is a resource-managed variant of devfreq_add_governor().
> + */
> +int devm_devfreq_add_governor(struct device *dev,
> + struct devfreq_governor *governor)
> +{
> + int err;
> +
> + err = devfreq_add_governor(governor);
> + if (err)
> + return err;
> +
> + return devm_add_action_or_reset(dev, devm_devfreq_remove_governor,
> + governor);
> +}
> +EXPORT_SYMBOL(devm_devfreq_add_governor);
> +
> /**
> * devfreq_remove_governor() - Remove devfreq feature from a device.
> * @governor: the devfreq governor to be removed
> diff --git a/drivers/devfreq/governor.h b/drivers/devfreq/governor.h
> index 2d69a0ce6291..0d70a9ad951e 100644
> --- a/drivers/devfreq/governor.h
> +++ b/drivers/devfreq/governor.h
> @@ -94,4 +94,7 @@ static inline int devfreq_update_stats(struct devfreq *df)
>
> return df->profile->get_dev_status(df->dev.parent, &df->last_status);
> }
> +
> +int devm_devfreq_add_governor(struct device *dev,
> + struct devfreq_governor *governor);
Better to add under devfreq_remove_governor definition in order to
gather the similar functions.
> #endif /* _GOVERNOR_H */
>
--
Best Regards,
Samsung Electronics
Chanwoo Choi
next prev parent reply other threads:[~2021-09-15 18:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-12 18:44 [PATCH v1 0/4] Make probe() of Tegra devfreq driver completely resource-managed Dmitry Osipenko
2021-09-12 18:44 ` [PATCH v1 1/4] opp: Add more resource-managed variants of dev_pm_opp_of_add_table() Dmitry Osipenko
2021-09-12 18:44 ` [PATCH v1 2/4] PM / devfreq: Add devm_devfreq_add_governor() Dmitry Osipenko
2021-09-15 18:23 ` Chanwoo Choi [this message]
2021-09-16 1:30 ` Dmitry Osipenko
2021-09-15 18:37 ` Chanwoo Choi
2021-09-16 1:29 ` Dmitry Osipenko
2021-09-12 18:44 ` [PATCH v1 3/4] PM / devfreq: tegra30: Use resource-managed helpers Dmitry Osipenko
2021-09-12 18:44 ` [PATCH v1 4/4] PM / devfreq: tegra30: Check whether clk_round_rate() returns zero rate Dmitry Osipenko
2021-09-15 3:51 ` Chanwoo Choi
2021-09-15 18:31 ` Chanwoo Choi
2021-09-16 1:28 ` Dmitry Osipenko
2021-09-19 9:43 ` Chanwoo Choi
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=504a75a9-3f39-3aed-2df5-4ca1e7f99afc@gmail.com \
--to=cwchoi00@gmail.com \
--cc=cw00.choi@samsung.com \
--cc=digetx@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=nm@ti.com \
--cc=sboyd@kernel.org \
--cc=thierry.reding@gmail.com \
--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).