2020-11-06 07:07:00

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table

Hello,

This patchset updates the dev_pm_opp_put_*() helpers to accept a NULL
pointer for the OPP table, in order to allow the callers to drop the
unnecessary checks they had to carry.

All these must get merged upstream through the OPP tree as there is a
hard dependency on the first patch here. Thanks.

Viresh Kumar (7):
opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table
cpufreq: dt: dev_pm_opp_put_regulators() accepts NULL argument
cpufreq: qcom-cpufreq-nvmem: dev_pm_opp_put_*() accepts NULL argument
devfreq: exynos: dev_pm_opp_put_*() accepts NULL argument
drm/lima: dev_pm_opp_put_*() accepts NULL argument
drm/panfrost: dev_pm_opp_put_*() accepts NULL argument
media: venus: dev_pm_opp_put_*() accepts NULL argument

drivers/cpufreq/cpufreq-dt.c | 6 ++----
drivers/cpufreq/qcom-cpufreq-nvmem.c | 15 ++++++---------
drivers/devfreq/exynos-bus.c | 12 ++++--------
drivers/gpu/drm/lima/lima_devfreq.c | 13 ++++---------
drivers/gpu/drm/panfrost/panfrost_devfreq.c | 6 ++----
drivers/media/platform/qcom/venus/pm_helpers.c | 3 +--
drivers/opp/core.c | 18 ++++++++++++++++++
7 files changed, 37 insertions(+), 36 deletions(-)

--
2.25.0.rc1.19.g042ed3e048af


2020-11-06 07:07:14

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH 1/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table

This allows the callers to drop the unnecessary checks.

