[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <63e5e2ae-0baf-cbd1-b2eb-43fac89acb7c@arm.com>
Date: Tue, 5 Jan 2021 16:33:32 +0000
From: Steven Price <steven.price@....com>
To: Yangtao Li <tiny.windzz@...il.com>, myungjoo.ham@...sung.com,
kyungmin.park@...sung.com, cw00.choi@...sung.com, krzk@...nel.org,
shawnguo@...nel.org, s.hauer@...gutronix.de, kernel@...gutronix.de,
festevam@...il.com, linux-imx@....com, digetx@...il.com,
thierry.reding@...il.com, jonathanh@...dia.com, yuq825@...il.com,
airlied@...ux.ie, daniel@...ll.ch, robdclark@...il.com,
sean@...rly.run, robh@...nel.org, tomeu.vizoso@...labora.com,
alyssa.rosenzweig@...labora.com, stanimir.varbanov@...aro.org,
agross@...nel.org, bjorn.andersson@...aro.org, mchehab@...nel.org,
lukasz.luba@....com, adrian.hunter@...el.com,
ulf.hansson@...aro.org, vireshk@...nel.org, nm@...com,
sboyd@...nel.org, broonie@...nel.org, gregkh@...uxfoundation.org,
jirislaby@...nel.org, 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, groeck@...omium.org, varar@...eaurora.org,
mka@...omium.org, harigovi@...eaurora.org,
rikard.falkeborn@...il.com, natechancellor@...il.com,
georgi.djakov@...aro.org, akashast@...eaurora.org,
parashar@...eaurora.org, dianders@...omium.org
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-samsung-soc@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-tegra@...r.kernel.org,
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 19/31] drm/panfrost: convert to use devm_pm_opp_* API
On 01/01/2021 16:54, Yangtao Li wrote:
> Use devm_pm_opp_* API to simplify code, and remove opp_table
> from panfrost_devfreq.
>
> Signed-off-by: Yangtao Li <tiny.windzz@...il.com>
Reviewed-by: Steven Price <steven.price@....com>
> ---
> drivers/gpu/drm/panfrost/panfrost_devfreq.c | 34 ++++++---------------
> drivers/gpu/drm/panfrost/panfrost_devfreq.h | 1 -
> 2 files changed, 10 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> index f44d28fad085..c42fa9eb43b1 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> @@ -92,25 +92,26 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
> struct thermal_cooling_device *cooling;
> struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq;
>
> - opp_table = dev_pm_opp_set_regulators(dev, pfdev->comp->supply_names,
> + opp_table = devm_pm_opp_set_regulators(dev, pfdev->comp->supply_names,
> pfdev->comp->num_supplies);
> if (IS_ERR(opp_table)) {
> ret = PTR_ERR(opp_table);
> /* Continue if the optional regulator is missing */
> if (ret != -ENODEV) {
> DRM_DEV_ERROR(dev, "Couldn't set OPP regulators\n");
> - goto err_fini;
> + return ret;
> }
> - } else {
> - pfdevfreq->regulators_opp_table = opp_table;
> }
>
> - ret = dev_pm_opp_of_add_table(dev);
> + ret = devm_pm_opp_of_add_table(dev);
> if (ret) {
> + if (!IS_ERR(opp_table))
> + devm_pm_opp_put_regulators(dev, opp_table);
> +
> /* Optional, continue without devfreq */
> if (ret == -ENODEV)
> ret = 0;
> - goto err_fini;
> + return ret;
> }
> pfdevfreq->opp_of_table_added = true;
>
> @@ -121,10 +122,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
> cur_freq = clk_get_rate(pfdev->clock);
>
> opp = devfreq_recommended_opp(dev, &cur_freq, 0);
> - if (IS_ERR(opp)) {
> - ret = PTR_ERR(opp);
> - goto err_fini;
> - }
> + if (IS_ERR(opp))
> + return PTR_ERR(opp);
>
> panfrost_devfreq_profile.initial_freq = cur_freq;
> dev_pm_opp_put(opp);
> @@ -133,8 +132,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
> DEVFREQ_GOV_SIMPLE_ONDEMAND, NULL);
> if (IS_ERR(devfreq)) {
> DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n");
> - ret = PTR_ERR(devfreq);
> - goto err_fini;
> + return PTR_ERR(devfreq);
> }
> pfdevfreq->devfreq = devfreq;
>
> @@ -145,10 +143,6 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
> pfdevfreq->cooling = cooling;
>
> return 0;
> -
> -err_fini:
> - panfrost_devfreq_fini(pfdev);
> - return ret;
> }
>
> void panfrost_devfreq_fini(struct panfrost_device *pfdev)
> @@ -159,14 +153,6 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev)
> devfreq_cooling_unregister(pfdevfreq->cooling);
> pfdevfreq->cooling = NULL;
> }
> -
> - if (pfdevfreq->opp_of_table_added) {
> - dev_pm_opp_of_remove_table(&pfdev->pdev->dev);
> - pfdevfreq->opp_of_table_added = false;
> - }
> -
> - dev_pm_opp_put_regulators(pfdevfreq->regulators_opp_table);
> - pfdevfreq->regulators_opp_table = NULL;
> }
>
> void panfrost_devfreq_resume(struct panfrost_device *pfdev)
> diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h
> index db6ea48e21f9..a51854cc8c06 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h
> +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h
> @@ -15,7 +15,6 @@ struct panfrost_device;
>
> struct panfrost_devfreq {
> struct devfreq *devfreq;
> - struct opp_table *regulators_opp_table;
> struct thermal_cooling_device *cooling;
> bool opp_of_table_added;
>
>
Powered by blists - more mailing lists