linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] thermal: rcar: fixup registration failure case
@ 2013-03-25  5:48 Kuninori Morimoto
  2013-03-25  5:49 ` [PATCH 1/2] thermal: rcar: tidyup " Kuninori Morimoto, Kuninori Morimoto
  2013-03-25  5:50 ` [PATCH 2/2] thermal: rcar: add pm_runtime_xxx() support Kuninori Morimoto, Kuninori Morimoto
  0 siblings, 2 replies; 13+ messages in thread
From: Kuninori Morimoto @ 2013-03-25  5:48 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Simon, Magnus, linux-pm, Kuninori Morimoto


Hi Zhang

These patches fixup registration failure case on Renesas R-Car thermal sensor driver.
And cares pm_runtime_xxx().
These patches are required on latest linus/master branch

Kuninori Morimoto (2):
      thermal: rcar: tidyup registration failure case
      thermal: rcar: add pm_runtime_xxx() support

 drivers/thermal/rcar_thermal.c |   30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

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

* [PATCH 1/2] thermal: rcar: tidyup registration failure case
  2013-03-25  5:48 [PATCH 0/2] thermal: rcar: fixup registration failure case Kuninori Morimoto
@ 2013-03-25  5:49 ` Kuninori Morimoto, Kuninori Morimoto
  2013-03-25  8:40   ` Zhang Rui
  2013-03-25  5:50 ` [PATCH 2/2] thermal: rcar: add pm_runtime_xxx() support Kuninori Morimoto, Kuninori Morimoto
  1 sibling, 1 reply; 13+ messages in thread
From: Kuninori Morimoto, Kuninori Morimoto @ 2013-03-25  5:49 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Simon, Magnus, linux-pm, Kuninori Morimoto

Current rcar_thermal driver didn't care about rcar_theraml_irq_disable()
when registration failure case on _probe(), and _remove().
And, it returns without unregistering thermal zone when
registration failure case on _probe().
This patch fixes these issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/thermal/rcar_thermal.c |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 28f0919..359e943 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -419,13 +419,15 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 		priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 		if (!priv) {
 			dev_err(dev, "Could not allocate priv\n");
-			return -ENOMEM;
+			ret = -ENOMEM;
+			goto error_unregister;
 		}
 
 		priv->base = devm_request_and_ioremap(dev, res);
 		if (!priv->base) {
 			dev_err(dev, "Unable to ioremap priv register\n");
-			return -ENOMEM;
+			ret = -ENOMEM;
+			goto error_unregister;
 		}
 
 		priv->common = common;
@@ -444,10 +446,10 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 			goto error_unregister;
 		}
 
-		list_move_tail(&priv->list, &common->head);
-
 		if (rcar_has_irq_support(priv))
 			rcar_thermal_irq_enable(priv);
+
+		list_move_tail(&priv->list, &common->head);
 	}
 
 	platform_set_drvdata(pdev, common);
@@ -457,8 +459,11 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 	return 0;
 
 error_unregister:
-	rcar_thermal_for_each_priv(priv, common)
+	rcar_thermal_for_each_priv(priv, common) {
 		thermal_zone_device_unregister(priv->zone);
+		if (rcar_has_irq_support(priv))
+			rcar_thermal_irq_disable(priv);
+	}
 
 	return -ENODEV;
 }
@@ -468,8 +473,11 @@ static int rcar_thermal_remove(struct platform_device *pdev)
 	struct rcar_thermal_common *common = platform_get_drvdata(pdev);
 	struct rcar_thermal_priv *priv;
 
-	rcar_thermal_for_each_priv(priv, common)
+	rcar_thermal_for_each_priv(priv, common) {
 		thermal_zone_device_unregister(priv->zone);
+		if (rcar_has_irq_support(priv))
+			rcar_thermal_irq_disable(priv);
+	}
 
 	platform_set_drvdata(pdev, NULL);
 
-- 
1.7.9.5


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

* [PATCH 2/2] thermal: rcar: add pm_runtime_xxx() support
  2013-03-25  5:48 [PATCH 0/2] thermal: rcar: fixup registration failure case Kuninori Morimoto
  2013-03-25  5:49 ` [PATCH 1/2] thermal: rcar: tidyup " Kuninori Morimoto, Kuninori Morimoto
