Skip to contentSkip to conversation

opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table

PATCH Applied Viresh Kumar 6 participants 16 messages Nov 6, 2020 – Nov 16, 2020

Subsystems (14)
lore
Share & tools
lore

Viresh Kumar

author maintainer
#0 lore raw

cover 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(-)
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
author maintainer
#1 lore raw

PATCH 1/7 opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table

This allows the callers to drop the unnecessary checks.

---
 drivers/opp/core.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/opp/core.c +18 -0
index b24f685823ae..9d145bb99a59 100644
@@ -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.
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
author maintainer
#2 lore raw

PATCH 2/7 cpufreq: dt: dev_pm_opp_put_regulators() accepts NULL argument

In reply to Viresh Kumar

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.

---
 drivers/cpufreq/cpufreq-dt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/cpufreq/cpufreq-dt.c +2 -4
index 66b3db5efb53..5c049428a6f5 100644
@@ -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);
 	}
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
author maintainer
#3 lore raw

PATCH 3/7 cpufreq: qcom-cpufreq-nvmem: dev_pm_opp_put_*() accepts NULL argument

In reply to Viresh Kumar

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.

---
 drivers/cpufreq/qcom-cpufreq-nvmem.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/cpufreq/qcom-cpufreq-nvmem.c +6 -9
index d06b37822c3d..747d602f221e 100644
@@ -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);
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
author maintainer
#5 lore raw

PATCH 4/7 devfreq: exynos: dev_pm_opp_put_*() accepts NULL argument

In reply to Viresh Kumar

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.

---
 drivers/devfreq/exynos-bus.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/devfreq/exynos-bus.c +4 -8
index 1e684a448c9e..143fd58ec3dc 100644
@@ -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;
 }
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
author maintainer
#10 lore raw

PATCH 5/7 drm/lima: dev_pm_opp_put_*() accepts NULL argument

In reply to Viresh Kumar

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.

---
 drivers/gpu/drm/lima/lima_devfreq.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/lima/lima_devfreq.c +4 -9
index bbe02817721b..e7b7b8dfd792 100644
@@ -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)
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
author maintainer
#12 lore raw

PATCH 6/7 drm/panfrost: dev_pm_opp_put_*() accepts NULL argument

In reply to Viresh Kumar

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.

---
 drivers/gpu/drm/panfrost/panfrost_devfreq.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/panfrost/panfrost_devfreq.c +2 -4
index 8ab025d0035f..97b5abc7c188 100644
@@ -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)
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
author maintainer
#14 lore raw

PATCH 7/7 media: venus: dev_pm_opp_put_*() accepts NULL argument

In reply to Viresh Kumar

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.

---
 drivers/media/platform/qcom/venus/pm_helpers.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/qcom/venus/pm_helpers.c +1 -2
index 57877eacecf0..e1e9130288ad 100644
@@ -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);
 
 }
 
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
maintainer Applied
#6 lore raw

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

In reply to Viresh Kumar

Hi Viresh,

Quoted 29 lines · Viresh Kumar

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.

---
 drivers/devfreq/exynos-bus.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/devfreq/exynos-bus.c +2 -4
index 1e684a448c9e..143fd58ec3dc 100644
@@ -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);

drivers/devfreq/exynos-bus.c static int exynos_bus_probe(struct platform_device *pdev) · line 449

Quoted 10 lines
drivers/devfreq/exynos-bus.c +2 -4
 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.

Signature · 3 lines
Best Regards,
Chanwoo Choi
Samsung Electronics
maintainer Acked-by
#7 lore raw

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

Quoted 39 lines · Chanwoo Choi

Hi Viresh,

Quoted 36 lines · Viresh Kumar

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.

---
 drivers/devfreq/exynos-bus.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/devfreq/exynos-bus.c +4 -8
index 1e684a448c9e..143fd58ec3dc 100644
@@ -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;
 
Quoted 6 lines

drivers/devfreq/exynos-bus.c static int exynos_bus_probe(struct platform_device *pdev) · line 449

Quoted 3 lines
drivers/devfreq/exynos-bus.c +0 -0
 	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,

Signature · 3 lines
Best Regards,
Chanwoo Choi
Samsung Electronics
maintainer
#8 lore raw

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

Quoted 47 lines · Chanwoo Choi
Quoted 39 lines · Chanwoo Choi

Hi Viresh,

Quoted 36 lines · Viresh Kumar

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.

---
 drivers/devfreq/exynos-bus.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/devfreq/exynos-bus.c +4 -8
index 1e684a448c9e..143fd58ec3dc 100644
@@ -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;
 
Quoted 6 lines

drivers/devfreq/exynos-bus.c static int exynos_bus_probe(struct platform_device *pdev) · line 449

Quoted 3 lines
drivers/devfreq/exynos-bus.c +0 -0
 	return ret;
 }

Applied it. Thanks.

Quoted 6 lines

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,

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'

Signature · 3 lines
Best Regards,
Chanwoo Choi
Samsung Electronics
author maintainer
#9 lore raw

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

Quoted 11 lines · Chanwoo Choi
Quoted 6 lines · Chanwoo Choi

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,

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.

Signature · 1 line
viresh
maintainer Reviewed-by on the v1 series
#15 lore raw
In reply to Viresh Kumar
Quoted 28 lines · Viresh Kumar

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(-)
Quoted 3 lines

--
2.25.0.rc1.19.g042ed3e048af

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 3/7
#4 lore raw

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

In reply to Viresh Kumar
Quoted 55 lines · Viresh Kumar

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.

---
 drivers/cpufreq/qcom-cpufreq-nvmem.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/cpufreq/qcom-cpufreq-nvmem.c +6 -10
index d06b37822c3d..747d602f221e 100644
@@ -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

maintainer Reviewed-by on v1 6/7
#13 lore raw

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

In reply to Viresh Kumar
Quoted 4 lines · Viresh Kumar

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.

Quoted 22 lines
---
  drivers/gpu/drm/panfrost/panfrost_devfreq.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/panfrost/panfrost_devfreq.c +2 -4
index 8ab025d0035f..97b5abc7c188 100644
@@ -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)
maintainer Reviewed-by on v1 5/7
#11 lore raw

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

In reply to Viresh Kumar

Looks good for me, patch is:

Regards,
Qiang

Quoted 36 lines · Viresh Kumar

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.

---
 drivers/gpu/drm/lima/lima_devfreq.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/lima/lima_devfreq.c +4 -10
index bbe02817721b..e7b7b8dfd792 100644
@@ -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