Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1354480 > unrolled thread

[PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_

Started byEduardo Valentin <edubezval@gmail.com>
First post2016-03-09 22:40 +0100
Last post2016-03-10 10:20 +0100
Articles 15 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin <edubezval@gmail.com> - 2016-03-09 22:40 +0100
    [PATCH 09/13] thermal: convert rcar_thermal to use devm_thermal_zone_of_sensor_register Eduardo Valentin <edubezval@gmail.com> - 2016-03-09 22:40 +0100
    [PATCH 07/13] thermal: convert mtk_thermal to use devm_thermal_zone_of_sensor_register Eduardo Valentin <edubezval@gmail.com> - 2016-03-09 22:40 +0100
    [PATCH 04/13] hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register Eduardo Valentin <edubezval@gmail.com> - 2016-03-09 22:40 +0100
      Re: [PATCH 04/13] hwmon: convert scpi-hwmon to use  devm_thermal_zone_of_sensor_register Guenter Roeck <linux@roeck-us.net> - 2016-03-10 03:30 +0100
        Re: [PATCH 04/13] hwmon: convert scpi-hwmon to use  devm_thermal_zone_of_sensor_register Eduardo Valentin <edubezval@gmail.com> - 2016-03-14 21:00 +0100
    [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register Eduardo Valentin <edubezval@gmail.com> - 2016-03-09 22:40 +0100
      Re: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register Wei Ni <wni@nvidia.com> - 2016-03-10 09:50 +0100
        Re: [PATCH 12/13] thermal: convert tegra_thermal to use  devm_thermal_zone_of_sensor_register Eduardo Valentin <edubezval@gmail.com> - 2016-03-14 22:20 +0100
          Re: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register Wei Ni <wni@nvidia.com> - 2016-03-15 06:50 +0100
    [PATCH 06/13] thermal: convert hisi_thermal to use devm_thermal_zone_of_sensor_register Eduardo Valentin <edubezval@gmail.com> - 2016-03-09 22:40 +0100
    [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register Eduardo Valentin <edubezval@gmail.com> - 2016-03-09 22:40 +0100
      Re: [PATCH 11/13] thermal: convert exynos to use  devm_thermal_zone_of_sensor_register Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-03-10 01:20 +0100
        Re: [PATCH 11/13] thermal: convert exynos to use  devm_thermal_zone_of_sensor_register Eduardo Valentin <edubezval@gmail.com> - 2016-03-14 20:50 +0100
      Re: [PATCH 11/13] thermal: convert exynos to use  devm_thermal_zone_of_sensor_register Lukasz Majewski <l.majewski@samsung.com> - 2016-03-10 10:20 +0100

#1354480 — [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_

FromEduardo Valentin <edubezval@gmail.com>
Date2016-03-09 22:40 +0100
Subject[PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_
Message-ID<raTZM-5nL-7@gated-at.bofh.it>
Hello,

Given that now we have a devm version of thermal_zone_of_sensor_register [1],
I am sending this series of patches to convert its users to use the devm_
API.

Driver's authors, please comment.

BR,

Eduardo Valentin (13):
  hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register
  hwmon: convert ntc_thermistor to use
    devm_thermal_zone_of_sensor_register
  hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register
  hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register
  input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register
  thermal: convert hisi_thermal to use
    devm_thermal_zone_of_sensor_register
  thermal: convert mtk_thermal to use
    devm_thermal_zone_of_sensor_register
  thermal: convert qcom-spmi to use devm_thermal_zone_of_sensor_register
  thermal: convert rcar_thermal to use
    devm_thermal_zone_of_sensor_register
  thermal: convert rockchip_thermal to use
    devm_thermal_zone_of_sensor_register
  thermal: convert exynos to use devm_thermal_zone_of_sensor_register
  thermal: convert tegra_thermal to use
    devm_thermal_zone_of_sensor_register
  thermal: convert ti-thermal to use
    devm_thermal_zone_of_sensor_register

 drivers/hwmon/lm75.c                               | 10 ++----
 drivers/hwmon/ntc_thermistor.c                     | 12 +++----
 drivers/hwmon/scpi-hwmon.c                         | 41 +++++-----------------
 drivers/hwmon/tmp102.c                             |  8 ++---
 drivers/input/touchscreen/sun4i-ts.c               |  9 +----
 drivers/thermal/hisi_thermal.c                     |  5 ++-
 drivers/thermal/mtk_thermal.c                      | 12 ++-----
 drivers/thermal/qcom-spmi-temp-alarm.c             |  3 +-
 drivers/thermal/rcar_thermal.c                     |  2 +-
 drivers/thermal/rockchip_thermal.c                 | 17 +++------
 drivers/thermal/samsung/exynos_tmu.c               | 12 +++----
 drivers/thermal/tegra_soctherm.c                   | 31 +++++-----------
 drivers/thermal/ti-soc-thermal/ti-thermal-common.c |  5 +--
 13 files changed, 42 insertions(+), 125 deletions(-)

-- 
2.1.4

[toc] | [next] | [standalone]


#1354481 — [PATCH 09/13] thermal: convert rcar_thermal to use devm_thermal_zone_of_sensor_register

FromEduardo Valentin <edubezval@gmail.com>
Date2016-03-09 22:40 +0100
Subject[PATCH 09/13] thermal: convert rcar_thermal to use devm_thermal_zone_of_sensor_register
Message-ID<raTZN-5nL-37@gated-at.bofh.it>
In reply to#1354480
This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the  local points and unregister calls.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
 drivers/thermal/rcar_thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 0e735ac..a5e4181 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -493,7 +493,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 			goto error_unregister;
 
 		if (of_data == USE_OF_THERMAL)
-			priv->zone = thermal_zone_of_sensor_register(
+			priv->zone = devm_thermal_zone_of_sensor_register(
 						dev, i, priv,
 						&rcar_thermal_zone_of_ops);
 		else
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1354482 — [PATCH 07/13] thermal: convert mtk_thermal to use devm_thermal_zone_of_sensor_register

FromEduardo Valentin <edubezval@gmail.com>
Date2016-03-09 22:40 +0100
Subject[PATCH 07/13] thermal: convert mtk_thermal to use devm_thermal_zone_of_sensor_register
Message-ID<raTZN-5nL-39@gated-at.bofh.it>
In reply to#1354480
This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the  local points and unregister calls.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
 drivers/thermal/mtk_thermal.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
index 3d93b1c..2c40b0f 100644
--- a/drivers/thermal/mtk_thermal.c
+++ b/drivers/thermal/mtk_thermal.c
@@ -145,7 +145,6 @@ struct mtk_thermal {
 	s32 o_slope;
 	s32 vts[MT8173_NUM_SENSORS];
 
-	struct thermal_zone_device *tzd;
 };
 
 struct mtk_thermal_bank_cfg {
@@ -573,16 +572,11 @@ static int mtk_thermal_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, mt);
 
-	mt->tzd = thermal_zone_of_sensor_register(&pdev->dev, 0, mt,
-				&mtk_thermal_ops);
-	if (IS_ERR(mt->tzd))
-		goto err_register;
+	devm_thermal_zone_of_sensor_register(&pdev->dev, 0, mt,
+					     &mtk_thermal_ops);
 
 	return 0;
 
-err_register:
-	clk_disable_unprepare(mt->clk_peri_therm);
-
 err_disable_clk_auxadc:
 	clk_disable_unprepare(mt->clk_auxadc);
 
@@ -593,8 +587,6 @@ static int mtk_thermal_remove(struct platform_device *pdev)
 {
 	struct mtk_thermal *mt = platform_get_drvdata(pdev);
 
-	thermal_zone_of_sensor_unregister(&pdev->dev, mt->tzd);
-
 	clk_disable_unprepare(mt->clk_peri_therm);
 	clk_disable_unprepare(mt->clk_auxadc);
 
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1354483 — [PATCH 04/13] hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register

FromEduardo Valentin <edubezval@gmail.com>
Date2016-03-09 22:40 +0100
Subject[PATCH 04/13] hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register
Message-ID<raTZO-5nL-41@gated-at.bofh.it>
In reply to#1354480
This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the  local points and unregister calls.

Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: lm-sensors@lm-sensors.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
 drivers/hwmon/scpi-hwmon.c | 41 ++++++++---------------------------------
 1 file changed, 8 insertions(+), 33 deletions(-)

diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c
index 7e20567..2309e47 100644
--- a/drivers/hwmon/scpi-hwmon.c
+++ b/drivers/hwmon/scpi-hwmon.c
@@ -31,10 +31,8 @@ struct sensor_data {
 };
 
 struct scpi_thermal_zone {
-	struct list_head list;
 	int sensor_id;
 	struct scpi_sensors *scpi_sensors;
-	struct thermal_zone_device *tzd;
 };
 
 struct scpi_sensors {
@@ -92,20 +90,6 @@ scpi_show_label(struct device *dev, struct device_attribute *attr, char *buf)
 	return sprintf(buf, "%s\n", sensor->info.name);
 }
 
-static void
-unregister_thermal_zones(struct platform_device *pdev,
-			 struct scpi_sensors *scpi_sensors)
-{
-	struct list_head *pos;
-
-	list_for_each(pos, &scpi_sensors->thermal_zones) {
-		struct scpi_thermal_zone *zone;
-
-		zone = list_entry(pos, struct scpi_thermal_zone, list);
-		thermal_zone_of_sensor_unregister(&pdev->dev, zone->tzd);
-	}
-}
-
 static struct thermal_zone_of_device_ops scpi_sensor_ops = {
 	.get_temp = scpi_read_temp,
 };
@@ -224,6 +208,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&scpi_sensors->thermal_zones);
 	for (i = 0; i < nr_sensors; i++) {
 		struct sensor_data *sensor = &scpi_sensors->data[i];
+		struct thermal_zone_device *z;
 		struct scpi_thermal_zone *zone;
 
 		if (sensor->info.class != TEMPERATURE)
@@ -232,42 +217,33 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
 		zone = devm_kzalloc(dev, sizeof(*zone), GFP_KERNEL);
 		if (!zone) {
 			ret = -ENOMEM;
-			goto unregister_tzd;
+			goto mfail;
 		}
 
 		zone->sensor_id = i;
 		zone->scpi_sensors = scpi_sensors;
-		zone->tzd = thermal_zone_of_sensor_register(dev,
-				sensor->info.sensor_id, zone, &scpi_sensor_ops);
+		z = devm_thermal_zone_of_sensor_register(dev,
+							 sensor->info.sensor_id,
+							 zone,
+							 &scpi_sensor_ops);
 		/*
 		 * The call to thermal_zone_of_sensor_register returns
 		 * an error for sensors that are not associated with
 		 * any thermal zones or if the thermal subsystem is
 		 * not configured.
 		 */
-		if (IS_ERR(zone->tzd)) {
+		if (IS_ERR(z)) {
 			devm_kfree(dev, zone);
 			continue;
 		}
-		list_add(&zone->list, &scpi_sensors->thermal_zones);
 	}
 
 	return 0;
 
-unregister_tzd:
-	unregister_thermal_zones(pdev, scpi_sensors);
+mfail:
 	return ret;
 }
 
-static int scpi_hwmon_remove(struct platform_device *pdev)
-{
-	struct scpi_sensors *scpi_sensors = platform_get_drvdata(pdev);
-
-	unregister_thermal_zones(pdev, scpi_sensors);
-
-	return 0;
-}
-
 static const struct of_device_id scpi_of_match[] = {
 	{.compatible = "arm,scpi-sensors"},
 	{},
@@ -280,7 +256,6 @@ static struct platform_driver scpi_hwmon_platdrv = {
 		.of_match_table = scpi_of_match,
 	},
 	.probe		= scpi_hwmon_probe,
-	.remove		= scpi_hwmon_remove,
 };
 module_platform_driver(scpi_hwmon_platdrv);
 
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1354783 — Re: [PATCH 04/13] hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register

FromGuenter Roeck <linux@roeck-us.net>
Date2016-03-10 03:30 +0100
SubjectRe: [PATCH 04/13] hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register
Message-ID<raYwr-fk-39@gated-at.bofh.it>
In reply to#1354483
On 03/09/2016 01:35 PM, Eduardo Valentin wrote:
> This changes the driver to use the devm_ version
> of thermal_zone_of_sensor_register and cleans
> up the  local points and unregister calls.
>
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: lm-sensors@lm-sensors.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> ---
>   drivers/hwmon/scpi-hwmon.c | 41 ++++++++---------------------------------
>   1 file changed, 8 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c
> index 7e20567..2309e47 100644
> --- a/drivers/hwmon/scpi-hwmon.c
> +++ b/drivers/hwmon/scpi-hwmon.c
> @@ -31,10 +31,8 @@ struct sensor_data {
>   };
>
>   struct scpi_thermal_zone {
> -	struct list_head list;
>   	int sensor_id;
>   	struct scpi_sensors *scpi_sensors;
> -	struct thermal_zone_device *tzd;
>   };
>
>   struct scpi_sensors {
> @@ -92,20 +90,6 @@ scpi_show_label(struct device *dev, struct device_attribute *attr, char *buf)
>   	return sprintf(buf, "%s\n", sensor->info.name);
>   }
>
> -static void
> -unregister_thermal_zones(struct platform_device *pdev,
> -			 struct scpi_sensors *scpi_sensors)
> -{
> -	struct list_head *pos;
> -
> -	list_for_each(pos, &scpi_sensors->thermal_zones) {
> -		struct scpi_thermal_zone *zone;
> -
> -		zone = list_entry(pos, struct scpi_thermal_zone, list);
> -		thermal_zone_of_sensor_unregister(&pdev->dev, zone->tzd);
> -	}
> -}
> -
>   static struct thermal_zone_of_device_ops scpi_sensor_ops = {
>   	.get_temp = scpi_read_temp,
>   };
> @@ -224,6 +208,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
>   	INIT_LIST_HEAD(&scpi_sensors->thermal_zones);
>   	for (i = 0; i < nr_sensors; i++) {
>   		struct sensor_data *sensor = &scpi_sensors->data[i];
> +		struct thermal_zone_device *z;
>   		struct scpi_thermal_zone *zone;
>
>   		if (sensor->info.class != TEMPERATURE)
> @@ -232,42 +217,33 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
>   		zone = devm_kzalloc(dev, sizeof(*zone), GFP_KERNEL);
>   		if (!zone) {
>   			ret = -ENOMEM;
> -			goto unregister_tzd;
> +			goto mfail;

			return -ENOMEM;

... and drop the unnecessary label.

Thanks,
Guenter

>   		}
>
>   		zone->sensor_id = i;
>   		zone->scpi_sensors = scpi_sensors;
> -		zone->tzd = thermal_zone_of_sensor_register(dev,
> -				sensor->info.sensor_id, zone, &scpi_sensor_ops);
> +		z = devm_thermal_zone_of_sensor_register(dev,
> +							 sensor->info.sensor_id,
> +							 zone,
> +							 &scpi_sensor_ops);
>   		/*
>   		 * The call to thermal_zone_of_sensor_register returns
>   		 * an error for sensors that are not associated with
>   		 * any thermal zones or if the thermal subsystem is
>   		 * not configured.
>   		 */
> -		if (IS_ERR(zone->tzd)) {
> +		if (IS_ERR(z)) {
>   			devm_kfree(dev, zone);
>   			continue;
>   		}
> -		list_add(&zone->list, &scpi_sensors->thermal_zones);
>   	}
>
>   	return 0;
>
> -unregister_tzd:
> -	unregister_thermal_zones(pdev, scpi_sensors);
> +mfail:
>   	return ret;
>   }
>
> -static int scpi_hwmon_remove(struct platform_device *pdev)
> -{
> -	struct scpi_sensors *scpi_sensors = platform_get_drvdata(pdev);
> -
> -	unregister_thermal_zones(pdev, scpi_sensors);
> -
> -	return 0;
> -}
> -
>   static const struct of_device_id scpi_of_match[] = {
>   	{.compatible = "arm,scpi-sensors"},
>   	{},
> @@ -280,7 +256,6 @@ static struct platform_driver scpi_hwmon_platdrv = {
>   		.of_match_table = scpi_of_match,
>   	},
>   	.probe		= scpi_hwmon_probe,
> -	.remove		= scpi_hwmon_remove,
>   };
>   module_platform_driver(scpi_hwmon_platdrv);
>
>

[toc] | [prev] | [next] | [standalone]


#1357583 — Re: [PATCH 04/13] hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register

FromEduardo Valentin <edubezval@gmail.com>
Date2016-03-14 21:00 +0100
SubjectRe: [PATCH 04/13] hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register
Message-ID<rcGOK-8hS-13@gated-at.bofh.it>
In reply to#1354783

[Multipart message — attachments visible in raw view] — view raw

On Wed, Mar 09, 2016 at 06:29:17PM -0800, Guenter Roeck wrote:
> On 03/09/2016 01:35 PM, Eduardo Valentin wrote:
> >This changes the driver to use the devm_ version
> >of thermal_zone_of_sensor_register and cleans
> >up the  local points and unregister calls.
> >
> >Cc: Jean Delvare <jdelvare@suse.com>
> >Cc: Guenter Roeck <linux@roeck-us.net>
> >Cc: lm-sensors@lm-sensors.org
> >Cc: linux-kernel@vger.kernel.org
> >Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> >---
> >  drivers/hwmon/scpi-hwmon.c | 41 ++++++++---------------------------------
> >  1 file changed, 8 insertions(+), 33 deletions(-)
> >
> >diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c
> >index 7e20567..2309e47 100644
> >--- a/drivers/hwmon/scpi-hwmon.c
> >+++ b/drivers/hwmon/scpi-hwmon.c
> >@@ -31,10 +31,8 @@ struct sensor_data {
> >  };
> >
> >  struct scpi_thermal_zone {
> >-	struct list_head list;
> >  	int sensor_id;
> >  	struct scpi_sensors *scpi_sensors;
> >-	struct thermal_zone_device *tzd;
> >  };
> >
> >  struct scpi_sensors {
> >@@ -92,20 +90,6 @@ scpi_show_label(struct device *dev, struct device_attribute *attr, char *buf)
> >  	return sprintf(buf, "%s\n", sensor->info.name);
> >  }
> >
> >-static void
> >-unregister_thermal_zones(struct platform_device *pdev,
> >-			 struct scpi_sensors *scpi_sensors)
> >-{
> >-	struct list_head *pos;
> >-
> >-	list_for_each(pos, &scpi_sensors->thermal_zones) {
> >-		struct scpi_thermal_zone *zone;
> >-
> >-		zone = list_entry(pos, struct scpi_thermal_zone, list);
> >-		thermal_zone_of_sensor_unregister(&pdev->dev, zone->tzd);
> >-	}
> >-}
> >-
> >  static struct thermal_zone_of_device_ops scpi_sensor_ops = {
> >  	.get_temp = scpi_read_temp,
> >  };
> >@@ -224,6 +208,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
> >  	INIT_LIST_HEAD(&scpi_sensors->thermal_zones);
> >  	for (i = 0; i < nr_sensors; i++) {
> >  		struct sensor_data *sensor = &scpi_sensors->data[i];
> >+		struct thermal_zone_device *z;
> >  		struct scpi_thermal_zone *zone;
> >
> >  		if (sensor->info.class != TEMPERATURE)
> >@@ -232,42 +217,33 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
> >  		zone = devm_kzalloc(dev, sizeof(*zone), GFP_KERNEL);
> >  		if (!zone) {
> >  			ret = -ENOMEM;
> >-			goto unregister_tzd;
> >+			goto mfail;
> 
> 			return -ENOMEM;
> 
> ... and drop the unnecessary label.

True. I will change as requested.

Thanks

[toc] | [prev] | [next] | [standalone]


#1354485 — [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register

FromEduardo Valentin <edubezval@gmail.com>
Date2016-03-09 22:40 +0100
Subject[PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register
Message-ID<raTZO-5nL-47@gated-at.bofh.it>
In reply to#1354480
This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the  local points and unregister calls.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
 drivers/thermal/tegra_soctherm.c | 31 +++++++++----------------------
 1 file changed, 9 insertions(+), 22 deletions(-)

diff --git a/drivers/thermal/tegra_soctherm.c b/drivers/thermal/tegra_soctherm.c
index 74ea576..0018ccd 100644
--- a/drivers/thermal/tegra_soctherm.c
+++ b/drivers/thermal/tegra_soctherm.c
@@ -168,7 +168,7 @@ struct tegra_soctherm {
 	struct clk *clock_soctherm;
 	void __iomem *regs;
 
-	struct thermal_zone_device *thermctl_tzs[4];
+#define ZONE_NUMBER		4
 };
 
 struct tsensor_shared_calibration {
@@ -342,7 +342,7 @@ static const struct thermctl_zone_desc t124_thermctl_temp_zones[] = {
 static int tegra_soctherm_probe(struct platform_device *pdev)
 {
 	struct tegra_soctherm *tegra;
-	struct thermal_zone_device *tz;
+	struct thermal_zone_device *z;
 	struct tsensor_shared_calibration shared_calib;
 	struct resource *res;
 	unsigned int i;
@@ -408,36 +408,29 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
 
 	/* Initialize thermctl sensors */
 
-	for (i = 0; i < ARRAY_SIZE(tegra->thermctl_tzs); ++i) {
+	for (i = 0; i < ZONE_NUMBER; ++i) {
 		struct tegra_thermctl_zone *zone =
 			devm_kzalloc(&pdev->dev, sizeof(*zone), GFP_KERNEL);
 		if (!zone) {
 			err = -ENOMEM;
-			goto unregister_tzs;
+			goto disable_clocks;
 		}
 
 		zone->reg = tegra->regs + t124_thermctl_temp_zones[i].offset;
 		zone->shift = t124_thermctl_temp_zones[i].shift;
 
-		tz = thermal_zone_of_sensor_register(&pdev->dev, i, zone,
-						     &tegra_of_thermal_ops);
-		if (IS_ERR(tz)) {
-			err = PTR_ERR(tz);
+		z = devm_thermal_zone_of_sensor_register(&pdev->dev, i, zone,
+							 &tegra_of_thermal_ops);
+		if (IS_ERR(z)) {
+			err = PTR_ERR(z);
 			dev_err(&pdev->dev, "failed to register sensor: %d\n",
 				err);
-			goto unregister_tzs;
+			goto disable_clocks;
 		}
-
-		tegra->thermctl_tzs[i] = tz;
 	}
 
 	return 0;
 
-unregister_tzs:
-	while (i--)
-		thermal_zone_of_sensor_unregister(&pdev->dev,
-						  tegra->thermctl_tzs[i]);
-
 disable_clocks:
 	clk_disable_unprepare(tegra->clock_tsensor);
 	clk_disable_unprepare(tegra->clock_soctherm);
@@ -448,12 +441,6 @@ disable_clocks:
 static int tegra_soctherm_remove(struct platform_device *pdev)
 {
 	struct tegra_soctherm *tegra = platform_get_drvdata(pdev);
-	unsigned int i;
-
-	for (i = 0; i < ARRAY_SIZE(tegra->thermctl_tzs); ++i) {
-		thermal_zone_of_sensor_unregister(&pdev->dev,
-						  tegra->thermctl_tzs[i]);
-	}
 
 	clk_disable_unprepare(tegra->clock_tsensor);
 	clk_disable_unprepare(tegra->clock_soctherm);
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1354926 — Re: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register

FromWei Ni <wni@nvidia.com>
Date2016-03-10 09:50 +0100
SubjectRe: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register
Message-ID<rb4s9-4iX-3@gated-at.bofh.it>
In reply to#1354485

On 2016年03月10日 05:35, Eduardo Valentin wrote:
> This changes the driver to use the devm_ version
> of thermal_zone_of_sensor_register and cleans
> up the  local points and unregister calls.
> 
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Stephen Warren <swarren@wwwdotorg.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Alexandre Courbot <gnurou@gmail.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-tegra@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> ---
>  drivers/thermal/tegra_soctherm.c | 31 +++++++++----------------------
>  1 file changed, 9 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/thermal/tegra_soctherm.c b/drivers/thermal/tegra_soctherm.c
> index 74ea576..0018ccd 100644
> --- a/drivers/thermal/tegra_soctherm.c
> +++ b/drivers/thermal/tegra_soctherm.c
> @@ -168,7 +168,7 @@ struct tegra_soctherm {
>  	struct clk *clock_soctherm;
>  	void __iomem *regs;
>  
> -	struct thermal_zone_device *thermctl_tzs[4];
> +#define ZONE_NUMBER		4
>  };
>  
>  struct tsensor_shared_calibration {
> @@ -342,7 +342,7 @@ static const struct thermctl_zone_desc t124_thermctl_temp_zones[] = {
>  static int tegra_soctherm_probe(struct platform_device *pdev)
>  {
>  	struct tegra_soctherm *tegra;
> -	struct thermal_zone_device *tz;
> +	struct thermal_zone_device *z;
>  	struct tsensor_shared_calibration shared_calib;
>  	struct resource *res;
>  	unsigned int i;
> @@ -408,36 +408,29 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
>  
>  	/* Initialize thermctl sensors */
>  
> -	for (i = 0; i < ARRAY_SIZE(tegra->thermctl_tzs); ++i) {
> +	for (i = 0; i < ZONE_NUMBER; ++i) {
>  		struct tegra_thermctl_zone *zone =
>  			devm_kzalloc(&pdev->dev, sizeof(*zone), GFP_KERNEL);
>  		if (!zone) {
>  			err = -ENOMEM;
> -			goto unregister_tzs;
> +			goto disable_clocks;
>  		}
>  
>  		zone->reg = tegra->regs + t124_thermctl_temp_zones[i].offset;
>  		zone->shift = t124_thermctl_temp_zones[i].shift;
>  
> -		tz = thermal_zone_of_sensor_register(&pdev->dev, i, zone,
> -						     &tegra_of_thermal_ops);
> -		if (IS_ERR(tz)) {
> -			err = PTR_ERR(tz);
> +		z = devm_thermal_zone_of_sensor_register(&pdev->dev, i, zone,

I prefer to still use "tz", it seems this line isn't over 80 characters, or we
can add newline.

> +							 &tegra_of_thermal_ops);
> +		if (IS_ERR(z)) {
> +			err = PTR_ERR(z);
>  			dev_err(&pdev->dev, "failed to register sensor: %d\n",
>  				err);
> -			goto unregister_tzs;
> +			goto disable_clocks;
>  		}
> -
> -		tegra->thermctl_tzs[i] = tz;
>  	}
>  
>  	return 0;
>  
> -unregister_tzs:
> -	while (i--)
> -		thermal_zone_of_sensor_unregister(&pdev->dev,
> -						  tegra->thermctl_tzs[i]);
> -
>  disable_clocks:
>  	clk_disable_unprepare(tegra->clock_tsensor);
>  	clk_disable_unprepare(tegra->clock_soctherm);
> @@ -448,12 +441,6 @@ disable_clocks:
>  static int tegra_soctherm_remove(struct platform_device *pdev)
>  {
>  	struct tegra_soctherm *tegra = platform_get_drvdata(pdev);
> -	unsigned int i;
> -
> -	for (i = 0; i < ARRAY_SIZE(tegra->thermctl_tzs); ++i) {
> -		thermal_zone_of_sensor_unregister(&pdev->dev,
> -						  tegra->thermctl_tzs[i]);
> -	}
>  
>  	clk_disable_unprepare(tegra->clock_tsensor);
>  	clk_disable_unprepare(tegra->clock_soctherm);
> 

[toc] | [prev] | [next] | [standalone]


#1357634 — Re: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register

FromEduardo Valentin <edubezval@gmail.com>
Date2016-03-14 22:20 +0100
SubjectRe: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register
Message-ID<rcI4a-P4-1@gated-at.bofh.it>
In reply to#1354926

[Multipart message — attachments visible in raw view] — view raw

On Thu, Mar 10, 2016 at 04:46:55PM +0800, Wei Ni wrote:
> 
> 
> On 2016年03月10日 05:35, Eduardo Valentin wrote:
> > This changes the driver to use the devm_ version
> > of thermal_zone_of_sensor_register and cleans
> > up the  local points and unregister calls.
> > 
> > Cc: Zhang Rui <rui.zhang@intel.com>
> > Cc: Stephen Warren <swarren@wwwdotorg.org>
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Cc: Alexandre Courbot <gnurou@gmail.com>
> > Cc: linux-pm@vger.kernel.org
> > Cc: linux-tegra@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> > ---
> >  drivers/thermal/tegra_soctherm.c | 31 +++++++++----------------------
> >  1 file changed, 9 insertions(+), 22 deletions(-)
> > 
> > diff --git a/drivers/thermal/tegra_soctherm.c b/drivers/thermal/tegra_soctherm.c
> > index 74ea576..0018ccd 100644
> > --- a/drivers/thermal/tegra_soctherm.c
> > +++ b/drivers/thermal/tegra_soctherm.c
> > @@ -168,7 +168,7 @@ struct tegra_soctherm {
> >  	struct clk *clock_soctherm;
> >  	void __iomem *regs;
> >  
> > -	struct thermal_zone_device *thermctl_tzs[4];
> > +#define ZONE_NUMBER		4
> >  };
> >  
> >  struct tsensor_shared_calibration {
> > @@ -342,7 +342,7 @@ static const struct thermctl_zone_desc t124_thermctl_temp_zones[] = {
> >  static int tegra_soctherm_probe(struct platform_device *pdev)
> >  {
> >  	struct tegra_soctherm *tegra;
> > -	struct thermal_zone_device *tz;
> > +	struct thermal_zone_device *z;
> >  	struct tsensor_shared_calibration shared_calib;
> >  	struct resource *res;
> >  	unsigned int i;
> > @@ -408,36 +408,29 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
> >  
> >  	/* Initialize thermctl sensors */
> >  
> > -	for (i = 0; i < ARRAY_SIZE(tegra->thermctl_tzs); ++i) {
> > +	for (i = 0; i < ZONE_NUMBER; ++i) {
> >  		struct tegra_thermctl_zone *zone =
> >  			devm_kzalloc(&pdev->dev, sizeof(*zone), GFP_KERNEL);
> >  		if (!zone) {
> >  			err = -ENOMEM;
> > -			goto unregister_tzs;
> > +			goto disable_clocks;
> >  		}
> >  
> >  		zone->reg = tegra->regs + t124_thermctl_temp_zones[i].offset;
> >  		zone->shift = t124_thermctl_temp_zones[i].shift;
> >  
> > -		tz = thermal_zone_of_sensor_register(&pdev->dev, i, zone,
> > -						     &tegra_of_thermal_ops);
> > -		if (IS_ERR(tz)) {
> > -			err = PTR_ERR(tz);
> > +		z = devm_thermal_zone_of_sensor_register(&pdev->dev, i, zone,
> 
> I prefer to still use "tz", it seems this line isn't over 80 characters, or we
> can add newline.


Yeah,


> 
> > +							 &tegra_of_thermal_ops);

CHECK: Alignment should match open parenthesis
#423: FILE: drivers/thermal/tegra_soctherm.c:423:
+		tz = devm_thermal_zone_of_sensor_register(&pdev->dev, i, zone,
+							 &tegra_of_thermal_ops);

and if you align it, then, you get the warning:
WARNING: line over 80 characters
#423: FILE: drivers/thermal/tegra_soctherm.c:423:
+							  &tegra_of_thermal_ops);

And I did not want to add either of the above to the driver. 

But if you prefer tz over z, we can keep the first (check) then.

What do you prefer?




[toc] | [prev] | [next] | [standalone]


#1357812 — Re: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register

FromWei Ni <wni@nvidia.com>
Date2016-03-15 06:50 +0100
SubjectRe: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register
Message-ID<rcQ1H-6eo-3@gated-at.bofh.it>
In reply to#1357634

On 2016年03月15日 05:16, Eduardo Valentin wrote:
> * PGP Signed by an unknown key
> 
> On Thu, Mar 10, 2016 at 04:46:55PM +0800, Wei Ni wrote:
>>
>>
>> On 2016年03月10日 05:35, Eduardo Valentin wrote:
>>> This changes the driver to use the devm_ version
>>> of thermal_zone_of_sensor_register and cleans
>>> up the  local points and unregister calls.
>>>
>>> Cc: Zhang Rui <rui.zhang@intel.com>
>>> Cc: Stephen Warren <swarren@wwwdotorg.org>
>>> Cc: Thierry Reding <thierry.reding@gmail.com>
>>> Cc: Alexandre Courbot <gnurou@gmail.com>
>>> Cc: linux-pm@vger.kernel.org
>>> Cc: linux-tegra@vger.kernel.org
>>> Cc: linux-kernel@vger.kernel.org
>>> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
>>> ---
>>>  drivers/thermal/tegra_soctherm.c | 31 +++++++++----------------------
>>>  1 file changed, 9 insertions(+), 22 deletions(-)
>>>
>>> diff --git a/drivers/thermal/tegra_soctherm.c b/drivers/thermal/tegra_soctherm.c
>>> index 74ea576..0018ccd 100644
>>> --- a/drivers/thermal/tegra_soctherm.c
>>> +++ b/drivers/thermal/tegra_soctherm.c
>>> @@ -168,7 +168,7 @@ struct tegra_soctherm {
>>>  	struct clk *clock_soctherm;
>>>  	void __iomem *regs;
>>>  
>>> -	struct thermal_zone_device *thermctl_tzs[4];
>>> +#define ZONE_NUMBER		4
>>>  };
>>>  
>>>  struct tsensor_shared_calibration {
>>> @@ -342,7 +342,7 @@ static const struct thermctl_zone_desc t124_thermctl_temp_zones[] = {
>>>  static int tegra_soctherm_probe(struct platform_device *pdev)
>>>  {
>>>  	struct tegra_soctherm *tegra;
>>> -	struct thermal_zone_device *tz;
>>> +	struct thermal_zone_device *z;
>>>  	struct tsensor_shared_calibration shared_calib;
>>>  	struct resource *res;
>>>  	unsigned int i;
>>> @@ -408,36 +408,29 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
>>>  
>>>  	/* Initialize thermctl sensors */
>>>  
>>> -	for (i = 0; i < ARRAY_SIZE(tegra->thermctl_tzs); ++i) {
>>> +	for (i = 0; i < ZONE_NUMBER; ++i) {
>>>  		struct tegra_thermctl_zone *zone =
>>>  			devm_kzalloc(&pdev->dev, sizeof(*zone), GFP_KERNEL);
>>>  		if (!zone) {
>>>  			err = -ENOMEM;
>>> -			goto unregister_tzs;
>>> +			goto disable_clocks;
>>>  		}
>>>  
>>>  		zone->reg = tegra->regs + t124_thermctl_temp_zones[i].offset;
>>>  		zone->shift = t124_thermctl_temp_zones[i].shift;
>>>  
>>> -		tz = thermal_zone_of_sensor_register(&pdev->dev, i, zone,
>>> -						     &tegra_of_thermal_ops);
>>> -		if (IS_ERR(tz)) {
>>> -			err = PTR_ERR(tz);
>>> +		z = devm_thermal_zone_of_sensor_register(&pdev->dev, i, zone,
>>
>> I prefer to still use "tz", it seems this line isn't over 80 characters, or we
>> can add newline.
> 
> 
> Yeah,
> 
> 
>>
>>> +							 &tegra_of_thermal_ops);
> 
> CHECK: Alignment should match open parenthesis
> #423: FILE: drivers/thermal/tegra_soctherm.c:423:
> +		tz = devm_thermal_zone_of_sensor_register(&pdev->dev, i, zone,
> +							 &tegra_of_thermal_ops);
> 
> and if you align it, then, you get the warning:
> WARNING: line over 80 characters
> #423: FILE: drivers/thermal/tegra_soctherm.c:423:
> +							  &tegra_of_thermal_ops);
> 
> And I did not want to add either of the above to the driver. 
> 
> But if you prefer tz over z, we can keep the first (check) then.
> 
> What do you prefer?

Hmm, I see.
Ok, it's better to use "z" to resolve it.

Wei.
> 
> 
> 
> 
> 
> * Unknown Key
> * 0x7DA4E256
> 

[toc] | [prev] | [next] | [standalone]


#1354486 — [PATCH 06/13] thermal: convert hisi_thermal to use devm_thermal_zone_of_sensor_register

FromEduardo Valentin <edubezval@gmail.com>
Date2016-03-09 22:40 +0100
Subject[PATCH 06/13] thermal: convert hisi_thermal to use devm_thermal_zone_of_sensor_register
Message-ID<raTZO-5nL-45@gated-at.bofh.it>
In reply to#1354480
This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the  local points and unregister calls.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
 drivers/thermal/hisi_thermal.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c
index 36d0729..c9b2f81 100644
--- a/drivers/thermal/hisi_thermal.c
+++ b/drivers/thermal/hisi_thermal.c
@@ -243,8 +243,8 @@ static int hisi_thermal_register_sensor(struct platform_device *pdev,
 	sensor->id = index;
 	sensor->thermal = data;
 
-	sensor->tzd = thermal_zone_of_sensor_register(&pdev->dev, sensor->id,
-				sensor, &hisi_of_thermal_ops);
+	sensor->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev,
+				sensor->id, sensor, &hisi_of_thermal_ops);
 	if (IS_ERR(sensor->tzd)) {
 		ret = PTR_ERR(sensor->tzd);
 		dev_err(&pdev->dev, "failed to register sensor id %d: %d\n",
@@ -364,7 +364,6 @@ static int hisi_thermal_remove(struct platform_device *pdev)
 		struct hisi_thermal_sensor *sensor = &data->sensors[i];
 
 		hisi_thermal_toggle_sensor(sensor, false);
-		thermal_zone_of_sensor_unregister(&pdev->dev, sensor->tzd);
 	}
 
 	hisi_thermal_disable_sensor(data);
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1354487 — [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register

FromEduardo Valentin <edubezval@gmail.com>
Date2016-03-09 22:40 +0100
Subject[PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register
Message-ID<raTZO-5nL-49@gated-at.bofh.it>
In reply to#1354480
This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the  local points and unregister calls.

Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
 drivers/thermal/samsung/exynos_tmu.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index fa61eff..256039e 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -1363,8 +1363,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)
 	 * data->tzd must be registered before calling exynos_tmu_initialize(),
 	 * requesting irq and calling exynos_tmu_control().
 	 */
-	data->tzd = thermal_zone_of_sensor_register(&pdev->dev, 0, data,
-						    &exynos_sensor_ops);
+	data->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, data,
+							 &exynos_sensor_ops);
 	if (IS_ERR(data->tzd)) {
 		ret = PTR_ERR(data->tzd);
 		dev_err(&pdev->dev, "Failed to register sensor: %d\n", ret);
@@ -1374,21 +1374,19 @@ static int exynos_tmu_probe(struct platform_device *pdev)
 	ret = exynos_tmu_initialize(pdev);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to initialize TMU\n");
-		goto err_thermal;
+		goto err_sclk;
 	}
 
 	ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq,
 		IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq);
-		goto err_thermal;
+		goto err_sclk;
 	}
 
 	exynos_tmu_control(pdev, true);
 	return 0;
 
-err_thermal:
-	thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);
 err_sclk:
 	clk_disable_unprepare(data->sclk);
 err_clk:
@@ -1406,9 +1404,7 @@ err_sensor:
 static int exynos_tmu_remove(struct platform_device *pdev)
 {
 	struct exynos_tmu_data *data = platform_get_drvdata(pdev);
-	struct thermal_zone_device *tzd = data->tzd;
 
-	thermal_zone_of_sensor_unregister(&pdev->dev, tzd);
 	exynos_tmu_control(pdev, false);
 
 	clk_disable_unprepare(data->sclk);
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1354706 — Re: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register

FromKrzysztof Kozlowski <k.kozlowski@samsung.com>
Date2016-03-10 01:20 +0100
SubjectRe: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register
Message-ID<raWuC-7q3-3@gated-at.bofh.it>
In reply to#1354487
On 10.03.2016 06:35, Eduardo Valentin wrote:
> This changes the driver to use the devm_ version
> of thermal_zone_of_sensor_register and cleans
> up the  local points and unregister calls.
> 
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-samsung-soc@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> ---
>  drivers/thermal/samsung/exynos_tmu.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index fa61eff..256039e 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -1363,8 +1363,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>  	 * data->tzd must be registered before calling exynos_tmu_initialize(),
>  	 * requesting irq and calling exynos_tmu_control().
>  	 */
> -	data->tzd = thermal_zone_of_sensor_register(&pdev->dev, 0, data,
> -						    &exynos_sensor_ops);
> +	data->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, data,
> +							 &exynos_sensor_ops);
>  	if (IS_ERR(data->tzd)) {
>  		ret = PTR_ERR(data->tzd);
>  		dev_err(&pdev->dev, "Failed to register sensor: %d\n", ret);
> @@ -1374,21 +1374,19 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>  	ret = exynos_tmu_initialize(pdev);
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to initialize TMU\n");
> -		goto err_thermal;
> +		goto err_sclk;
>  	}
>  
>  	ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq,
>  		IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data);
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq);
> -		goto err_thermal;
> +		goto err_sclk;
>  	}
>  
>  	exynos_tmu_control(pdev, true);
>  	return 0;
>  
> -err_thermal:
> -	thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);
>  err_sclk:
>  	clk_disable_unprepare(data->sclk);
>  err_clk:
> @@ -1406,9 +1404,7 @@ err_sensor:
>  static int exynos_tmu_remove(struct platform_device *pdev)
>  {
>  	struct exynos_tmu_data *data = platform_get_drvdata(pdev);
> -	struct thermal_zone_device *tzd = data->tzd;
>  
> -	thermal_zone_of_sensor_unregister(&pdev->dev, tzd);

Before, the sensor was removed from zone (ops like get_temp NULL-ified
etc), then we stopped TMU, disabled clocks, disabled regulator and
finally freed IRQ (through devm-like interface).

Now this will be different - first stop of TMU, disable clocks, disable,
regulator, remove sensor from zone (through devm) and finally free IRQ.

Are you sure that changing order is okay?

Best regards,
Krzysztof

>  	exynos_tmu_control(pdev, false);
>  
>  	clk_disable_unprepare(data->sclk);
> 

[toc] | [prev] | [next] | [standalone]


#1357582 — Re: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register

FromEduardo Valentin <edubezval@gmail.com>
Date2016-03-14 20:50 +0100
SubjectRe: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register
Message-ID<rcGF5-8ey-31@gated-at.bofh.it>
In reply to#1354706
On Thu, Mar 10, 2016 at 09:16:36AM +0900, Krzysztof Kozlowski wrote:
> On 10.03.2016 06:35, Eduardo Valentin wrote:
> > This changes the driver to use the devm_ version
> > of thermal_zone_of_sensor_register and cleans
> > up the  local points and unregister calls.
> > 
> > Cc: Lukasz Majewski <l.majewski@samsung.com>
> > Cc: Zhang Rui <rui.zhang@intel.com>
> > Cc: Kukjin Kim <kgene@kernel.org>
> > Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Cc: linux-pm@vger.kernel.org
> > Cc: linux-samsung-soc@vger.kernel.org
> > Cc: linux-arm-kernel@lists.infradead.org
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> > ---
> >  drivers/thermal/samsung/exynos_tmu.c | 12 ++++--------
> >  1 file changed, 4 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> > index fa61eff..256039e 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.c
> > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > @@ -1363,8 +1363,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)
> >  	 * data->tzd must be registered before calling exynos_tmu_initialize(),
> >  	 * requesting irq and calling exynos_tmu_control().
> >  	 */
> > -	data->tzd = thermal_zone_of_sensor_register(&pdev->dev, 0, data,
> > -						    &exynos_sensor_ops);
> > +	data->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, data,
> > +							 &exynos_sensor_ops);
> >  	if (IS_ERR(data->tzd)) {
> >  		ret = PTR_ERR(data->tzd);
> >  		dev_err(&pdev->dev, "Failed to register sensor: %d\n", ret);
> > @@ -1374,21 +1374,19 @@ static int exynos_tmu_probe(struct platform_device *pdev)
> >  	ret = exynos_tmu_initialize(pdev);
> >  	if (ret) {
> >  		dev_err(&pdev->dev, "Failed to initialize TMU\n");
> > -		goto err_thermal;
> > +		goto err_sclk;
> >  	}
> >  
> >  	ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq,
> >  		IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data);
> >  	if (ret) {
> >  		dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq);
> > -		goto err_thermal;
> > +		goto err_sclk;
> >  	}
> >  
> >  	exynos_tmu_control(pdev, true);
> >  	return 0;
> >  
> > -err_thermal:
> > -	thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);
> >  err_sclk:
> >  	clk_disable_unprepare(data->sclk);
> >  err_clk:
> > @@ -1406,9 +1404,7 @@ err_sensor:
> >  static int exynos_tmu_remove(struct platform_device *pdev)
> >  {
> >  	struct exynos_tmu_data *data = platform_get_drvdata(pdev);
> > -	struct thermal_zone_device *tzd = data->tzd;
> >  
> > -	thermal_zone_of_sensor_unregister(&pdev->dev, tzd);
> 
> Before, the sensor was removed from zone (ops like get_temp NULL-ified
> etc), then we stopped TMU, disabled clocks, disabled regulator and
> finally freed IRQ (through devm-like interface).
> 
> Now this will be different - first stop of TMU, disable clocks, disable,
> regulator, remove sensor from zone (through devm) and finally free IRQ.
> 
> Are you sure that changing order is okay?

Not really. After checking the driver code and your suggestions, I don't
think this driver would benefit of this change, not at least the way it
is currently.

Thanks for pointing out. I am taking this driver out of the series.


> 
> Best regards,
> Krzysztof
> 
> >  	exynos_tmu_control(pdev, false);
> >  
> >  	clk_disable_unprepare(data->sclk);
> > 
> 

[toc] | [prev] | [next] | [standalone]


#1354947 — Re: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register

FromLukasz Majewski <l.majewski@samsung.com>
Date2016-03-10 10:20 +0100
SubjectRe: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register
Message-ID<rb4Vd-4Jq-25@gated-at.bofh.it>
In reply to#1354487
Hi Eduardo,

> This changes the driver to use the devm_ version
> of thermal_zone_of_sensor_register and cleans
> up the  local points and unregister calls.
> 
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-samsung-soc@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> ---
>  drivers/thermal/samsung/exynos_tmu.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c
> b/drivers/thermal/samsung/exynos_tmu.c index fa61eff..256039e 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -1363,8 +1363,8 @@ static int exynos_tmu_probe(struct
> platform_device *pdev)
>  	 * data->tzd must be registered before calling
> exynos_tmu_initialize(),
>  	 * requesting irq and calling exynos_tmu_control().
>  	 */
> -	data->tzd = thermal_zone_of_sensor_register(&pdev->dev, 0,
> data,
> -
> &exynos_sensor_ops);
> +	data->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev,
> 0, data,
> +
> &exynos_sensor_ops); if (IS_ERR(data->tzd)) {
>  		ret = PTR_ERR(data->tzd);
>  		dev_err(&pdev->dev, "Failed to register sensor:
> %d\n", ret); @@ -1374,21 +1374,19 @@ static int
> exynos_tmu_probe(struct platform_device *pdev) ret =
> exynos_tmu_initialize(pdev); if (ret) {
>  		dev_err(&pdev->dev, "Failed to initialize TMU\n");
> -		goto err_thermal;
> +		goto err_sclk;
>  	}
>  
>  	ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq,
>  		IRQF_TRIGGER_RISING | IRQF_SHARED,
> dev_name(&pdev->dev), data); if (ret) {
>  		dev_err(&pdev->dev, "Failed to request irq: %d\n",
> data->irq);
> -		goto err_thermal;
> +		goto err_sclk;
>  	}
>  
>  	exynos_tmu_control(pdev, true);
>  	return 0;
>  
> -err_thermal:
> -	thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);
>  err_sclk:
>  	clk_disable_unprepare(data->sclk);
>  err_clk:
> @@ -1406,9 +1404,7 @@ err_sensor:
>  static int exynos_tmu_remove(struct platform_device *pdev)
>  {
>  	struct exynos_tmu_data *data = platform_get_drvdata(pdev);
> -	struct thermal_zone_device *tzd = data->tzd;
>  
> -	thermal_zone_of_sensor_unregister(&pdev->dev, tzd);
>  	exynos_tmu_control(pdev, false);
>  
>  	clk_disable_unprepare(data->sclk);

Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web