@ 2013-03-25  5:50 ` Kuninori Morimoto, Kuninori Morimoto
  1 sibling, 0 replies; 13+ messages in thread
From: Kuninori Morimoto, Kuninori Morimoto @ 2013-03-25  5:50 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Simon, Magnus, linux-pm, Kuninori Morimoto

Current rcar_thermal() didn't care about own power.
Without this patch, rcar_thermal doesn't work on APE6 board

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/thermal/rcar_thermal.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 359e943..c40404f 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -24,6 +24,7 @@
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/reboot.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -411,6 +412,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 		idle = 0; /* polling delaye is not needed */
 	}
 
+	pm_runtime_enable(dev);
+	pm_runtime_get_sync(dev);
+
 	for (i = 0;; i++) {
 		res = platform_get_resource(pdev, IORESOURCE_MEM, mres++);
 		if (!res)
@@ -465,6 +469,9 @@ error_unregister:
 			rcar_thermal_irq_disable(priv);
 	}
 
+	pm_runtime_put_sync(dev);
+	pm_runtime_disable(dev);
+
 	return -ENODEV;
 }
 
@@ -481,6 +488,9 @@ static int rcar_thermal_remove(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, NULL);
 
+	pm_runtime_put_sync(dev);
+	pm_runtime_disable(dev);
+
 	return 0;
 }
 
-- 
1.7.9.5


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

* Re: [PATCH 1/2] thermal: rcar: tidyup registration failure case
  2013-03-25  5:49 ` [PATCH 1/2] thermal: rcar: tidyup " Kuninori Morimoto, Kuninori Morimoto
@ 2013-03-25  8:40   ` Zhang Rui
  2013-03-26  0:16     ` Kuninori Morimoto
  0 siblings, 1 reply; 13+ messages in thread
From: Zhang Rui @ 2013-03-25  8:40 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Simon, Magnus, linux-pm, Kuninori Morimoto

On Sun, 2013-03-24 at 22:49 -0700, Kuninori Morimoto wrote:
> Current rcar_thermal driver didn't care about rcar_theraml_irq_disable()
> when registration failure case on _probe(), and _remove().
> And, it returns without unregistering thermal zone when
> registration failure case on _probe().
> This patch fixes these issue.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  drivers/thermal/rcar_thermal.c |   20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index 28f0919..359e943 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -419,13 +419,15 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>  		priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
>  		if (!priv) {
>  			dev_err(dev, "Could not allocate priv\n");
> -			return -ENOMEM;
> +			ret = -ENOMEM;
> +			goto error_unregister;
>  		}
>  
>  		priv->base = devm_request_and_ioremap(dev, res);
>  		if (!priv->base) {
>  			dev_err(dev, "Unable to ioremap priv register\n");
> -			return -ENOMEM;
> +			ret = -ENOMEM;
> +			goto error_unregister;
>  		}
>  
>  		priv->common = common;
> @@ -444,10 +446,10 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>  			goto error_unregister;
>  		}
>  
> -		list_move_tail(&priv->list, &common->head);
> -
>  		if (rcar_has_irq_support(priv))
>  			rcar_thermal_irq_enable(priv);
> +
> +		list_move_tail(&priv->list, &common->head);
>  	}
>  
why do you need this change for the rcar_thermal_irq_disable issue?