Signed-off-by: Viresh Kumar <[email protected]>
---
drivers/opp/core.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index b24f685823ae..9d145bb99a59 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -1660,6 +1660,9 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_set_supported_hw);
*/
void dev_pm_opp_put_supported_hw(struct opp_table *opp_table)
{
+ if (unlikely(!opp_table))
+ return;
+
/* Make sure there are no concurrent readers while updating opp_table */
WARN_ON(!list_empty(&opp_table->opp_list));

@@ -1716,6 +1719,9 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_set_prop_name);
*/
void dev_pm_opp_put_prop_name(struct opp_table *opp_table)
{
+ if (unlikely(!opp_table))
+ return;
+
/* Make sure there are no concurrent readers while updating opp_table */
WARN_ON(!list_empty(&opp_table->opp_list));

@@ -1844,6 +1850,9 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table)
{
int i;

+ if (unlikely(!opp_table))
+ return;
+
if (!opp_table->regulators)
goto put_opp_table;

@@ -1926,6 +1935,9 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_set_clkname);
*/
void dev_pm_opp_put_clkname(struct opp_table *opp_table)
{
+ if (unlikely(!opp_table))
+ return;
+
/* Make sure there are no concurrent readers while updating opp_table */
WARN_ON(!list_empty(&opp_table->opp_list));

@@ -1981,6 +1993,9 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_register_set_opp_helper);
*/
void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table)
{
+ if (unlikely(!opp_table))
+ return;
+
/* Make sure there are no concurrent readers while updating opp_table */
WARN_ON(!list_empty(&opp_table->opp_list));

@@ -2109,6 +2124,9 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_attach_genpd);
*/
void dev_pm_opp_detach_genpd(struct opp_table *opp_table)
{
+ if (unlikely(!opp_table))
+ return;
+
/*
* Acquire genpd_virt_dev_lock to make sure virt_dev isn't getting
* used in parallel.
--
2.25.0.rc1.19.g042ed3e048af

2020-11-06 07:07:20

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH 2/7] cpufreq: dt: dev_pm_opp_put_regulators() accepts NULL argument

The dev_pm_opp_put_*() APIs now accepts a NULL opp_table pointer and so
there is no need for us to carry the extra checks. Drop them.

Signed-off-by: Viresh Kumar <[email protected]>
---
drivers/cpufreq/cpufreq-dt.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 66b3db5efb53..5c049428a6f5 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -291,8 +291,7 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu)
out:
if (priv->have_static_opps)
dev_pm_opp_of_cpumask_remove_table(priv->cpus);
- if (priv->opp_table)
- dev_pm_opp_put_regulators(priv->opp_table);
+ dev_pm_opp_put_regulators(priv->opp_table);
free_cpumask_var(priv->cpus);
return ret;
}
@@ -305,8 +304,7 @@ static void dt_cpufreq_release(void)
dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &priv->freq_table);
if (priv->have_static_opps)
dev_pm_opp_of_cpumask_remove_table(priv->cpus);
- if (priv->opp_table)
- dev_pm_opp_put_regulators(priv->opp_table);
+ dev_pm_opp_put_regulators(priv->opp_table);
free_cpumask_var(priv->cpus);
list_del(&priv->node);
}
--
2.25.0.rc1.19.g042ed3e048af

2020-11-06 07:07:24

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH 3/7] cpufreq: qcom-cpufreq-nvmem: dev_pm_opp_put_*() accepts NULL argument

The dev_pm_opp_put_*() APIs now accepts a NULL opp_table pointer and so
there is no need for us to carry the extra checks. Drop them.

Signed-off-by: Viresh Kumar <[email protected]>
---
drivers/cpufreq/qcom-cpufreq-nvmem.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
index d06b37822c3d..747d602f221e 100644
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
@@ -397,19 +397,19 @@ static int qcom_cpufreq_probe(struct platform_device *pdev)

free_genpd_opp:
for_each_possible_cpu(cpu) {
- if (IS_ERR_OR_NULL(drv->genpd_opp_tables[cpu]))
+ if (IS_ERR(drv->genpd_opp_tables[cpu]))
break;
dev_pm_opp_detach_genpd(drv->genpd_opp_tables[cpu]);
}
kfree(drv->genpd_opp_tables);
free_opp:
for_each_possible_cpu(cpu) {
- if (IS_ERR_OR_NULL(drv->names_opp_tables[cpu]))
+ if (IS_ERR(drv->names_opp_tables[cpu]))
break;
dev_pm_opp_put_prop_name(drv->names_opp_tables[cpu]);
}
for_each_possible_cpu(cpu) {
- if (IS_ERR_OR_NULL(drv->hw_opp_tables[cpu]))
+ if (IS_ERR(drv->hw_opp_tables[cpu]))
break;
dev_pm_opp_put_supported_hw(drv->hw_opp_tables[cpu]);
}
@@ -430,12 +430,9 @@ static int qcom_cpufreq_remove(struct platform_device *pdev)
platform_device_unregister(cpufreq_dt_pdev);

for_each_possible_cpu(cpu) {
- if (drv->names_opp_tables[cpu])
- dev_pm_opp_put_supported_hw(drv->names_opp_tables[cpu]);
- if (drv->hw_opp_tables[cpu])
- dev_pm_opp_put_supported_hw(drv->hw_opp_tables[cpu]);
- if (drv->genpd_opp_tables[cpu])
- dev_pm_opp_detach_genpd(drv->genpd_opp_tables[cpu]);
+ dev_pm_opp_put_supported_hw(drv->names_opp_tables[cpu]);
+ dev_pm_opp_put_supported_hw(drv->hw_opp_tables[cpu]);
+ dev_pm_opp_detach_genpd(drv->genpd_opp_tables[cpu]);
}

kfree(drv->names_opp_tables);
--
2.25.0.rc1.19.g042ed3e048af

2020-11-06 07:07:26

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH 4/7] devfreq: exynos: dev_pm_opp_put_*() accepts NULL argument

The dev_pm_opp_put_*() APIs now accepts a NULL opp_table pointer and so
there is no need for us to carry the extra check. Drop them.

Signed-off-by: Viresh Kumar <[email protected]>
---
drivers/devfreq/exynos-bus.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
index 1e684a448c9e..143fd58ec3dc 100644
--- a/drivers/devfreq/exynos-bus.c
+++ b/drivers/devfreq/exynos-bus.c
@@ -158,10 +158,8 @@ static void exynos_bus_exit(struct device *dev)

dev_pm_opp_of_remove_table(dev);
clk_disable_unprepare(bus->clk);
- if (bus->opp_table) {
- dev_pm_opp_put_regulators(bus->opp_table);
- bus->opp_table = NULL;
- }
+ dev_pm_opp_put_regulators(bus->opp_table);
+ bus->opp_table = NULL;
}

static void exynos_bus_passive_exit(struct device *dev)
@@ -444,10 +442,8 @@ static int exynos_bus_probe(struct platform_device *pdev)
dev_pm_opp_of_remove_table(dev);
clk_disable_unprepare(bus->clk);
err_reg:
- if (!passive) {
- dev_pm_opp_put_regulators(bus->opp_table);
- bus->opp_table = NULL;
- }
+ dev_pm_opp_put_regulators(bus->opp_table);
+ bus->opp_table = NULL;

return ret;
}
--
2.25.0.rc1.19.g042ed3e048af

2020-11-06 07:07:49

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH 6/7] drm/panfrost: dev_pm_opp_put_*() accepts NULL argument

The dev_pm_opp_put_*() APIs now accepts a NULL opp_table pointer and so
there is no need for us to carry the extra check. Drop them.

Signed-off-by: Viresh Kumar <[email protected]>
---
drivers/gpu/drm/panfrost/panfrost_devfreq.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
index 8ab025d0035f..97b5abc7c188 100644
--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
@@ -170,10 +170,8 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev)
pfdevfreq->opp_of_table_added = false;
}

- if (pfdevfreq->regulators_opp_table) {
- dev_pm_opp_put_regulators(pfdevfreq->regulators_opp_table);
- pfdevfreq->regulators_opp_table = NULL;
- }
+ dev_pm_opp_put_regulators(pfdevfreq->regulators_opp_table);
+ pfdevfreq->regulators_opp_table = NULL;
}

void panfrost_devfreq_resume(struct panfrost_device *pfdev)
--
2.25.0.rc1.19.g042ed3e048af

2020-11-06 07:07:50

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH 7/7] media: venus: dev_pm_opp_put_*() accepts NULL argument

The dev_pm_opp_put_*() APIs now accepts a NULL opp_table pointer and so
there is no need for us to carry the extra check. Drop them.

Signed-off-by: Viresh Kumar <[email protected]>
---
drivers/media/platform/qcom/venus/pm_helpers.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
index 57877eacecf0..e1e9130288ad 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -898,8 +898,7 @@ static void core_put_v4(struct device *dev)

if (core->has_opp_table)
dev_pm_opp_of_remove_table(dev);
- if (core->opp_table)
- dev_pm_opp_put_clkname(core->opp_table);
+ dev_pm_opp_put_clkname(core->opp_table);

}

--
2.25.0.rc1.19.g042ed3e048af

2020-11-06 07:10:23

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH 5/7] drm/lima: dev_pm_opp_put_*() accepts NULL argument

The dev_pm_opp_put_*() APIs now accepts a NULL opp_table pointer and so
there is no need for us to carry the extra check. Drop them.

Signed-off-by: Viresh Kumar <[email protected]>
---
drivers/gpu/drm/lima/lima_devfreq.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/lima/lima_devfreq.c b/drivers/gpu/drm/lima/lima_devfreq.c
index bbe02817721b..e7b7b8dfd792 100644
--- a/drivers/gpu/drm/lima/lima_devfreq.c
+++ b/drivers/gpu/drm/lima/lima_devfreq.c
@@ -110,15 +110,10 @@ void lima_devfreq_fini(struct lima_device *ldev)
devfreq->opp_of_table_added = false;
}

- if (devfreq->regulators_opp_table) {
- dev_pm_opp_put_regulators(devfreq->regulators_opp_table);
- devfreq->regulators_opp_table = NULL;
- }
-
- if (devfreq->clkname_opp_table) {
- dev_pm_opp_put_clkname(devfreq->clkname_opp_table);
- devfreq->clkname_opp_table = NULL;
- }
+ dev_pm_opp_put_regulators(devfreq->regulators_opp_table);
+ dev_pm_opp_put_clkname(devfreq->clkname_opp_table);
+ devfreq->regulators_opp_table = NULL;
+ devfreq->clkname_opp_table = NULL;
}

int lima_devfreq_init(struct lima_device *ldev)
--
2.25.0.rc1.19.g042ed3e048af

2020-11-06 07:31:12

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH 4/7] devfreq: exynos: dev_pm_opp_put_*() accepts NULL argument

Hi Viresh,

On 11/6/20 4:03 PM, Viresh Kumar wrote:
> The dev_pm_opp_put_*() APIs now accepts a NULL opp_table pointer and so
> there is no need for us to carry the extra check. Drop them.
>
> Signed-off-by: Viresh Kumar <[email protected]>
> ---
> drivers/devfreq/exynos-bus.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
> index 1e684a448c9e..143fd58ec3dc 100644
> --- a/drivers/devfreq/exynos-bus.c
> +++ b/drivers/devfreq/exynos-bus.c
> @@ -158,10 +158,8 @@ static void exynos_bus_exit(struct device *dev)
>
> dev_pm_opp_of_remove_table(dev);
> clk_disable_unprepare(bus->clk);
> - if (bus->opp_table) {
> - dev_pm_opp_put_regulators(bus->opp_table);
> - bus->opp_table = NULL;
> - }
> + dev_pm_opp_put_regulators(bus->opp_table);
> + bus->opp_table = NULL;
> }
>
> static void exynos_bus_passive_exit(struct device *dev)
> @@ -444,10 +442,8 @@ static int exynos_bus_probe(struct platform_device *pdev)
> dev_pm_opp_of_remove_table(dev);
> clk_disable_unprepare(bus->clk);
> err_reg:
> - if (!passive) {
> - dev_pm_opp_put_regulators(bus->opp_table);
> - bus->opp_table = NULL;
> - }
> + dev_pm_opp_put_regulators(bus->opp_table);
> + bus->opp_table = NULL;
>
> return ret;
> }
>

Applied it. Thanks.

--
Best Regards,
Chanwoo Choi
Samsung Electronics

2020-11-06 07:35:39

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH 4/7] devfreq: exynos: dev_pm_opp_put_*() accepts NULL argument

On 11/6/20 4:42 PM, Chanwoo Choi wrote:
> Hi Viresh,
>
> On 11/6/20 4:03 PM, Viresh Kumar wrote:
>> The dev_pm_opp_put_*() APIs now accepts a NULL opp_table pointer and so
>> there is no need for us to carry the extra check. Drop them.
>>
>> Signed-off-by: Viresh Kumar <[email protected]>
>> ---
>> drivers/devfreq/exynos-bus.c | 12 ++++--------
>> 1 file changed, 4 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
>> index 1e684a448c9e..143fd58ec3dc 100644
>> --- a/drivers/devfreq/exynos-bus.c
>> +++ b/drivers/devfreq/exynos-bus.c
>> @@ -158,10 +158,8 @@ static void exynos_bus_exit(struct device *dev)
>>
>> dev_pm_opp_of_remove_table(dev);
>> clk_disable_unprepare(bus->clk);
>> - if (bus->opp_table) {
>> - dev_pm_opp_put_regulators(bus->opp_table);
>> - bus->opp_table = NULL;
>> - }
>> + dev_pm_opp_put_regulators(bus->opp_table);
>> + bus->opp_table = NULL;
>> }
>>
>> static void exynos_bus_passive_exit(struct device *dev)
>> @@ -444,10 +442,8 @@ static int exynos_bus_probe(struct platform_device *pdev)
>> dev_pm_opp_of_remove_table(dev);
>> clk_disable_unprepare(bus->clk);
>> err_reg:
>> - if (!passive) {
>> - dev_pm_opp_put_regulators(bus->opp_table);
>> - bus->opp_table = NULL;
>> - }
>> + dev_pm_opp_put_regulators(bus->opp_table);
>> + bus->opp_table = NULL;
>>
>> return ret;
>> }
>>
>
> Applied it. Thanks.
>

It seems that this patch depends on first patch.
So, need to be merged to one git repository.

Instead of applying it to devfreq.git,
Acked-by: Chanwoo Choi <[email protected]>

--
Best Regards,
Chanwoo Choi
Samsung Electronics

2020-11-06 07:37:20

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH 4/7] devfreq: exynos: dev_pm_opp_put_*() accepts NULL argument

On 11/6/20 4:46 PM, Chanwoo Choi wrote:
> On 11/6/20 4:42 PM, Chanwoo Choi wrote:
>> Hi Viresh,
>>
>> On 11/6/20 4:03 PM, Viresh Kumar wrote:
>>> The dev_pm_opp_put_*() APIs now accepts a NULL opp_table pointer and so
>>> there is no need for us to carry the extra check. Drop them.
>>>
>>> Signed-off-by: Viresh Kumar <[email protected]>
>>> ---
>>> drivers/devfreq/exynos-bus.c | 12 ++++--------
>>> 1 file changed, 4 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
>>> index 1e684a448c9e..143fd58ec3dc 100644
>>> --- a/drivers/devfreq/exynos-bus.c
>>> +++ b/drivers/devfreq/exynos-bus.c
>>> @@ -158,10 +158,8 @@ static void exynos_bus_exit(struct device *dev)
>>>
>>> dev_pm_opp_of_remove_table(dev);
>>> clk_disable_unprepare(bus->clk);
>>> - if (bus->opp_table) {
>>> - dev_pm_opp_put_regulators(bus->opp_table);
>>> - bus->opp_table = NULL;
>>> - }
>>> + dev_pm_opp_put_regulators(bus->opp_table);
>>> + bus->opp_table = NULL;
>>> }
>>>
>>> static void exynos_bus_passive_exit(struct device *dev)
>>> @@ -444,10 +442,8 @@ static int exynos_bus_probe(struct platform_device *pdev)
>>> dev_pm_opp_of_remove_table(dev);
>>> clk_disable_unprepare(bus->clk);
>>> err_reg:
>>> - if (!passive) {
>>> - dev_pm_opp_put_regulators(bus->opp_table);
>>> - bus->opp_table = NULL;
>>> - }
>>> + dev_pm_opp_put_regulators(bus->opp_table);
>>> + bus->opp_table = NULL;
>>>
>>> return ret;
>>> }
>>>
>>
>> Applied it. Thanks.
>>
>
> It seems that this patch depends on first patch.
> So, need to be merged to one git repository.
>
> Instead of applying it to devfreq.git,
> Acked-by: Chanwoo Choi <[email protected]>
>

Also, need to add 'PM /' prefix to patch title
in order to keep the same format with already merged devfreq patches.
- 'PM / devfreq: exynos: dev_pm_opp_put_*() accepts NULL argument'

--
Best Regards,
Chanwoo Choi
Samsung Electronics

2020-11-06 07:48:48

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH 4/7] devfreq: exynos: dev_pm_opp_put_*() accepts NULL argument

On 06-11-20, 16:48, Chanwoo Choi wrote:
> On 11/6/20 4:46 PM, Chanwoo Choi wrote:
> > It seems that this patch depends on first patch.
> > So, need to be merged to one git repository.
> >
> > Instead of applying it to devfreq.git,
> > Acked-by: Chanwoo Choi <[email protected]>
> >
>
> Also, need to add 'PM /' prefix to patch title
> in order to keep the same format with already merged devfreq patches.
> - 'PM / devfreq: exynos: dev_pm_opp_put_*() accepts NULL argument'

Done, thanks.

--
viresh

2020-11-08 09:28:32

by Ilia Lin

[permalink] [raw]
Subject: Re: [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table

Reviewed-by: Ilia Lin <[email protected]>


On Fri, Nov 6, 2020 at 9:05 AM Viresh Kumar <[email protected]> wrote:
>
> Hello,
>
> This patchset updates the dev_pm_opp_put_*() helpers to accept a NULL
> pointer for the OPP table, in order to allow the callers to drop the
> unnecessary checks they had to carry.
>
> All these must get merged upstream through the OPP tree as there is a
> hard dependency on the first patch here. Thanks.
>
> Viresh Kumar (7):
> opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table
> cpufreq: dt: dev_pm_opp_put_regulators() accepts NULL argument
> cpufreq: qcom-cpufreq-nvmem: dev_pm_opp_put_*() accepts NULL argument
> devfreq: exynos: dev_pm_opp_put_*() accepts NULL argument
> drm/lima: dev_pm_opp_put_*() accepts NULL argument
> drm/panfrost: dev_pm_opp_put_*() accepts NULL argument
> media: venus: dev_pm_opp_put_*() accepts NULL argument
>
> drivers/cpufreq/cpufreq-dt.c | 6 ++----
> drivers/cpufreq/qcom-cpufreq-nvmem.c | 15 ++++++---------
> drivers/devfreq/exynos-bus.c | 12 ++++--------
> drivers/gpu/drm/lima/lima_devfreq.c | 13 ++++---------
> drivers/gpu/drm/panfrost/panfrost_devfreq.c | 6 ++----
> drivers/media/platform/qcom/venus/pm_helpers.c | 3 +--
> drivers/opp/core.c | 18 ++++++++++++++++++
> 7 files changed, 37 insertions(+), 36 deletions(-)
>
> --
> 2.25.0.rc1.19.g042ed3e048af
>

2020-11-08 09:29:37

by Ilia Lin

[permalink] [raw]
Subject: Re: [PATCH 3/7] cpufreq: qcom-cpufreq-nvmem: dev_pm_opp_put_*() accepts NULL argument

Reviewed-by: Ilia Lin <[email protected]>

On Fri, Nov 6, 2020 at 9:05 AM Viresh Kumar <[email protected]> wrote:
>
> The dev_pm_opp_put_*() APIs now accepts a NULL opp_table pointer and so
> there is no need for us to carry the extra checks. Drop them.
>
> Signed-off-by: Viresh Kumar <[email protected]>
> ---
> drivers/cpufreq/qcom-cpufreq-nvmem.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> index d06b37822c3d..747d602f221e 100644
> --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
> +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> @@ -397,19 +397,19 @@ static int qcom_cpufreq_probe(struct platform_device *pdev)
>
> free_genpd_opp:
> for_each_possible_cpu(cpu) {
> - if (IS_ERR_OR_NULL(drv->genpd_opp_tables[cpu]))
> + if (IS_ERR(drv->genpd_opp_tables[cpu]))
> break;
> dev_pm_opp_detach_genpd(drv->genpd_opp_tables[cpu]);
> }
> kfree(drv->genpd_opp_tables);
> free_opp:
> for_each_possible_cpu(cpu) {
> - if (IS_ERR_OR_NULL(drv->names_opp_tables[cpu]))
> + if (IS_ERR(drv->names_opp_tables[cpu]))
> break;
> dev_pm_opp_put_prop_name(drv->names_opp_tables[cpu]);
> }
> for_each_possible_cpu(cpu) {
> - if (IS_ERR_OR_NULL(drv->hw_opp_tables[cpu]))
> + if (IS_ERR(drv->hw_opp_tables[cpu]))
> break;
> dev_pm_opp_put_supported_hw(drv->hw_opp_tables[cpu]);
> }
> @@ -430,12 +430,9 @@ static int qcom_cpufreq_remove(struct platform_device *pdev)
> platform_device_unregister(cpufreq_dt_pdev);
>
> for_each_possible_cpu(cpu) {
> - if (drv->names_opp_tables[cpu])
> - dev_pm_opp_put_supported_hw(drv->names_opp_tables[cpu]);
> - if (drv->hw_opp_tables[cpu])
> - dev_pm_opp_put_supported_hw(drv->hw_opp_tables[cpu]);
> - if (drv->genpd_opp_tables[cpu])
> - dev_pm_opp_detach_genpd(drv->genpd_opp_tables[cpu]);
> + dev_pm_opp_put_supported_hw(drv->names_opp_tables[cpu]);
> + dev_pm_opp_put_supported_hw(drv->hw_opp_tables[cpu]);
> + dev_pm_opp_detach_genpd(drv->genpd_opp_tables[cpu]);
> }
>
> kfree(drv->names_opp_tables);
> --
> 2.25.0.rc1.19.g042ed3e048af
>

2020-11-09 09:20:08

by Steven Price

[permalink] [raw]
Subject: Re: [PATCH 6/7] drm/panfrost: dev_pm_opp_put_*() accepts NULL argument

On 06/11/2020 07:03, Viresh Kumar wrote:
> The dev_pm_opp_put_*() APIs now accepts a NULL opp_table pointer and so
> there is no need for us to carry the extra check. Drop them.
>
> Signed-off-by: Viresh Kumar <[email protected]>

Reviewed-by: Steven Price <[email protected]>

> ---
> drivers/gpu/drm/panfrost/panfrost_devfreq.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> index 8ab025d0035f..97b5abc7c188 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> @@ -170,10 +170,8 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev)
> pfdevfreq->opp_of_table_added = false;
> }
>
> - if (pfdevfreq->regulators_opp_table) {
> - dev_pm_opp_put_regulators(pfdevfreq->regulators_opp_table);
> - pfdevfreq->regulators_opp_table = NULL;
> - }
> + dev_pm_opp_put_regulators(pfdevfreq->regulators_opp_table);
> + pfdevfreq->regulators_opp_table = NULL;
> }
>
> void panfrost_devfreq_resume(struct panfrost_device *pfdev)
>

2020-11-16 03:05:28

by Qiang Yu

[permalink] [raw]
Subject: Re: [PATCH 5/7] drm/lima: dev_pm_opp_put_*() accepts NULL argument

Looks good for me, patch is:
Reviewed-by: Qiang Yu <[email protected]>

Regards,
Qiang

On Fri, Nov 6, 2020 at 3:05 PM Viresh Kumar <[email protected]> wrote:
>
> The dev_pm_opp_put_*() APIs now accepts a NULL opp_table pointer and so
> there is no need for us to carry the extra check. Drop them.
>
> Signed-off-by: Viresh Kumar <[email protected]>
> ---
> drivers/gpu/drm/lima/lima_devfreq.c | 13 ++++---------
> 1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/lima/lima_devfreq.c b/drivers/gpu/drm/lima/lima_devfreq.c
> index bbe02817721b..e7b7b8dfd792 100644
> --- a/drivers/gpu/drm/lima/lima_devfreq.c
> +++ b/drivers/gpu/drm/lima/lima_devfreq.c
> @@ -110,15 +110,10 @@ void lima_devfreq_fini(struct lima_device *ldev)
> devfreq->opp_of_table_added = false;
> }
>
> - if (devfreq->regulators_opp_table) {
> - dev_pm_opp_put_regulators(devfreq->regulators_opp_table);
> - devfreq->regulators_opp_table = NULL;
> - }
> -
> - if (devfreq->clkname_opp_table) {
> - dev_pm_opp_put_clkname(devfreq->clkname_opp_table);
> - devfreq->clkname_opp_table = NULL;
> - }
> + dev_pm_opp_put_regulators(devfreq->regulators_opp_table);
> + dev_pm_opp_put_clkname(devfreq->clkname_opp_table);
> + devfreq->regulators_opp_table = NULL;
> + devfreq->clkname_opp_table = NULL;
> }
>
> int lima_devfreq_init(struct lima_device *ldev)
> --
> 2.25.0.rc1.19.g042ed3e048af
>