All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thermal: broadcom: use devm_thermal_zone_of_sensor_register
@ 2018-10-30 16:08 ` Julia Lawall
  0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2018-10-30 16:08 UTC (permalink / raw)
  To: Markus Mayer
  Cc: kernel-janitors, bcm-kernel-feedback-list, Zhang Rui,
	Eduardo Valentin, Daniel Lezcano, Brian Norris, Gregory Fong,
	Florian Fainelli, linux-pm, linux-arm-kernel, linux-kernel

Using devm_thermal_zone_of_sensor_register allows to simplify some
error handling code, drop a label, and drop the remove function.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---

This patch is completely orthogonal to the recent constification
patch.

 drivers/thermal/broadcom/brcmstb_thermal.c |   24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c
index 1919f91fa756..956eef8717bb 100644
--- a/drivers/thermal/broadcom/brcmstb_thermal.c
+++ b/drivers/thermal/broadcom/brcmstb_thermal.c
@@ -329,7 +329,8 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
 	priv->dev = &pdev->dev;
 	platform_set_drvdata(pdev, priv);
 
-	thermal = thermal_zone_of_sensor_register(&pdev->dev, 0, priv, &of_ops);
+	thermal = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv,
+						       &of_ops);
 	if (IS_ERR(thermal)) {
 		ret = PTR_ERR(thermal);
 		dev_err(&pdev->dev, "could not register sensor: %d\n", ret);
@@ -341,40 +342,23 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
 		dev_err(&pdev->dev, "could not get IRQ\n");
-		ret = irq;
-		goto err;
+		return irq;
 	}
 	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
 					brcmstb_tmon_irq_thread, IRQF_ONESHOT,
 					DRV_NAME, priv);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "could not request IRQ: %d\n", ret);
-		goto err;
+		return ret;
 	}
 
 	dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n");
 
 	return 0;
-
-err:
-	thermal_zone_of_sensor_unregister(&pdev->dev, thermal);
-	return ret;
-}
-
-static int brcmstb_thermal_exit(struct platform_device *pdev)
-{
-	struct brcmstb_thermal_priv *priv = platform_get_drvdata(pdev);
-	struct thermal_zone_device *thermal = priv->thermal;
-
-	if (thermal)
-		thermal_zone_of_sensor_unregister(&pdev->dev, priv->thermal);
-
-	return 0;
 }
 
 static struct platform_driver brcmstb_thermal_driver = {
 	.probe = brcmstb_thermal_probe,
-	.remove = brcmstb_thermal_exit,
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = brcmstb_thermal_id_table,


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

* [PATCH] thermal: broadcom: use devm_thermal_zone_of_sensor_register
@ 2018-10-30 16:08 ` Julia Lawall
  0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2018-10-30 16:08 UTC (permalink / raw)
  To: linux-arm-kernel

Using devm_thermal_zone_of_sensor_register allows to simplify some
error handling code, drop a label, and drop the remove function.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---

This patch is completely orthogonal to the recent constification
patch.

 drivers/thermal/broadcom/brcmstb_thermal.c |   24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c
index 1919f91fa756..956eef8717bb 100644
--- a/drivers/thermal/broadcom/brcmstb_thermal.c
+++ b/drivers/thermal/broadcom/brcmstb_thermal.c
@@ -329,7 +329,8 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
 	priv->dev = &pdev->dev;
 	platform_set_drvdata(pdev, priv);
 
-	thermal = thermal_zone_of_sensor_register(&pdev->dev, 0, priv, &of_ops);
+	thermal = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv,
+						       &of_ops);
 	if (IS_ERR(thermal)) {
 		ret = PTR_ERR(thermal);
 		dev_err(&pdev->dev, "could not register sensor: %d\n", ret);
@@ -341,40 +342,23 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
 		dev_err(&pdev->dev, "could not get IRQ\n");
-		ret = irq;
-		goto err;
+		return irq;
 	}
 	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
 					brcmstb_tmon_irq_thread, IRQF_ONESHOT,
 					DRV_NAME, priv);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "could not request IRQ: %d\n", ret);