thanks,
rui
>  	platform_set_drvdata(pdev, common);
> @@ -457,8 +459,11 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>  	return 0;
>  
>  error_unregister:
> -	rcar_thermal_for_each_priv(priv, common)
> +	rcar_thermal_for_each_priv(priv, common) {
>  		thermal_zone_device_unregister(priv->zone);
> +		if (rcar_has_irq_support(priv))
> +			rcar_thermal_irq_disable(priv);
> +	}
>  
>  	return -ENODEV;
>  }
> @@ -468,8 +473,11 @@ static int rcar_thermal_remove(struct platform_device *pdev)
>  	struct rcar_thermal_common *common = platform_get_drvdata(pdev);
>  	struct rcar_thermal_priv *priv;
>  
> -	rcar_thermal_for_each_priv(priv, common)
> +	rcar_thermal_for_each_priv(priv, common) {
>  		thermal_zone_device_unregister(priv->zone);
> +		if (rcar_has_irq_support(priv))
> +			rcar_thermal_irq_disable(priv);
> +	}
>  
>  	platform_set_drvdata(pdev, NULL);
>  



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

* Re: [PATCH 1/2] thermal: rcar: tidyup registration failure case
  2013-03-25  8:40   ` Zhang Rui
@ 2013-03-26  0:16     ` Kuninori Morimoto
  2013-03-26  5:53       ` Kuninori Morimoto
  0 siblings, 1 reply; 13+ messages in thread
From: Kuninori Morimoto @ 2013-03-26  0:16 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Simon, Magnus, linux-pm, Kuninori Morimoto


Hi Zhang

Thank you for checking patch

> > @@ -444,10 +446,10 @@ static int rcar_thermal_probe(struct platform_device *pdev)
> >  			goto error_unregister;
> >  		}
> >  
> > -		list_move_tail(&priv->list, &common->head);
> > -
> >  		if (rcar_has_irq_support(priv))
> >  			rcar_thermal_irq_enable(priv);
> > +
> > +		list_move_tail(&priv->list, &common->head);
> >  	}
> >  
> why do you need this change for the rcar_thermal_irq_disable issue?

I thought it is readable (or easy to understand)
if it was added to the list after all the processings finish. 

listed priv's irq was enabled -> listed priv's irq should be disabled

Best regards
---
Kuninori Morimoto

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

* Re: [PATCH 1/2] thermal: rcar: tidyup registration failure case
  2013-03-26  0:16     ` Kuninori Morimoto
@ 2013-03-26  5:53       ` Kuninori Morimoto
  2013-03-26  6:07         ` [PATCH 0/2 v2] thermal: rcar: fixup " Kuninori Morimoto
  0 siblings, 1 reply; 13+ messages in thread
From: Kuninori Morimoto @ 2013-03-26  5:53 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Simon, Magnus, linux-pm, Kuninori Morimoto


Hi Zhang, again

> Thank you for checking patch
> 
> > > @@ -444,10 +446,10 @@ static int rcar_thermal_probe(struct platform_device *pdev)
> > >  			goto error_unregister;
> > >  		}
> > >  
> > > -		list_move_tail(&priv->list, &common->head);
> > > -
> > >  		if (rcar_has_irq_support(priv))
> > >  			rcar_thermal_irq_enable(priv);
> > > +
> > > +		list_move_tail(&priv->list, &common->head);
> > >  	}
> > >  
> > why do you need this change for the rcar_thermal_irq_disable issue?
> 
> I thought it is readable (or easy to understand)
> if it was added to the list after all the processings finish. 
> 
> listed priv's irq was enabled -> listed priv's irq should be disabled

I noticed that this patch set had 2 bugs
Please give me 2nd chance

Best regards
---
Kuninori Morimoto

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

