linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 1/3] cpufreq: cpu0: Release clk and regulator in remove function
  2014-08-28  7:00 [PATCH 1/3] cpufreq: cpu0: Release clk and regulator in remove function Pramod Gurav
@ 2014-08-28  5:30 ` Shawn Guo
  2014-08-28  5:53 ` Viresh Kumar
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Shawn Guo @ 2014-08-28  5:30 UTC (permalink / raw)
  To: Pramod Gurav
  Cc: linux-kernel, linux-arm-msm, linux-pm, Rafael J. Wysocki, Viresh Kumar

On Thu, Aug 28, 2014 at 12:00:10AM -0700, Pramod Gurav wrote:
> This function releases clk and regulator in remove function for clean
> unloading.
> 
> CC: Shawn Guo <shawn.guo@linaro.org>
> CC: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> CC: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
> ---
>  drivers/cpufreq/cpufreq-cpu0.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> index 0d2172b..e1574f8 100644
> --- a/drivers/cpufreq/cpufreq-cpu0.c
> +++ b/drivers/cpufreq/cpufreq-cpu0.c
> @@ -229,6 +229,8 @@ static int cpu0_cpufreq_remove(struct platform_device *pdev)
>  	cpufreq_cooling_unregister(cdev);
>  	cpufreq_unregister_driver(&cpu0_cpufreq_driver);
>  	dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);
> +	clk_put(cpu_clk);
> +	regulator_put(cpu_reg);

cpu_reg is optional for the driver, so it's more logical to check the
availability before actually putting it?

Shawn

>  
>  	return 0;
>  }
> -- 
> 1.7.0.4
> 

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

* Re: [PATCH 2/3] cpufreq: cpu0: Removes unnecessary IS_ERR check on clk
  2014-08-28  7:00 ` [PATCH 2/3] cpufreq: cpu0: Removes unnecessary IS_ERR check on clk Pramod Gurav
@ 2014-08-28  5:31   ` Shawn Guo
  0 siblings, 0 replies; 7+ messages in thread
From: Shawn Guo @ 2014-08-28  5:31 UTC (permalink / raw)
  To: Pramod Gurav
  Cc: linux-kernel, linux-arm-msm, linux-pm, Rafael J. Wysocki, Viresh Kumar

On Thu, Aug 28, 2014 at 12:00:11AM -0700, Pramod Gurav wrote:
> This removes unnecessary IS_ERR check on clk when in failure path
> as execution wont reach till there with clk being a err.
> 
> CC: Shawn Guo <shawn.guo@linaro.org>
> CC: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> CC: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>

Acked-by: Shawn Guo <shawn.guo@linaro.org>

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

* Re: [PATCH 1/3] cpufreq: cpu0: Release clk and regulator in remove function
  2014-08-28  7:00 [PATCH 1/3] cpufreq: cpu0: Release clk and regulator in remove function Pramod Gurav
  2014-08-28  5:30 ` Shawn Guo
@ 2014-08-28  5:53 ` Viresh Kumar
  2014-08-28  7:00 ` [PATCH 2/3] cpufreq: cpu0: Removes unnecessary IS_ERR check on clk Pramod Gurav
  2014-08-28  7:00 ` [PATCH 3/3] cpufreq: cpu0: Convert pr_ to dev_ as struct device is available Pramod Gurav
  3 siblings, 0 replies; 7+ messages in thread
From: Viresh Kumar @ 2014-08-28  5:53 UTC (permalink / raw)
  To: Pramod Gurav
  Cc: linux-kernel, linux-arm-msm, Linux PM list, Shawn Guo, Rafael J. Wysocki

On Thu, Aug 28, 2014 at 12:30 PM, Pramod Gurav
<pramod.gurav@smartplayin.com> wrote:
> This function releases clk and regulator in remove function for clean
> unloading.
>
> CC: Shawn Guo <shawn.guo@linaro.org>
> CC: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> CC: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
> ---
>  drivers/cpufreq/cpufreq-cpu0.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)

I already have most of this queued up, have sent V3 and cc'd now. See
if you need anything over that.

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

* Re: [PATCH 3/3] cpufreq: cpu0: Convert pr_ to dev_ as struct device is available
  2014-08-28  7:00 ` [PATCH 3/3] cpufreq: cpu0: Convert pr_ to dev_ as struct device is available Pramod Gurav
@ 2014-08-28  6:15   ` Shawn Guo
  0 siblings, 0 replies; 7+ messages in thread
From: Shawn Guo @ 2014-08-28  6:15 UTC (permalink / raw)
  To: Pramod Gurav
  Cc: linux-kernel, linux-arm-msm, linux-pm, Rafael J. Wysocki, Viresh Kumar