-		goto err;
+		return ret;
 	}
 
 	dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n");
 
 	return 0;
-
-err:
-	thermal_zone_of_sensor_unregister(&pdev->dev, thermal);
-	return ret;
-}
-
-static int brcmstb_thermal_exit(struct platform_device *pdev)
-{
-	struct brcmstb_thermal_priv *priv = platform_get_drvdata(pdev);
-	struct thermal_zone_device *thermal = priv->thermal;
-
-	if (thermal)
-		thermal_zone_of_sensor_unregister(&pdev->dev, priv->thermal);
-
-	return 0;
 }
 
 static struct platform_driver brcmstb_thermal_driver = {
 	.probe = brcmstb_thermal_probe,
-	.remove = brcmstb_thermal_exit,
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = brcmstb_thermal_id_table,

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

* [PATCH] thermal: broadcom: use devm_thermal_zone_of_sensor_register
@ 2018-10-30 16:08 ` Julia Lawall
  0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2018-10-30 16:08 UTC (permalink / raw)
  To: linux-arm-kernel

Using devm_thermal_zone_of_sensor_register allows to simplify some
error handling code, drop a label, and drop the remove function.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---

This patch is completely orthogonal to the recent constification
patch.

 drivers/thermal/broadcom/brcmstb_thermal.c |   24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c
index 1919f91fa756..956eef8717bb 100644
--- a/drivers/thermal/broadcom/brcmstb_thermal.c
+++ b/drivers/thermal/broadcom/brcmstb_thermal.c
@@ -329,7 +329,8 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
 	priv->dev = &pdev->dev;
 	platform_set_drvdata(pdev, priv);
 
-	thermal = thermal_zone_of_sensor_register(&pdev->dev, 0, priv, &of_ops);
+	thermal = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv,
+						       &of_ops);
 	if (IS_ERR(thermal)) {
 		ret = PTR_ERR(thermal);
 		dev_err(&pdev->dev, "could not register sensor: %d\n", ret);
@@ -341,40 +342,23 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
 		dev_err(&pdev->dev, "could not get IRQ\n");
-		ret = irq;
-		goto err;
+		return irq;
 	}
 	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
 					brcmstb_tmon_irq_thread, IRQF_ONESHOT,
 					DRV_NAME, priv);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "could not request IRQ: %d\n", ret);
-		goto err;
+		return ret;
 	}
 
 	dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n");
 
 	return 0;
-
-err:
-	thermal_zone_of_sensor_unregister(&pdev->dev, thermal);
-	return ret;
-}
-
-static int brcmstb_thermal_exit(struct platform_device *pdev)
-{
-	struct brcmstb_thermal_priv *priv = platform_get_drvdata(pdev);
-	struct thermal_zone_device *thermal = priv->thermal;
-
-	if (thermal)
-		thermal_zone_of_sensor_unregister(&pdev->dev, priv->thermal);
-
-	return 0;
 }
 
 static struct platform_driver brcmstb_thermal_driver = {
 	.probe = brcmstb_thermal_probe,
-	.remove = brcmstb_thermal_exit,
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = brcmstb_thermal_id_table,

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

* Re: [PATCH] thermal: broadcom: use devm_thermal_zone_of_sensor_register
  2018-10-30 16:08 ` Julia Lawall
  (?)
@ 2018-10-30 16:54   ` Daniel Lezcano
  -1 siblings, 0 replies; 6+ messages in thread
From: Daniel Lezcano @ 2018-10-30 16:54 UTC (permalink / raw)
  To: Julia Lawall, Markus Mayer
  Cc: kernel-janitors, bcm-kernel-feedback-list, Zhang Rui,
	Eduardo Valentin, Brian Norris, Gregory Fong, Florian Fainelli,
	linux-pm, linux-arm-kernel, linux-kernel

On 30/10/2018 17:08, Julia Lawall wrote:
> Using devm_thermal_zone_of_sensor_register allows to simplify some
> error handling code, drop a label, and drop the remove function.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

> ---
> 
> This patch is completely orthogonal to the recent constification
> patch.
> 
>  drivers/thermal/broadcom/brcmstb_thermal.c |   24 ++++--------------------
>  1 file changed, 4 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c
> index 1919f91fa756..956eef8717bb 100644
> --- a/drivers/thermal/broadcom/brcmstb_thermal.c
> +++ b/drivers/thermal/broadcom/brcmstb_thermal.c
> @@ -329,7 +329,8 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
>  	priv->dev = &pdev->dev;
>  	platform_set_drvdata(pdev, priv);
>  
> -	thermal = thermal_zone_of_sensor_register(&pdev->dev, 0, priv, &of_ops);
> +	thermal = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv,
> +						       &of_ops);
>  	if (IS_ERR(thermal)) {
>  		ret = PTR_ERR(thermal);
>  		dev_err(&pdev->dev, "could not register sensor: %d\n", ret);
> @@ -341,40 +342,23 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0) {
>  		dev_err(&pdev->dev, "could not get IRQ\n");
> -		ret = irq;
> -		goto err;
> +		return irq;
>  	}
>  	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
>  					brcmstb_tmon_irq_thread, IRQF_ONESHOT,
>  					DRV_NAME, priv);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "could not request IRQ: %d\n", ret);
> -		goto err;
> +		return ret;
>  	}
>  
>  	dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n");
>  
>  	return 0;
> -
> -err:
> -	thermal_zone_of_sensor_unregister(&pdev->dev, thermal);
> -	return ret;
> -}
> -
> -static int brcmstb_thermal_exit(struct platform_device *pdev)
> -{
> -	struct brcmstb_thermal_priv *priv = platform_get_drvdata(pdev);
> -	struct thermal_zone_device *thermal = priv->thermal;
> -
> -	if (thermal)
> -		thermal_zone_of_sensor_unregister(&pdev->dev, priv->thermal);
> -
> -	return 0;
>  }
>  
>  static struct platform_driver brcmstb_thermal_driver = {
>  	.probe = brcmstb_thermal_probe,
> -	.remove = brcmstb_thermal_exit,
>  	.driver = {
>  		.name = DRV_NAME,
>  		.of_match_table = brcmstb_thermal_id_table,
> 


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH] thermal: broadcom: use devm_thermal_zone_of_sensor_register
@ 2018-10-30 16:54   ` Daniel Lezcano
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Lezcano @ 2018-10-30 16:54 UTC (permalink / raw)
  To: linux-arm-kernel

On 30/10/2018 17:08, Julia Lawall wrote:
> Using devm_thermal_zone_of_sensor_register allows to simplify some
> error handling code, drop a label, and drop the remove function.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

> ---
> 
> This patch is completely orthogonal to the recent constification
> patch.
> 
>  drivers/thermal/broadcom/brcmstb_thermal.c |   24 ++++--------------------
>  1 file changed, 4 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c
> index 1919f91fa756..956eef8717bb 100644
> --- a/drivers/thermal/broadcom/brcmstb_thermal.c
> +++ b/drivers/thermal/broadcom/brcmstb_thermal.c
> @@ -329,7 +329,8 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
>  	priv->dev = &pdev->dev;
>  	platform_set_drvdata(pdev, priv);
>  
> -	thermal = thermal_zone_of_sensor_register(&pdev->dev, 0, priv, &of_ops);
> +	thermal = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv,
> +						       &of_ops);
>  	if (IS_ERR(thermal)) {
>  		ret = PTR_ERR(thermal);
>  		dev_err(&pdev->dev, "could not register sensor: %d\n", ret);
> @@ -341,40 +342,23 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0) {
>  		dev_err(&pdev->dev, "could not get IRQ\n");
> -		ret = irq;
> -		goto err;
> +		return irq;
>  	}
>  	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
>  					brcmstb_tmon_irq_thread, IRQF_ONESHOT,
>  					DRV_NAME, priv);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "could not request IRQ: %d\n", ret);
> -		goto err;
> +		return ret;
>  	}
>  
>  	dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n");
>  
>  	return 0;
> -
> -err:
> -	thermal_zone_of_sensor_unregister(&pdev->dev, thermal);
> -	return ret;
> -}
> -
> -static int brcmstb_thermal_exit(struct platform_device *pdev)
> -{
> -	struct brcmstb_thermal_priv *priv = platform_get_drvdata(pdev);
> -	struct thermal_zone_device *thermal = priv->thermal;
> -
> -	if (thermal)
> -		thermal_zone_of_sensor_unregister(&pdev->dev, priv->thermal);
> -
> -	return 0;
>  }
>  
>  static struct platform_driver brcmstb_thermal_driver = {
>  	.probe = brcmstb_thermal_probe,
> -	.remove = brcmstb_thermal_exit,
>  	.driver = {
>  		.name = DRV_NAME,
>  		.of_match_table = brcmstb_thermal_id_table,
> 


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* [PATCH] thermal: broadcom: use devm_thermal_zone_of_sensor_register
@ 2018-10-30 16:54   ` Daniel Lezcano
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Lezcano @ 2018-10-30 16:54 UTC (permalink / raw)
  To: linux-arm-kernel

On 30/10/2018 17:08, Julia Lawall wrote:
> Using devm_thermal_zone_of_sensor_register allows to simplify some
> error handling code, drop a label, and drop the remove function.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>

> ---
> 
> This patch is completely orthogonal to the recent constification
> patch.
> 
>  drivers/thermal/broadcom/brcmstb_thermal.c |   24 ++++--------------------
>  1 file changed, 4 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c
> index 1919f91fa756..956eef8717bb 100644
> --- a/drivers/thermal/broadcom/brcmstb_thermal.c
> +++ b/drivers/thermal/broadcom/brcmstb_thermal.c
> @@ -329,7 +329,8 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
>  	priv->dev = &pdev->dev;
>  	platform_set_drvdata(pdev, priv);
>  
> -	thermal = thermal_zone_of_sensor_register(&pdev->dev, 0, priv, &of_ops);
> +	thermal = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv,
> +						       &of_ops);
>  	if (IS_ERR(thermal)) {
>  		ret = PTR_ERR(thermal);
>  		dev_err(&pdev->dev, "could not register sensor: %d\n", ret);
> @@ -341,40 +342,23 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0) {
>  		dev_err(&pdev->dev, "could not get IRQ\n");
> -		ret = irq;
> -		goto err;
> +		return irq;
>  	}
>  	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
>  					brcmstb_tmon_irq_thread, IRQF_ONESHOT,
>  					DRV_NAME, priv);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "could not request IRQ: %d\n", ret);
> -		goto err;
> +		return ret;
>  	}
>  
>  	dev_info(&pdev->dev, "registered AVS TMON of-sensor driver\n");
>  
>  	return 0;
> -
> -err:
> -	thermal_zone_of_sensor_unregister(&pdev->dev, thermal);
> -	return ret;
> -}
> -
> -static int brcmstb_thermal_exit(struct platform_device *pdev)
> -{
> -	struct brcmstb_thermal_priv *priv = platform_get_drvdata(pdev);
> -	struct thermal_zone_device *thermal = priv->thermal;
> -
> -	if (thermal)
> -		thermal_zone_of_sensor_unregister(&pdev->dev, priv->thermal);
> -
> -	return 0;
>  }
>  
>  static struct platform_driver brcmstb_thermal_driver = {
>  	.probe = brcmstb_thermal_probe,
> -	.remove = brcmstb_thermal_exit,
>  	.driver = {
>  		.name = DRV_NAME,
>  		.of_match_table = brcmstb_thermal_id_table,
> 


-- 
 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

end of thread, other threads:[~2018-10-30 16:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30 16:08 [PATCH] thermal: broadcom: use devm_thermal_zone_of_sensor_register Julia Lawall
2018-10-30 16:08 ` Julia Lawall
2018-10-30 16:08 ` Julia Lawall
2018-10-30 16:54 ` Daniel Lezcano
2018-10-30 16:54   ` Daniel Lezcano
2018-10-30 16:54   ` Daniel Lezcano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.