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


Groups > linux.kernel > #1354474 > unrolled thread

[PATCH 03/13] hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register

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

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 03/13] hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register Eduardo Valentin <edubezval@gmail.com> - 2016-03-09 22:40 +0100
    Re: [PATCH 03/13] hwmon: convert tmp102 to use  devm_thermal_zone_of_sensor_register Guenter Roeck <linux@roeck-us.net> - 2016-03-10 04:30 +0100

#1354474 — [PATCH 03/13] hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register

FromEduardo Valentin <edubezval@gmail.com>
Date2016-03-09 22:40 +0100
Subject[PATCH 03/13] hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register
Message-ID<raTZM-5nL-13@gated-at.bofh.it>
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/tmp102.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
index 5289aa0..f1e96fd 100644
--- a/drivers/hwmon/tmp102.c
+++ b/drivers/hwmon/tmp102.c
@@ -53,7 +53,6 @@
 struct tmp102 {
 	struct i2c_client *client;
 	struct device *hwmon_dev;
-	struct thermal_zone_device *tz;
 	struct mutex lock;
 	u16 config_orig;
 	unsigned long last_update;
@@ -232,10 +231,8 @@ static int tmp102_probe(struct i2c_client *client,
 		goto fail_restore_config;
 	}
 	tmp102->hwmon_dev = hwmon_dev;
-	tmp102->tz = thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
-						     &tmp102_of_thermal_ops);
-	if (IS_ERR(tmp102->tz))
-		tmp102->tz = NULL;
+	devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
+					     &tmp102_of_thermal_ops);
 
 	dev_info(dev, "initialized\n");
 
@@ -251,7 +248,6 @@ static int tmp102_remove(struct i2c_client *client)
 {
 	struct tmp102 *tmp102 = i2c_get_clientdata(client);
 
-	thermal_zone_of_sensor_unregister(tmp102->hwmon_dev, tmp102->tz);
 	hwmon_device_unregister(tmp102->hwmon_dev);
 
 	/* Stop monitoring if device was stopped originally */
-- 
2.1.4

[toc] | [next] | [standalone]


#1354821 — Re: [PATCH 03/13] hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register

FromGuenter Roeck <linux@roeck-us.net>
Date2016-03-10 04:30 +0100
SubjectRe: [PATCH 03/13] hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register
Message-ID<raZst-Vy-3@gated-at.bofh.it>
In reply to#1354474
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>

Acked-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/hwmon/tmp102.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
> index 5289aa0..f1e96fd 100644
> --- a/drivers/hwmon/tmp102.c
> +++ b/drivers/hwmon/tmp102.c
> @@ -53,7 +53,6 @@
>   struct tmp102 {
>   	struct i2c_client *client;
>   	struct device *hwmon_dev;
> -	struct thermal_zone_device *tz;
>   	struct mutex lock;
>   	u16 config_orig;
>   	unsigned long last_update;
> @@ -232,10 +231,8 @@ static int tmp102_probe(struct i2c_client *client,
>   		goto fail_restore_config;
>   	}
>   	tmp102->hwmon_dev = hwmon_dev;
> -	tmp102->tz = thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
> -						     &tmp102_of_thermal_ops);
> -	if (IS_ERR(tmp102->tz))
> -		tmp102->tz = NULL;
> +	devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
> +					     &tmp102_of_thermal_ops);
>
>   	dev_info(dev, "initialized\n");
>
> @@ -251,7 +248,6 @@ static int tmp102_remove(struct i2c_client *client)
>   {
>   	struct tmp102 *tmp102 = i2c_get_clientdata(client);
>
> -	thermal_zone_of_sensor_unregister(tmp102->hwmon_dev, tmp102->tz);
>   	hwmon_device_unregister(tmp102->hwmon_dev);
>
>   	/* Stop monitoring if device was stopped originally */
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web