* [PATCH 0/2 v2] thermal: rcar: fixup registration failure case
  2013-03-26  5:53       ` Kuninori Morimoto
@ 2013-03-26  6:07         ` Kuninori Morimoto
  2013-03-26  6:08           ` [PATCH 1/2 v2] thermal: rcar: tidyup " Kuninori Morimoto
                             ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Kuninori Morimoto @ 2013-03-26  6:07 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Simon, Magnus, Kuninori Morimoto, linux-pm, Linux-SH


Hi Zhang

These are v2 patch set of rcar_thermal driver fixup
I noticed that v1 patch had bug.

These patch set are for linus/master branch,
and, these requires zhang/next's

f0e68fc3caf677e834f7bd0f601800e686b56c98
(thermal: rcar: fix missing unlock on error in rcar_thermal_update_temp())

fb84d9907f0ff0e3f7d70d55039ddf0f78d2a472
(thermal: rcar_thermal: propagate return value of thermal_zone_device_register)

current linus/master branch needs above 2 patches,
and these patch set are based on these.

I Cc:ed SH-ARM ML

Kuninori Morimoto (2):
      thermal: rcar: tidyup registration failure case
      thermal: rcar: add pm_runtime_xxx() support

 drivers/thermal/rcar_thermal.c |   31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

Best regards
---
Kuninori Morimoto

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

* [PATCH 1/2 v2] thermal: rcar: tidyup registration failure case
  2013-03-26  6:07         ` [PATCH 0/2 v2] thermal: rcar: fixup " Kuninori Morimoto
@ 2013-03-26  6:08           ` Kuninori Morimoto
  2013-04-02 13:17             ` Zhang Rui
  2013-03-26  6:08           ` [PATCH 2/2 v2] thermal: rcar: add pm_runtime_xxx() support Kuninori Morimoto
  2013-03-26  6:30           ` [PATCH 0/2 v2] thermal: rcar: fixup registration failure case Zhang Rui
  2 siblings, 1 reply; 13+ messages in thread
From: Kuninori Morimoto @ 2013-03-26  6:08 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Simon, Magnus, Kuninori Morimoto, linux-pm, Linux-SH

Current rcar_thermal driver didn't care about rcar_theraml_irq_disable()
when registration failure case on _probe(), and _remove().
And, it returns without unregistering thermal zone when
registration failure case on _probe().
This patch fixes these issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

 - same as v1

 drivers/thermal/rcar_thermal.c |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index c490aa5..c199623 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -421,13 +421,15 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 		priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 		if (!priv) {
 			dev_err(dev, "Could not allocate priv\n");
-			return -ENOMEM;
+			ret = -ENOMEM;
+			goto error_unregister;
 		}
 
 		priv->base = devm_request_and_ioremap(dev, res);
 		if (!priv->base) {
 			dev_err(dev, "Unable to ioremap priv register\n");
-			return -ENOMEM;
+			ret = -ENOMEM;
+			goto error_unregister;
 		}
 
 		priv->common = common;
@@ -447,10 +449,10 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 			goto error_unregister;
 		}
 
-		list_move_tail(&priv->list, &common->head);
-
 		if (rcar_has_irq_support(priv))
 			rcar_thermal_irq_enable(priv);
+
+		list_move_tail(&priv->list, &common->head);
 	}
 
 	platform_set_drvdata(pdev, common);
@@ -460,8 +462,11 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 	return 0;
 
 error_unregister:
-	rcar_thermal_for_each_priv(priv, common)
+	rcar_thermal_for_each_priv(priv, common) {
 		thermal_zone_device_unregister(priv->zone);
+		if (rcar_has_irq_support(priv))
+			rcar_thermal_irq_disable(priv);
+	}
 
 	return ret;
 }
@@ -471,8 +476,11 @@ static int rcar_thermal_remove(struct platform_device *pdev)
 	struct rcar_thermal_common *common = platform_get_drvdata(pdev);
 	struct rcar_thermal_priv *priv;
 
-	rcar_thermal_for_each_priv(priv, common)
+	rcar_thermal_for_each_priv(priv, common) {
 		thermal_zone_device_unregister(priv->zone);
+		if (rcar_has_irq_support(priv))
+			rcar_thermal_irq_disable(priv);
+	}
 
 	platform_set_drvdata(pdev, NULL);
 
-- 
1.7.9.5


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

* [PATCH 2/2 v2] thermal: rcar: add pm_runtime_xxx() support
  2013-03-26  6:07         ` [PATCH 0/2 v2] thermal: rcar: fixup " Kuninori Morimoto
  2013-03-26  6:08           ` [PATCH 1/2 v2] thermal: rcar: tidyup " Kuninori Morimoto