On Thu, Aug 28, 2014 at 12:00:12AM -0700, Pramod Gurav wrote:
> CC: Shawn Guo <shawn.guo@linaro.org>
> CC: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> CC: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
> ---
>  drivers/cpufreq/cpufreq-cpu0.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> index 0652cea..8f0b02f 100644
> --- a/drivers/cpufreq/cpufreq-cpu0.c
> +++ b/drivers/cpufreq/cpufreq-cpu0.c
> @@ -126,7 +126,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>  
>  	np = of_node_get(cpu_dev->of_node);
>  	if (!np) {
> -		pr_err("failed to find cpu0 node\n");
> +		dev_err(cpu_dev, "failed to find cpu0 node\n");

There are more pr_* calls in the driver.  Since you do not get rid of
all of them anyway, and pr_fmt(fmt) definition in the file also gives
good context of the messages, I'm not fond of the change.

Shawn

>  		return -ENOENT;
>  	}
>  
> @@ -141,14 +141,14 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>  			ret = -EPROBE_DEFER;
>  			goto out_put_node;
>  		}
> -		pr_warn("failed to get cpu0 regulator: %ld\n",
> +		dev_warn(cpu_dev, "failed to get cpu0 regulator: %ld\n",
>  			PTR_ERR(cpu_reg));
>  	}
>  
>  	cpu_clk = clk_get(cpu_dev, NULL);
>  	if (IS_ERR(cpu_clk)) {
>  		ret = PTR_ERR(cpu_clk);
> -		pr_err("failed to get cpu0 clock: %d\n", ret);
> +		dev_err(cpu_dev, "failed to get cpu0 clock: %d\n", ret);
>  		goto out_put_reg;
>  	}
>  
> @@ -157,7 +157,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>  
>  	ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table);
>  	if (ret) {
> -		pr_err("failed to init cpufreq table: %d\n", ret);
> +		dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret);
>  		goto out_put_clk;
>  	}
>  
> @@ -193,7 +193,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>  
>  	ret = cpufreq_register_driver(&cpu0_cpufreq_driver);
>  	if (ret) {
> -		pr_err("failed register driver: %d\n", ret);
> +		dev_err(cpu_dev, "failed register driver: %d\n", ret);
>  		goto out_free_table;
>  	}
>  
> @@ -204,7 +204,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>  	if (of_find_property(np, "#cooling-cells", NULL)) {
>  		cdev = of_cpufreq_cooling_register(np, cpu_present_mask);
>  		if (IS_ERR(cdev))
> -			pr_err("running cpufreq without cooling device: %ld\n",
> +			dev_err(cpu_dev, "running cpufreq without cooling device: %ld\n",
>  			       PTR_ERR(cdev));
>  	}
>  
> -- 
> 1.7.0.4
> 

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

* [PATCH 1/3] cpufreq: cpu0: Release clk and regulator in remove function
@ 2014-08-28  7:00 Pramod Gurav
  2014-08-28  5:30 ` Shawn Guo
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Pramod Gurav @ 2014-08-28  7:00 UTC (permalink / raw)
  To: linux-kernel, linux-arm-msm, linux-pm
  Cc: Pramod Gurav, Shawn Guo, Rafael J. Wysocki, Viresh Kumar

This function releases clk and regulator in remove function for clean
unloading.

CC: Shawn Guo <shawn.guo@linaro.org>
CC: "Rafael J. Wysocki" <rjw@rjwysocki.net>
CC: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 drivers/cpufreq/cpufreq-cpu0.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index 0d2172b..e1574f8 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -229,6 +229,8 @@ static int cpu0_cpufreq_remove(struct platform_device *pdev)
 	cpufreq_cooling_unregister(cdev);
 	cpufreq_unregister_driver(&cpu0_cpufreq_driver);
 	dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);
+	clk_put(cpu_clk);
+	regulator_put(cpu_reg);
 
 	return 0;
 }
-- 
1.7.0.4


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

* [PATCH 2/3] cpufreq: cpu0: Removes unnecessary IS_ERR check on clk
  2014-08-28  7:00 [PATCH 1/3] cpufreq: cpu0: Release clk and regulator in remove function Pramod Gurav
  2014-08-28  5:30 ` Shawn Guo
  2014-08-28  5:53 ` Viresh Kumar
@ 2014-08-28  7:00 ` Pramod Gurav
  2014-08-28  5:31   ` Shawn Guo
  2014-08-28  7:00 ` [PATCH 3/3] cpufreq: cpu0: Convert pr_ to dev_ as struct device is available Pramod Gurav
  3 siblings, 1 reply; 7+ messages in thread
From: Pramod Gurav @ 2014-08-28  7:00 UTC (permalink / raw)
  To: linux-kernel, linux-arm-msm, linux-pm
  Cc: Pramod Gurav, Shawn Guo, Rafael J. Wysocki, Viresh Kumar

This removes unnecessary IS_ERR check on clk when in failure path
as execution wont reach till there with clk being a err.

CC: Shawn Guo <shawn.guo@linaro.org>
CC: "Rafael J. Wysocki" <rjw@rjwysocki.net>
CC: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 drivers/cpufreq/cpufreq-cpu0.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index e1574f8..0652cea 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -214,8 +214,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
 out_free_table:
 	dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);
 out_put_clk:
