[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGTfZH0kg=-MLrvEb+oHkaAuS3mV+o+Oia=wUCf=n2v7s1oXMg@mail.gmail.com>
Date: Wed, 6 Jan 2021 04:59:04 +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 Vetter <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 <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 Marek <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 28/31] PM / devfreq: imx8m-ddrc: convert to use
devm_pm_opp_* API
Hi Yangtao,
On Tue, Jan 5, 2021 at 1:13 PM Chanwoo Choi <cwchoi00@...il.com> wrote:
>
> On Sun, Jan 3, 2021 at 12:58 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/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
Powered by blists - more mailing lists