@ 2013-03-26  6:08           ` Kuninori Morimoto
  2013-04-02 13:19             ` Zhang Rui
  2013-03-26  6:30           ` [PATCH 0/2 v2] thermal: rcar: fixup registration failure case Zhang Rui
  2 siblings, 1 reply; 13+ messages in thread
From: Kuninori Morimoto @ 2013-03-26  6:08 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Simon, Magnus, Kuninori Morimoto, linux-pm, Linux-SH

Current rcar_thermal() didn't care about own power.
Without this patch, rcar_thermal doesn't work on APE6 board

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

 - fixup pm_runtime_xxx() timing
 - fixup compile error

 drivers/thermal/rcar_thermal.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index c199623..0f0f951 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -24,6 +24,7 @@
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/reboot.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -377,6 +378,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 	spin_lock_init(&common->lock);
 	common->dev = dev;
 
+	pm_runtime_enable(dev);
+	pm_runtime_get_sync(dev);
+
 	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (irq) {
 		int ret;
@@ -468,12 +472,16 @@ error_unregister:
 			rcar_thermal_irq_disable(priv);
 	}
 
+	pm_runtime_put_sync(dev);
+	pm_runtime_disable(dev);
+
 	return ret;
 }
 
 static int rcar_thermal_remove(struct platform_device *pdev)
 {
 	struct rcar_thermal_common *common = platform_get_drvdata(pdev);
+	struct device *dev = &pdev->dev;
 	struct rcar_thermal_priv *priv;
 
 	rcar_thermal_for_each_priv(priv, common) {
@@ -484,6 +492,9 @@ static int rcar_thermal_remove(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, NULL);
 
+	pm_runtime_put_sync(dev);
+	pm_runtime_disable(dev);
+
 	return 0;
 }
 
-- 
1.7.9.5


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

* Re: [PATCH 0/2 v2] thermal: rcar: fixup registration failure case
  2013-03-26  6:07         ` [PATCH 0/2 v2] thermal: rcar: fixup " Kuninori Morimoto
  2013-03-26  6:08           ` [PATCH 1/2 v2] thermal: rcar: tidyup " Kuninori Morimoto
  2013-03-26  6:08           ` [PATCH 2/2 v2] thermal: rcar: add pm_runtime_xxx() support Kuninori Morimoto
@ 2013-03-26  6:30           ` Zhang Rui
  2013-03-26  6:45             ` Kuninori Morimoto
  2 siblings, 1 reply; 13+ messages in thread
From: Zhang Rui @ 2013-03-26  6:30 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Simon, Magnus, Kuninori Morimoto, linux-pm, Linux-SH

On Mon, 2013-03-25 at 23:07 -0700, Kuninori Morimoto wrote:
> Hi Zhang
> 
> These are v2 patch set of rcar_thermal driver fixup
> I noticed that v1 patch had bug.
> 
it seems that you did not run any test for the previous patch set, not
even build test.

have you tried this patch set before sending out?

thanks,
rui
> These patch set are for linus/master branch,
> and, these requires zhang/next's
> 
> f0e68fc3caf677e834f7bd0f601800e686b56c98
> (thermal: rcar: fix missing unlock on error in rcar_thermal_update_temp())
> 
> fb84d9907f0ff0e3f7d70d55039ddf0f78d2a472
> (thermal: rcar_thermal: propagate return value of thermal_zone_device_register)
> 
> current linus/master branch needs above 2 patches,
> and these patch set are based on these.
> 
> I Cc:ed SH-ARM ML
> 
> Kuninori Morimoto (2):
>       thermal: rcar: tidyup registration failure case
>       thermal: rcar: add pm_runtime_xxx() support
> 
>  drivers/thermal/rcar_thermal.c |   31 +++++++++++++++++++++++++------
>  1 file changed, 25 insertions(+), 6 deletions(-)
> 
> Best regards
> ---
> Kuninori Morimoto
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



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

