[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGTfZH0s0iiR1jaebU8KyJ7mdvZMOUQXfmuxGh0PJ_v0diXtfA@mail.gmail.com>
Date: Tue, 5 Jan 2021 14:36:44 +0900
From: Chanwoo Choi <cwchoi00@...il.com>
To: Yangtao Li <tiny.windzz@...il.com>
Cc: MyungJoo Ham <myungjoo.ham@...sung.com>,
Kyungmin Park <kyungmin.park@...sung.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Krzysztof Kozlowski <krzk@...nel.org>,
Shawn Guo <shawnguo@...nel.org>, s.hauer@...gutronix.de,
kernel@...gutronix.de, festevam@...il.com,
dl-linux-imx <linux-imx@....com>,
Dmitry Osipenko <digetx@...il.com>,
Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>, yuq825@...il.com,
David Airlie <airlied@...ux.ie>, daniel@...ll.ch,
robdclark@...il.com, sean@...rly.run,
Rob Herring <robh@...nel.org>, tomeu.vizoso@...labora.com,
steven.price@....com, alyssa.rosenzweig@...labora.com,
stanimir.varbanov@...aro.org, agross@...nel.org,
Bjorn Andersson <bjorn.andersson@...aro.org>,
mchehab@...nel.org, Lukasz Luba <lukasz.luba@....com>,
adrian.hunter@...el.com, Ulf Hansson <ulf.hansson@...aro.org>,
Viresh Kumar <vireshk@...nel.org>, Nishanth Menon <nm@...com>,
Stephen Boyd <sboyd@...nel.org>,
Mark Brown <broonie@...nel.org>,
Greg KH <gregkh@...uxfoundation.org>, jirislaby@...nel.org,
"Rafael J. Wysocki" <rjw@...ysocki.net>, jcrouse@...eaurora.org,
hoegsberg@...gle.com, eric@...olt.net, tzimmermann@...e.de,
marijn.suijten@...ainline.org, gustavoars@...nel.org,
emil.velikov@...labora.com, jonathan@...ek.ca,
akhilpo@...eaurora.org, smasetty@...eaurora.org,
airlied@...hat.com, masneyb@...tation.org, kalyan_t@...eaurora.org,
tanmay@...eaurora.org, ddavenport@...omium.org,
jsanka@...eaurora.org, rnayak@...eaurora.org,
tongtiangen@...wei.com, miaoqinglang@...wei.com,
khsieh@...eaurora.org, abhinavk@...eaurora.org,
chandanu@...eaurora.org, Guenter Roeck <groeck@...omium.org>,
varar@...eaurora.org, Matthias Kaehlcke <mka@...omium.org>,
harigovi@...eaurora.org, rikard.falkeborn@...il.com,
natechancellor@...il.com, Georgi Djakov <georgi.djakov@...aro.org>,
akashast@...eaurora.org, parashar@...eaurora.org,
Doug Anderson <dianders@...omium.org>,
Linux PM list <linux-pm@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
linux-samsung-soc <linux-samsung-soc@...r.kernel.org>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
linux-tegra@...r.kernel.org,
dri-devel <dri-devel@...ts.freedesktop.org>,
lima@...ts.freedesktop.org, linux-arm-msm@...r.kernel.org,
freedreno@...ts.freedesktop.org, linux-media@...r.kernel.org,
linux-mmc@...r.kernel.org, linux-spi@...r.kernel.org,
linux-serial@...r.kernel.org
Subject: Re: [PATCH 31/31] PM / devfreq: convert to devm_pm_opp_register_notifier
and remove unused API
On Sun, Jan 3, 2021 at 12:59 PM Yangtao Li <tiny.windzz@...il.com> wrote:
>
> Use devm_pm_opp_* API to simplify code.
>
> Signed-off-by: Yangtao Li <tiny.windzz@...il.com>
> ---
> drivers/devfreq/devfreq.c | 66 +--------------------------------------
> include/linux/devfreq.h | 23 --------------
> 2 files changed, 1 insertion(+), 88 deletions(-)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 6aa10de792b3..f593f30529ec 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -2004,40 +2004,6 @@ struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
> }
> EXPORT_SYMBOL(devfreq_recommended_opp);
>
> -/**
> - * devfreq_register_opp_notifier() - Helper function to get devfreq notified
> - * for any changes in the OPP availability
> - * changes
> - * @dev: The devfreq user device. (parent of devfreq)
> - * @devfreq: The devfreq object.
> - */
> -int devfreq_register_opp_notifier(struct device *dev, struct devfreq *devfreq)
> -{
> - return dev_pm_opp_register_notifier(dev, &devfreq->nb);
> -}
> -EXPORT_SYMBOL(devfreq_register_opp_notifier);
> -
> -/**
> - * devfreq_unregister_opp_notifier() - Helper function to stop getting devfreq
> - * notified for any changes in the OPP
> - * availability changes anymore.
> - * @dev: The devfreq user device. (parent of devfreq)
> - * @devfreq: The devfreq object.
> - *
> - * At exit() callback of devfreq_dev_profile, this must be included if
> - * devfreq_recommended_opp is used.
> - */
> -int devfreq_unregister_opp_notifier(struct device *dev, struct devfreq *devfreq)
> -{
> - return dev_pm_opp_unregister_notifier(dev, &devfreq->nb);
> -}
> -EXPORT_SYMBOL(devfreq_unregister_opp_notifier);
> -
> -static void devm_devfreq_opp_release(struct device *dev, void *res)
> -{
> - devfreq_unregister_opp_notifier(dev, *(struct devfreq **)res);
> -}
> -
> /**
> * devm_devfreq_register_opp_notifier() - Resource-managed
> * devfreq_register_opp_notifier()
> @@ -2047,40 +2013,10 @@ static void devm_devfreq_opp_release(struct device *dev, void *res)
> int devm_devfreq_register_opp_notifier(struct device *dev,
> struct devfreq *devfreq)
> {
> - struct devfreq **ptr;
> - int ret;
> -
> - ptr = devres_alloc(devm_devfreq_opp_release, sizeof(*ptr), GFP_KERNEL);
> - if (!ptr)
> - return -ENOMEM;
> -
> - ret = devfreq_register_opp_notifier(dev, devfreq);
> - if (ret) {
> - devres_free(ptr);
> - return ret;
> - }
> -
> - *ptr = devfreq;
> - devres_add(dev, ptr);
> -
> - return 0;
> + return devm_pm_opp_register_notifier(dev, &devfreq->nb);
> }
> EXPORT_SYMBOL(devm_devfreq_register_opp_notifier);
>
> -/**
> - * devm_devfreq_unregister_opp_notifier() - Resource-managed
> - * devfreq_unregister_opp_notifier()
> - * @dev: The devfreq user device. (parent of devfreq)
> - * @devfreq: The devfreq object.
> - */
> -void devm_devfreq_unregister_opp_notifier(struct device *dev,
> - struct devfreq *devfreq)
> -{
> - WARN_ON(devres_release(dev, devm_devfreq_opp_release,
> - devm_devfreq_dev_match, devfreq));
> -}
> -EXPORT_SYMBOL(devm_devfreq_unregister_opp_notifier);
Need to support devm_devfreq_unregister_opp_notifier()
because sometimes, the user wants to release the resource by himself.
(snip)
Best Regards,
Chanwoo Choi
Powered by blists - more mailing lists