diff mbox

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

Message ID 1457559336-17652-4-git-send-email-edubezval@gmail.com (mailing list archive)
State Accepted
Delegated to: Eduardo Valentin
Headers show

Commit Message

Eduardo Valentin March 9, 2016, 9:35 p.m. UTC
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(-)

Comments

Guenter Roeck March 10, 2016, 3:20 a.m. UTC | #1
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 */
>

--
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
kernel test robot March 10, 2016, 4:43 a.m. UTC | #2
Hi Eduardo,

[auto build test ERROR on soc-thermal/next]
[also build test ERROR on v4.5-rc7 next-20160309]
[cannot apply to thermal/next]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Eduardo-Valentin/thermal-convert-users-of-thermal_zone_of_sensor_register-to-devm_/20160310-054318
base:   https://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal next
config: xtensa-allyesconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   drivers/hwmon/tmp102.c: In function 'tmp102_probe':
>> drivers/hwmon/tmp102.c:234:2: error: implicit declaration of function 'devm_thermal_zone_of_sensor_register' [-Werror=implicit-function-declaration]
     devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
     ^
   cc1: some warnings being treated as errors

vim +/devm_thermal_zone_of_sensor_register +234 drivers/hwmon/tmp102.c

   228		if (IS_ERR(hwmon_dev)) {
   229			dev_dbg(dev, "unable to register hwmon device\n");
   230			status = PTR_ERR(hwmon_dev);
   231			goto fail_restore_config;
   232		}
   233		tmp102->hwmon_dev = hwmon_dev;
 > 234		devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
   235						     &tmp102_of_thermal_ops);
   236	
   237		dev_info(dev, "initialized\n");

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

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 */