* Re: [PATCH 0/2 v2] thermal: rcar: fixup registration failure case
  2013-03-26  6:30           ` [PATCH 0/2 v2] thermal: rcar: fixup registration failure case Zhang Rui
@ 2013-03-26  6:45             ` Kuninori Morimoto
  0 siblings, 0 replies; 13+ messages in thread
From: Kuninori Morimoto @ 2013-03-26  6:45 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Simon, Magnus, Kuninori Morimoto, linux-pm, Linux-SH


Hi Zhang

> On Mon, 2013-03-25 at 23:07 -0700, Kuninori Morimoto wrote:
> > Hi Zhang
> > 
> > These are v2 patch set of rcar_thermal driver fixup
> > I noticed that v1 patch had bug.
> > 
> it seems that you did not run any test for the previous patch set, not
> even build test.

Sorry about my v1 patch set.

My v1 (v2 too) based on not only your branch (= your branch + SH-ML patch set)
Of course I tested v1 patch set,

But I missed when I git-format-patch.
I'm sorry about it again

> have you tried this patch set before sending out?

Yes, these are tesed on r8a73a4 APE6 board


Best regards
---
Kuninori Morimoto

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

* Re: [PATCH 1/2 v2] thermal: rcar: tidyup registration failure case
  2013-03-26  6:08           ` [PATCH 1/2 v2] thermal: rcar: tidyup " Kuninori Morimoto
@ 2013-04-02 13:17             ` Zhang Rui
  0 siblings, 0 replies; 13+ messages in thread
From: Zhang Rui @ 2013-04-02 13:17 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Simon, Magnus, Kuninori Morimoto, linux-pm, Linux-SH

On Mon, 2013-03-25 at 23:08 -0700, Kuninori Morimoto wrote:
> Current rcar_thermal driver didn't care about rcar_theraml_irq_disable()
> when registration failure case on _probe(), and _remove().
> And, it returns without unregistering thermal zone when
> registration failure case on _probe().
> This patch fixes these issue.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

rebased on thermal -next and applied.
please make a double check.

>From 1dc20828e674a781635286072bae909dc4e5c377 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Tue, 26 Mar 2013 06:08:10 +0000
Subject: [PATCH] thermal: rcar: tidyup registration failure case

Current rcar_thermal driver didn't care about rcar_theraml_irq_disable()
when registration failure case on _probe(), and _remove().
And, it returns without unregistering thermal zone when
registration failure case on _probe().
This patch fixes these issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/thermal/rcar_thermal.c |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 2cc5b61..4d6095b 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -419,12 +419,15 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 		priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 		if (!priv) {
 			dev_err(dev, "Could not allocate priv\n");
-			return -ENOMEM;
+			ret = -ENOMEM;
+			goto error_unregister;
 		}
 
 		priv->base = devm_ioremap_resource(dev, res);
-		if (IS_ERR(priv->base))
-			return PTR_ERR(priv->base);
+		if (IS_ERR(priv->base)) {
+			ret = PTR_ERR(priv->base);
+			goto error_unregister;
+		}
 
 		priv->common = common;
 		priv->id = i;
@@ -443,10 +446,10 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 			goto error_unregister;
 		}
 
-		list_move_tail(&priv->list, &common->head);
-
 		if (rcar_has_irq_support(priv))
 			rcar_thermal_irq_enable(priv);
+
+		list_move_tail(&priv->list, &common->head);
 	}
 
 	platform_set_drvdata(pdev, common);
@@ -456,8 +459,11 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 	return 0;
 
 error_unregister:
-	rcar_thermal_for_each_priv(priv, common)
+	rcar_thermal_for_each_priv(priv, common) {
 		thermal_zone_device_unregister(priv->zone);
+		if (rcar_has_irq_support(priv))
+			rcar_thermal_irq_disable(priv);
+	}
 
 	return ret;
 }
@@ -467,8 +473,11 @@ static int rcar_thermal_remove(struct platform_device *pdev)
 	struct rcar_thermal_common *common = platform_get_drvdata(pdev);
 	struct rcar_thermal_priv *priv;
 