-	if (!IS_ERR(cpu_clk))
-		clk_put(cpu_clk);
+	clk_put(cpu_clk);
 out_put_reg:
 	if (!IS_ERR(cpu_reg))
 		regulator_put(cpu_reg);
-- 
1.7.0.4


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

* [PATCH 3/3] cpufreq: cpu0: Convert pr_ to dev_ as struct device is available
  2014-08-28  7:00 [PATCH 1/3] cpufreq: cpu0: Release clk and regulator in remove function Pramod Gurav
                   ` (2 preceding siblings ...)
  2014-08-28  7:00 ` [PATCH 2/3] cpufreq: cpu0: Removes unnecessary IS_ERR check on clk Pramod Gurav
@ 2014-08-28  7:00 ` Pramod Gurav
  2014-08-28  6:15   ` Shawn Guo
  3 siblings, 1 reply; 7+ messages in thread
From: Pramod Gurav @ 2014-08-28  7:00 UTC (permalink / raw)
  To: linux-kernel, linux-arm-msm, linux-pm
  Cc: Pramod Gurav, Shawn Guo, Rafael J. Wysocki, Viresh Kumar

CC: Shawn Guo <shawn.guo@linaro.org>
CC: "Rafael J. Wysocki" <rjw@rjwysocki.net>
CC: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 drivers/cpufreq/cpufreq-cpu0.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index 0652cea..8f0b02f 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -126,7 +126,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
 
 	np = of_node_get(cpu_dev->of_node);
 	if (!np) {
-		pr_err("failed to find cpu0 node\n");
+		dev_err(cpu_dev, "failed to find cpu0 node\n");
 		return -ENOENT;
 	}
 
@@ -141,14 +141,14 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
 			ret = -EPROBE_DEFER;
 			goto out_put_node;
 		}
-		pr_warn("failed to get cpu0 regulator: %ld\n",
+		dev_warn(cpu_dev, "failed to get cpu0 regulator: %ld\n",
 			PTR_ERR(cpu_reg));
 	}
 
 	cpu_clk = clk_get(cpu_dev, NULL);
 	if (IS_ERR(cpu_clk)) {
 		ret = PTR_ERR(cpu_clk);
-		pr_err("failed to get cpu0 clock: %d\n", ret);
+		dev_err(cpu_dev, "failed to get cpu0 clock: %d\n", ret);
 		goto out_put_reg;
 	}
 
@@ -157,7 +157,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
 
 	ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table);
 	if (ret) {
-		pr_err("failed to init cpufreq table: %d\n", ret);
+		dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret);
 		goto out_put_clk;
 	}
 
@@ -193,7 +193,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
 
 	ret = cpufreq_register_driver(&cpu0_cpufreq_driver);
 	if (ret) {
-		pr_err("failed register driver: %d\n", ret);
+		dev_err(cpu_dev, "failed register driver: %d\n", ret);
 		goto out_free_table;
 	}
 
@@ -204,7 +204,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
 	if (of_find_property(np, "#cooling-cells", NULL)) {
 		cdev = of_cpufreq_cooling_register(np, cpu_present_mask);
 		if (IS_ERR(cdev))
-			pr_err("running cpufreq without cooling device: %ld\n",
+			dev_err(cpu_dev, "running cpufreq without cooling device: %ld\n",
 			       PTR_ERR(cdev));
 	}
 
-- 
1.7.0.4


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

end of thread, other threads:[~2014-08-28  6:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-28  7:00 [PATCH 1/3] cpufreq: cpu0: Release clk and regulator in remove function Pramod Gurav
2014-08-28  5:30 ` Shawn Guo
2014-08-28  5:53 ` Viresh Kumar
2014-08-28  7:00 ` [PATCH 2/3] cpufreq: cpu0: Removes unnecessary IS_ERR check on clk Pramod Gurav
2014-08-28  5:31   ` Shawn Guo
2014-08-28  7:00 ` [PATCH 3/3] cpufreq: cpu0: Convert pr_ to dev_ as struct device is available Pramod Gurav
2014-08-28  6:15   ` Shawn Guo

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