linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table
@ 2020-11-06  7:03 Viresh Kumar
  2020-11-06  7:03 ` [PATCH 1/7] " Viresh Kumar
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Viresh Kumar @ 2020-11-06  7:03 UTC (permalink / raw)
  To: Alyssa Rosenzweig, Andy Gross, Bjorn Andersson, Chanwoo Choi,
	Daniel Vetter, David Airlie, Ilia Lin, Krzysztof Kozlowski,
	Kukjin Kim, Kyungmin Park, MyungJoo Ham, Nishanth Menon,
	Qiang Yu, Rafael J. Wysocki, Rob Herring, Stanimir Varbanov,
	Stephen Boyd, Steven Price, Tomeu Vizoso, Viresh Kumar,
	Viresh Kumar
  Cc: linux-pm, Vincent Guittot, digetx, dri-devel, lima,
	linux-arm-kernel, linux-arm-msm, linux-kernel, linux-media,
	linux-samsung-soc

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table
  2020-11-06  7:03 [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table Viresh Kumar
@ 2020-11-06  7:03 ` Viresh Kumar
  2020-11-06  7:03 ` [PATCH 2/7] cpufreq: dt: dev_pm_opp_put_regulators() accepts NULL argument Viresh Kumar
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2020-11-06  7:03 UTC (permalink / raw)
  To: Viresh Kumar, Nishanth Menon, Stephen Boyd
  Cc: Viresh Kumar, linux-pm, Vincent Guittot, Rafael Wysocki, digetx,
	linux-kernel

This allows the callers to drop the unnecessary checks.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/7] cpufreq: dt: dev_pm_opp_put_regulators() accepts NULL argument
  2020-11-06  7:03 [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table Viresh Kumar
  2020-11-06  7:03 ` [PATCH 1/7] " Viresh Kumar
