[01/13] hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register
diff mbox

Message ID 1457559336-17652-2-git-send-email-edubezval@gmail.com
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/lm75.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

kernel test robot March 10, 2016, 12:02 a.m. UTC | #1
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/lm75.c: In function 'lm75_probe':
>> drivers/hwmon/lm75.c:308:2: error: implicit declaration of function 'devm_thermal_zone_of_sensor_register' [-Werror=implicit-function-declaration]
     devm_thermal_zone_of_sensor_register(data->hwmon_dev, 0,
     ^
   cc1: some warnings being treated as errors

vim +/devm_thermal_zone_of_sensor_register +308 drivers/hwmon/lm75.c

   302	
   303		data->hwmon_dev = hwmon_device_register_with_groups(dev, client->name,
   304								    data, lm75_groups);
   305		if (IS_ERR(data->hwmon_dev))
   306			return PTR_ERR(data->hwmon_dev);
   307	
 > 308		devm_thermal_zone_of_sensor_register(data->hwmon_dev, 0,
   309						     data->hwmon_dev,
   310						     &lm75_of_thermal_ops);
   311	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Guenter Roeck March 10, 2016, 3:18 a.m. UTC | #2
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/lm75.c | 10 +++-------
>   1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
> index 0addc84..69166ab 100644
> --- a/drivers/hwmon/lm75.c
> +++ b/drivers/hwmon/lm75.c
> @@ -77,7 +77,6 @@ static const u8 LM75_REG_TEMP[3] = {
>   struct lm75_data {
>   	struct i2c_client	*client;
>   	struct device		*hwmon_dev;
> -	struct thermal_zone_device	*tz;
>   	struct mutex		update_lock;
>   	u8			orig_conf;
>   	u8			resolution;	/* In bits, between 9 and 12 */
> @@ -306,11 +305,9 @@ lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)
>   	if (IS_ERR(data->hwmon_dev))
>   		return PTR_ERR(data->hwmon_dev);
>
> -	data->tz = thermal_zone_of_sensor_register(data->hwmon_dev, 0,
> -						   data->hwmon_dev,
> -						   &lm75_of_thermal_ops);
> -	if (IS_ERR(data->tz))
> -		data->tz = NULL;
> +	devm_thermal_zone_of_sensor_register(data->hwmon_dev, 0,
> +					     data->hwmon_dev,
> +					     &lm75_of_thermal_ops);
>
>   	dev_info(dev, "%s: sensor '%s'\n",
>   		 dev_name(data->hwmon_dev), client->name);
> @@ -322,7 +319,6 @@ static int lm75_remove(struct i2c_client *client)
>   {
>   	struct lm75_data *data = i2c_get_clientdata(client);
>
> -	thermal_zone_of_sensor_unregister(data->hwmon_dev, data->tz);
>   	hwmon_device_unregister(data->hwmon_dev);
>   	lm75_write_value(client, LM75_REG_CONF, data->orig_conf);
>   	return 0;
>

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

Patch
diff mbox

diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index 0addc84..69166ab 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -77,7 +77,6 @@  static const u8 LM75_REG_TEMP[3] = {
 struct lm75_data {
 	struct i2c_client	*client;
 	struct device		*hwmon_dev;
-	struct thermal_zone_device	*tz;
 	struct mutex		update_lock;
 	u8			orig_conf;
 	u8			resolution;	/* In bits, between 9 and 12 */
@@ -306,11 +305,9 @@  lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	if (IS_ERR(data->hwmon_dev))
 		return PTR_ERR(data->hwmon_dev);
 
-	data->tz = thermal_zone_of_sensor_register(data->hwmon_dev, 0,
-						   data->hwmon_dev,
-						   &lm75_of_thermal_ops);
-	if (IS_ERR(data->tz))
-		data->tz = NULL;
+	devm_thermal_zone_of_sensor_register(data->hwmon_dev, 0,
+					     data->hwmon_dev,
+					     &lm75_of_thermal_ops);
 
 	dev_info(dev, "%s: sensor '%s'\n",
 		 dev_name(data->hwmon_dev), client->name);
@@ -322,7 +319,6 @@  static int lm75_remove(struct i2c_client *client)
 {
 	struct lm75_data *data = i2c_get_clientdata(client);
 
-	thermal_zone_of_sensor_unregister(data->hwmon_dev, data->tz);
 	hwmon_device_unregister(data->hwmon_dev);
 	lm75_write_value(client, LM75_REG_CONF, data->orig_conf);
 	return 0;