-	rcar_thermal_for_each_priv(priv, common)
+	rcar_thermal_for_each_priv(priv, common) {
 		thermal_zone_device_unregister(priv->zone);
+		if (rcar_has_irq_support(priv))
+			rcar_thermal_irq_disable(priv);
+	}
 
 	platform_set_drvdata(pdev, NULL);
 
-- 
1.7.9.5




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

* Re: [PATCH 2/2 v2] thermal: rcar: add pm_runtime_xxx() support
  2013-03-26  6:08           ` [PATCH 2/2 v2] thermal: rcar: add pm_runtime_xxx() support Kuninori Morimoto
@ 2013-04-02 13:19             ` Zhang Rui
  0 siblings, 0 replies; 13+ messages in thread
From: Zhang Rui @ 2013-04-02 13:19 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Simon, Magnus, Kuninori Morimoto, linux-pm, Linux-SH

On Mon, 2013-03-25 at 23:08 -0700, Kuninori Morimoto wrote:
> Current rcar_thermal() didn't care about own power.
> Without this patch, rcar_thermal doesn't work on APE6 board
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

applied.

thanks,
rui
> ---
> v1 -> v2
> 
>  - fixup pm_runtime_xxx() timing
>  - fixup compile error
> 
>  drivers/thermal/rcar_thermal.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index c199623..0f0f951 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -24,6 +24,7 @@
>  #include <linux/io.h>
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
>  #include <linux/reboot.h>
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
> @@ -377,6 +378,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>  	spin_lock_init(&common->lock);
>  	common->dev = dev;
>  
> +	pm_runtime_enable(dev);
> +	pm_runtime_get_sync(dev);
> +
>  	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>  	if (irq) {
>  		int ret;
> @@ -468,12 +472,16 @@ error_unregister:
>  			rcar_thermal_irq_disable(priv);
>  	}
>  
> +	pm_runtime_put_sync(dev);
> +	pm_runtime_disable(dev);
> +
>  	return ret;
>  }
>  
>  static int rcar_thermal_remove(struct platform_device *pdev)
>  {
>  	struct rcar_thermal_common *common = platform_get_drvdata(pdev);
> +	struct device *dev = &pdev->dev;
>  	struct rcar_thermal_priv *priv;
>  
>  	rcar_thermal_for_each_priv(priv, common) {
> @@ -484,6 +492,9 @@ static int rcar_thermal_remove(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, NULL);
>  
> +	pm_runtime_put_sync(dev);
> +	pm_runtime_disable(dev);
> +
>  	return 0;
>  }
>  



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

end of thread, other threads:[~2013-04-02 13:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-25  5:48 [PATCH 0/2] thermal: rcar: fixup registration failure case Kuninori Morimoto
2013-03-25  5:49 ` [PATCH 1/2] thermal: rcar: tidyup " Kuninori Morimoto, Kuninori Morimoto
2013-03-25  8:40   ` Zhang Rui
2013-03-26  0:16     ` Kuninori Morimoto
2013-03-26  5:53       ` Kuninori Morimoto
2013-03-26  6:07         ` [PATCH 0/2 v2] thermal: rcar: fixup " Kuninori Morimoto
2013-03-26  6:08           ` [PATCH 1/2 v2] thermal: rcar: tidyup " Kuninori Morimoto
2013-04-02 13:17             ` Zhang Rui
2013-03-26  6:08           ` [PATCH 2/2 v2] thermal: rcar: add pm_runtime_xxx() support Kuninori Morimoto
2013-04-02 13:19             ` Zhang Rui
2013-03-26  6:30           ` [PATCH 0/2 v2] thermal: rcar: fixup registration failure case Zhang Rui
2013-03-26  6:45             ` Kuninori Morimoto
2013-03-25  5:50 ` [PATCH 2/2] thermal: rcar: add pm_runtime_xxx() support Kuninori Morimoto, Kuninori Morimoto

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