@ 2020-11-06  7:03 ` Viresh Kumar
  2020-11-06  7:03 ` [PATCH 3/7] cpufreq: qcom-cpufreq-nvmem: dev_pm_opp_put_*() " Viresh Kumar
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2020-11-06  7:03 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar
  Cc: linux-pm, Vincent Guittot, Stephen Boyd, Nishanth Menon, digetx,
	linux-kernel

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 <viresh.kumar@linaro.org>
---
 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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/7] cpufreq: qcom-cpufreq-nvmem: dev_pm_opp_put_*() accepts NULL argument
  2020-11-06  7:03 [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table Viresh Kumar
  2020-11-06  7:03 ` [PATCH 1/7] " Viresh Kumar
  2020-11-06  7:03 ` [PATCH 2/7] cpufreq: dt: dev_pm_opp_put_regulators() accepts NULL argument Viresh Kumar
@ 2020-11-06  7:03 ` Viresh Kumar
  2020-11-08  9:27   ` Ilia Lin
  2020-11-06  7:03 ` [PATCH 4/7] devfreq: exynos: " Viresh Kumar
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Viresh Kumar @ 2020-11-06  7:03 UTC (permalink / raw)
  To: Ilia Lin, Andy Gross, Bjorn Andersson, Rafael J. Wysocki, Viresh Kumar
  Cc: linux-pm, Vincent Guittot, Stephen Boyd, Nishanth Menon, digetx,
	linux-arm-msm, linux-kernel

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 <viresh.kumar@linaro.org>
---
 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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 4/7] devfreq: exynos: dev_pm_opp_put_*() accepts NULL argument
  2020-11-06  7:03 [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table Viresh Kumar
                   ` (2 preceding siblings ...)
  2020-11-06  7:03 ` [PATCH 3/7] cpufreq: qcom-cpufreq-nvmem: dev_pm_opp_put_*() " Viresh Kumar
@ 2020-11-06  7:03 ` Viresh Kumar
  2020-11-06  7:42   ` Chanwoo Choi
  2020-11-06  7:03 ` [PATCH 5/7] drm/lima: " Viresh Kumar
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Viresh Kumar @ 2020-11-06  7:03 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, Kyungmin Park, Kukjin Kim,
	Krzysztof Kozlowski
  Cc: Viresh Kumar, linux-pm, Vincent Guittot, Rafael Wysocki,
	Stephen Boyd, Nishanth Menon, digetx, linux-samsung-soc,
	linux-arm-kernel, linux-kernel

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 <viresh.kumar@linaro.org>
---
 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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 5/7] drm/lima: dev_pm_opp_put_*() accepts NULL argument
  2020-11-06  7:03 [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table Viresh Kumar
                   ` (3 preceding siblings ...)
  2020-11-06  7:03 ` [PATCH 4/7] devfreq: exynos: " Viresh Kumar
@ 2020-11-06  7:03 ` Viresh Kumar
  2020-11-16  0:42   ` Qiang Yu
  2020-11-06  7:03 ` [PATCH 6/7] drm/panfrost: " Viresh Kumar
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Viresh Kumar @ 2020-11-06  7:03 UTC (permalink / raw)
  To: Qiang Yu, David Airlie, Daniel Vetter
  Cc: Viresh Kumar, linux-pm, Vincent Guittot, Rafael Wysocki,
	Stephen Boyd, Nishanth Menon, digetx, dri-devel, lima,
	linux-kernel

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 <viresh.kumar@linaro.org>
---
 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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 6/7] drm/panfrost: dev_pm_opp_put_*() accepts NULL argument
  2020-11-06  7:03 [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table Viresh Kumar
                   ` (4 preceding siblings ...)
  2020-11-06  7:03 ` [PATCH 5/7] drm/lima: " Viresh Kumar
@ 2020-11-06  7:03 ` Viresh Kumar
  2020-11-09  9:17   ` Steven Price
  2020-11-06  7:03 ` [PATCH 7/7] media: venus: " Viresh Kumar
  2020-11-08  9:25 ` [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table Ilia Lin
  7 siblings, 1 reply; 16+ messages in thread
From: Viresh Kumar @ 2020-11-06  7:03 UTC (permalink / raw)
  To: Rob Herring, Tomeu Vizoso, Steven Price, Alyssa Rosenzweig,
	David Airlie, Daniel Vetter
  Cc: Viresh Kumar, linux-pm, Vincent Guittot, Rafael Wysocki,
	Stephen Boyd, Nishanth Menon, digetx, dri-devel, linux-kernel

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 <viresh.kumar@linaro.org>
---
 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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 7/7] media: venus: dev_pm_opp_put_*() accepts NULL argument
  2020-11-06  7:03 [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table Viresh Kumar
                   ` (5 preceding siblings ...)
  2020-11-06  7:03 ` [PATCH 6/7] drm/panfrost: " Viresh Kumar
@ 2020-11-06  7:03 ` Viresh Kumar
  2020-11-08  9:25 ` [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table Ilia Lin
  7 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2020-11-06  7:03 UTC (permalink / raw)
  To: Stanimir Varbanov, Andy Gross, Bjorn Andersson
  Cc: Viresh Kumar, linux-pm, Vincent Guittot, Rafael Wysocki,
	Stephen Boyd, Nishanth Menon, digetx, linux-media, linux-arm-msm,
	linux-kernel

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 <viresh.kumar@linaro.org>
---
 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


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/7] devfreq: exynos: dev_pm_opp_put_*() accepts NULL argument
  2020-11-06  7:03 ` [PATCH 4/7] devfreq: exynos: " Viresh Kumar
@ 2020-11-06  7:42   ` Chanwoo Choi
  2020-11-06  7:46     ` Chanwoo Choi
  0 siblings, 1 reply; 16+ messages in thread
From: Chanwoo Choi @ 2020-11-06  7:42 UTC (permalink / raw)
  To: Viresh Kumar, MyungJoo Ham, Kyungmin Park, Kukjin Kim,
	Krzysztof Kozlowski
  Cc: linux-pm, Vincent Guittot, Rafael Wysocki, Stephen Boyd,
	Nishanth Menon, digetx, linux-samsung-soc, linux-arm-kernel,
	linux-kernel

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 <viresh.kumar@linaro.org>
> ---
>  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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/7] devfreq: exynos: dev_pm_opp_put_*() accepts NULL argument
  2020-11-06  7:42   ` Chanwoo Choi
@ 2020-11-06  7:46     ` Chanwoo Choi
  2020-11-06  7:48       ` Chanwoo Choi
  0 siblings, 1 reply; 16+ messages in thread
From: Chanwoo Choi @ 2020-11-06  7:46 UTC (permalink / raw)
  To: Viresh Kumar, MyungJoo Ham, Kyungmin Park, Kukjin Kim,
	Krzysztof Kozlowski
  Cc: linux-pm, Vincent Guittot, Rafael Wysocki, Stephen Boyd,
	Nishanth Menon, digetx, linux-samsung-soc, linux-arm-kernel,
	linux-kernel

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 <viresh.kumar@linaro.org>
>> ---
>>  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 <cw00.choi@samsung.com>

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/7] devfreq: exynos: dev_pm_opp_put_*() accepts NULL argument
  2020-11-06  7:48       ` Chanwoo Choi
