Re: [PATCH 31/31] PM / devfreq: convert to devm_pm_opp_register_notifier and remove unused API
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [PATCH 31/31] PM / devfreq: convert to devm_pm_opp_register_notifier and remove unused API
- From: Chanwoo Choi <cwchoi00@xxxxxxxxx>
- Date: Tue, 5 Jan 2021 14:36:44 +0900
- Cc: MyungJoo Ham <myungjoo.ham@xxxxxxxxxxx>, Kyungmin Park <kyungmin.park@xxxxxxxxxxx>, Chanwoo Choi <cw00.choi@xxxxxxxxxxx>, Krzysztof Kozlowski <krzk@xxxxxxxxxx>, Shawn Guo <shawnguo@xxxxxxxxxx>, s.hauer@xxxxxxxxxxxxxx, kernel@xxxxxxxxxxxxxx, festevam@xxxxxxxxx, dl-linux-imx <linux-imx@xxxxxxx>, Dmitry Osipenko <digetx@xxxxxxxxx>, Thierry Reding <thierry.reding@xxxxxxxxx>, Jonathan Hunter <jonathanh@xxxxxxxxxx>, yuq825@xxxxxxxxx, David Airlie <airlied@xxxxxxxx>, daniel@xxxxxxxx, robdclark@xxxxxxxxx, sean@xxxxxxxxxx, Rob Herring <robh@xxxxxxxxxx>, tomeu.vizoso@xxxxxxxxxxxxx, steven.price@xxxxxxx, alyssa.rosenzweig@xxxxxxxxxxxxx, stanimir.varbanov@xxxxxxxxxx, agross@xxxxxxxxxx, Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>, mchehab@xxxxxxxxxx, Lukasz Luba <lukasz.luba@xxxxxxx>, adrian.hunter@xxxxxxxxx, Ulf Hansson <ulf.hansson@xxxxxxxxxx>, Viresh Kumar <vireshk@xxxxxxxxxx>, Nishanth Menon <nm@xxxxxx>, Stephen Boyd <sboyd@xxxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxx>, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>, jirislaby@xxxxxxxxxx, "Rafael J. Wysocki" <rjw@xxxxxxxxxxxxx>, jcrouse@xxxxxxxxxxxxxx, hoegsberg@xxxxxxxxxx, eric@xxxxxxxxxxxxxxxxxx, tzimmermann@xxxxxxx, marijn.suijten@xxxxxxxxxxxxxx, gustavoars@xxxxxxxxxx, emil.velikov@xxxxxxxxxxxxx, jonathan@xxxxxxxx, akhilpo@xxxxxxxxxxxxxx, smasetty@xxxxxxxxxxxxxx, airlied@xxxxxxxxxx, masneyb@xxxxxxxxxxxxx, kalyan_t@xxxxxxxxxxxxxx, tanmay@xxxxxxxxxxxxxx, ddavenport@xxxxxxxxxxxx, jsanka@xxxxxxxxxxxxxx, rnayak@xxxxxxxxxxxxxx, tongtiangen@xxxxxxxxxx, miaoqinglang@xxxxxxxxxx, khsieh@xxxxxxxxxxxxxx, abhinavk@xxxxxxxxxxxxxx, chandanu@xxxxxxxxxxxxxx, Guenter Roeck <groeck@xxxxxxxxxxxx>, varar@xxxxxxxxxxxxxx, Matthias Kaehlcke <mka@xxxxxxxxxxxx>, harigovi@xxxxxxxxxxxxxx, rikard.falkeborn@xxxxxxxxx, natechancellor@xxxxxxxxx, Georgi Djakov <georgi.djakov@xxxxxxxxxx>, akashast@xxxxxxxxxxxxxx, parashar@xxxxxxxxxxxxxx, Doug Anderson <dianders@xxxxxxxxxxxx>, Linux PM list <linux-pm@xxxxxxxxxxxxxxx>, linux-kernel <linux-kernel@xxxxxxxxxxxxxxx>, linux-samsung-soc <linux-samsung-soc@xxxxxxxxxxxxxxx>, linux-arm-kernel <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, linux-tegra@xxxxxxxxxxxxxxx, dri-devel <dri-devel@xxxxxxxxxxxxxxxxxxxxx>, lima@xxxxxxxxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx, freedreno@xxxxxxxxxxxxxxxxxxxxx, linux-media@xxxxxxxxxxxxxxx, linux-mmc@xxxxxxxxxxxxxxx, linux-spi@xxxxxxxxxxxxxxx, linux-serial@xxxxxxxxxxxxxxx
- In-reply-to: <20210103035706.24168-1-tiny.windzz@gmail.com>
- References: <20210103035706.24168-1-tiny.windzz@gmail.com>
- Reply-to: cwchoi00@xxxxxxxxx
On Sun, Jan 3, 2021 at 12:59 PM Yangtao Li <tiny.windzz@xxxxxxxxx> wrote:
>
> Use devm_pm_opp_* API to simplify code.
>
> Signed-off-by: Yangtao Li <tiny.windzz@xxxxxxxxx>
> ---
> 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
[Index of Archives]
[Linux Kernel]
[Linux ARM (vger)]
[Linux ARM MSM]
[Linux Omap]
[Linux Arm]
[Linux Tegra]
[Fedora ARM]
[Linux for Samsung SOC]
[eCos]
[Linux Fastboot]
[Gcc Help]
[Git]
[DCCP]
[IETF Announce]
[Security]
[Linux MIPS]
[Yosemite Campsites]
|