Re: [PATCH 28/31] PM / devfreq: imx8m-ddrc: convert to use devm_pm_opp_* API
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [PATCH 28/31] PM / devfreq: imx8m-ddrc: convert to use devm_pm_opp_* API
- From: Chanwoo Choi <cwchoi00@xxxxxxxxx>
- Date: Wed, 6 Jan 2021 04:59:04 +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 Vetter <daniel@xxxxxxxx>, robdclark@xxxxxxxxx, sean@xxxxxxxxxx, Rob Herring <robh@xxxxxxxxxx>, tomeu.vizoso@xxxxxxxxxxxxx, steven.price@xxxxxxx, alyssa.rosenzweig@xxxxxxxxxxxxx, Stanimir Varbanov <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 Marek <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: <CAGTfZH37=e4RgdR4xg-3s9-pRjqunHi2jfPQqQgVWkxW94GwOA@mail.gmail.com>
- References: <20210103035540.23886-1-tiny.windzz@gmail.com> <CAGTfZH37=e4RgdR4xg-3s9-pRjqunHi2jfPQqQgVWkxW94GwOA@mail.gmail.com>
- Reply-to: cwchoi00@xxxxxxxxx
Hi Yangtao,
On Tue, Jan 5, 2021 at 1:13 PM Chanwoo Choi <cwchoi00@xxxxxxxxx> wrote:
>
> On Sun, Jan 3, 2021 at 12:58 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/imx8m-ddrc.c | 15 ++-------------
> > 1 file changed, 2 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/devfreq/imx8m-ddrc.c b/drivers/devfreq/imx8m-ddrc.c
> > index bc82d3653bff..9383d6e5538b 100644
> > --- a/drivers/devfreq/imx8m-ddrc.c
> > +++ b/drivers/devfreq/imx8m-ddrc.c
> > @@ -370,11 +370,6 @@ static int imx8m_ddrc_check_opps(struct device *dev)
> > return 0;
> > }
> >
> > -static void imx8m_ddrc_exit(struct device *dev)
> > -{
> > - dev_pm_opp_of_remove_table(dev);
> > -}
> > -
> > static int imx8m_ddrc_probe(struct platform_device *pdev)
> > {
> > struct device *dev = &pdev->dev;
> > @@ -419,7 +414,7 @@ static int imx8m_ddrc_probe(struct platform_device *pdev)
> > return ret;
> > }
> >
> > - ret = dev_pm_opp_of_add_table(dev);
> > + ret = devm_pm_opp_of_add_table(dev);
> > if (ret < 0) {
> > dev_err(dev, "failed to get OPP table\n");
> > return ret;
> > @@ -427,12 +422,11 @@ static int imx8m_ddrc_probe(struct platform_device *pdev)
> >
> > ret = imx8m_ddrc_check_opps(dev);
> > if (ret < 0)
> > - goto err;
> > + return ret;
> >
> > priv->profile.polling_ms = 1000;
> > priv->profile.target = imx8m_ddrc_target;
> > priv->profile.get_dev_status = imx8m_ddrc_get_dev_status;
> > - priv->profile.exit = imx8m_ddrc_exit;
> > priv->profile.get_cur_freq = imx8m_ddrc_get_cur_freq;
> > priv->profile.initial_freq = clk_get_rate(priv->dram_core);
> >
> > @@ -441,13 +435,8 @@ static int imx8m_ddrc_probe(struct platform_device *pdev)
> > if (IS_ERR(priv->devfreq)) {
> > ret = PTR_ERR(priv->devfreq);
> > dev_err(dev, "failed to add devfreq device: %d\n", ret);
> > - goto err;
> > }
> >
> > - return 0;
> > -
> > -err:
> > - dev_pm_opp_of_remove_table(dev);
> > return ret;
>
> devm_devfreq_add_device() doesn't return any integer value.
> Even if devm_devfreq_add_device() returns the right devfreq instance,
> the 'ret' value is not the return value of devm_devfreq_add_device().
>
> On this patch, 'ret' value of 'return ret' is from imx8m_ddrc_check_opps().
> Surely, it is well working with this modification. But, it is not code
> for exception handling.
> So, we need to remain the following codes:
>
> return 0;
> err:
> return ret;
>
'err' is not necessary. You better to edit it as following:
if (IS_ERR(priv->devfreq)) {
dev_err(dev, "failed to add devfreq device: %d\n", ret);
return PTR_ERR(priv->devfreq);
}
return 0;
--
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]
|