@ 2020-11-06  7:46         ` Viresh Kumar
  0 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2020-11-06  7:46 UTC (permalink / raw)
  To: Chanwoo Choi
  Cc: MyungJoo Ham, Kyungmin Park, Kukjin Kim, Krzysztof Kozlowski,
	linux-pm, Vincent Guittot, Rafael Wysocki, Stephen Boyd,
	Nishanth Menon, digetx, linux-samsung-soc, linux-arm-kernel,
	linux-kernel

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 <cw00.choi@samsung.com>
> > 
> 
> 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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/7] devfreq: exynos: dev_pm_opp_put_*() accepts NULL argument
  2020-11-06  7:46     ` Chanwoo Choi
@ 2020-11-06  7:48       ` Chanwoo Choi
  2020-11-06  7:46         ` Viresh Kumar
  0 siblings, 1 reply; 16+ messages in thread
From: Chanwoo Choi @ 2020-11-06  7:48 UTC (permalink / raw)
  To: Viresh Kumar, MyungJoo Ham, Kyungmin Park, Kukjin Kim,
	Krzysztof Kozlowski
  Cc: linux-pm, Vincent Guittot, Rafael Wysocki, Stephen Boyd,
	Nishanth Menon, digetx, linux-samsung-soc, linux-arm-kernel,
	linux-kernel

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 <viresh.kumar@linaro.org>
>>> ---
>>>  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 <cw00.choi@samsung.com>
> 

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table
  2020-11-06  7:03 [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table Viresh Kumar
                   ` (6 preceding siblings ...)
  2020-11-06  7:03 ` [PATCH 7/7] media: venus: " Viresh Kumar
@ 2020-11-08  9:25 ` Ilia Lin
  7 siblings, 0 replies; 16+ messages in thread
From: Ilia Lin @ 2020-11-08  9:25 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Alyssa Rosenzweig, Andy Gross, Bjorn Andersson, Chanwoo Choi,
	Daniel Vetter, David Airlie, Ilia Lin, Krzysztof Kozlowski,
	Kukjin Kim, Kyungmin Park, MyungJoo Ham, Nishanth Menon,
	Qiang Yu, Rafael J. Wysocki, Rob Herring, Stanimir Varbanov,
	Stephen Boyd, Steven Price, Tomeu Vizoso, Viresh Kumar,
	open list:QUALCOMM CPUFREQ DRIVER MSM8996/APQ8096,
	Vincent Guittot, digetx, dri-devel, lima, linux-arm-kernel,
	open list:ARM/QUALCOMM SUPPORT, open list, linux-media,
	linux-samsung-soc

Reviewed-by: Ilia Lin <ilia.lin@kernel.org>


On Fri, Nov 6, 2020 at 9:05 AM Viresh Kumar <viresh.kumar@linaro.org> 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
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/7] cpufreq: qcom-cpufreq-nvmem: dev_pm_opp_put_*() accepts NULL argument
  2020-11-06  7:03 ` [PATCH 3/7] cpufreq: qcom-cpufreq-nvmem: dev_pm_opp_put_*() " Viresh Kumar
@ 2020-11-08  9:27   ` Ilia Lin
  0 siblings, 0 replies; 16+ messages in thread
From: Ilia Lin @ 2020-11-08  9:27 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Ilia Lin, Andy Gross, Bjorn Andersson, Rafael J. Wysocki,
	open list:QUALCOMM CPUFREQ DRIVER MSM8996/APQ8096,
	Vincent Guittot, Stephen Boyd, Nishanth Menon, digetx,
	open list:ARM/QUALCOMM SUPPORT, open list

Reviewed-by: Ilia Lin <ilia.lin@kernel.org>

On Fri, Nov 6, 2020 at 9:05 AM Viresh Kumar <viresh.kumar@linaro.org> 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 <viresh.kumar@linaro.org>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 6/7] drm/panfrost: dev_pm_opp_put_*() accepts NULL argument
  2020-11-06  7:03 ` [PATCH 6/7] drm/panfrost: " Viresh Kumar
@ 2020-11-09  9:17   ` Steven Price
  0 siblings, 0 replies; 16+ messages in thread
From: Steven Price @ 2020-11-09  9:17 UTC (permalink / raw)
  To: Viresh Kumar, Rob Herring, Tomeu Vizoso, Alyssa Rosenzweig,
	David Airlie, Daniel Vetter
  Cc: linux-pm, Vincent Guittot, Rafael Wysocki, Stephen Boyd,
	Nishanth Menon, digetx, dri-devel, linux-kernel

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 <viresh.kumar@linaro.org>

Reviewed-by: Steven Price <steven.price@arm.com>

> ---
>   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)
> 


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/7] drm/lima: dev_pm_opp_put_*() accepts NULL argument
  2020-11-06  7:03 ` [PATCH 5/7] drm/lima: " Viresh Kumar
@ 2020-11-16  0:42   ` Qiang Yu
  0 siblings, 0 replies; 16+ messages in thread
From: Qiang Yu @ 2020-11-16  0:42 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: David Airlie, Daniel Vetter, linux-pm, Vincent Guittot,
	Rafael Wysocki, Stephen Boyd, Nishanth Menon, digetx, dri-devel,
	lima, Linux Kernel Mailing List

Looks good for me, patch is:
Reviewed-by: Qiang Yu <yuq825@gmail.com>

Regards,
Qiang

On Fri, Nov 6, 2020 at 3:05 PM Viresh Kumar <viresh.kumar@linaro.org> 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 <viresh.kumar@linaro.org>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-11-16  0:42 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06  7:03 [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table Viresh Kumar
2020-11-06  7:03 ` [PATCH 1/7] " Viresh Kumar
2020-11-06  7:03 ` [PATCH 2/7] cpufreq: dt: dev_pm_opp_put_regulators() accepts NULL argument Viresh Kumar
2020-11-06  7:03 ` [PATCH 3/7] cpufreq: qcom-cpufreq-nvmem: dev_pm_opp_put_*() " Viresh Kumar
2020-11-08  9:27   ` Ilia Lin
2020-11-06  7:03 ` [PATCH 4/7] devfreq: exynos: " Viresh Kumar
2020-11-06  7:42   ` Chanwoo Choi
2020-11-06  7:46     ` Chanwoo Choi
2020-11-06  7:48       ` Chanwoo Choi
2020-11-06  7:46         ` Viresh Kumar
2020-11-06  7:03 ` [PATCH 5/7] drm/lima: " Viresh Kumar
2020-11-16  0:42   ` Qiang Yu
2020-11-06  7:03 ` [PATCH 6/7] drm/panfrost: " Viresh Kumar
2020-11-09  9:17   ` Steven Price
2020-11-06  7:03 ` [PATCH 7/7] media: venus: " Viresh Kumar
2020-11-08  9:25 ` [PATCH 0/7] opp: Allow dev_pm_opp_put_*() APIs to accept NULL opp_table Ilia Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).