Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965045AbcCJDUd (ORCPT ); Wed, 9 Mar 2016 22:20:33 -0500 Received: from forward.webhostbox.net ([5.100.155.124]:41737 "EHLO forward.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934596AbcCJDUc (ORCPT ); Wed, 9 Mar 2016 22:20:32 -0500 Subject: Re: [PATCH 03/13] hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register To: Eduardo Valentin , Rui Zhang References: <1457559336-17652-1-git-send-email-edubezval@gmail.com> <1457559336-17652-4-git-send-email-edubezval@gmail.com> Cc: Linux PM , LKML , lm-sensors@lm-sensors.org, Jean Delvare From: Guenter Roeck Message-ID: <56E0E7FA.4030400@roeck-us.net> Date: Wed, 9 Mar 2016 19:20:26 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1457559336-17652-4-git-send-email-edubezval@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated_sender: linux@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=NfdGrz34 c=1 sm=1 tr=0 a=QNED+QcLUkoL9qulTODnwA==:117 a=2cfIYNtKkjgZNaOwnGXpGw==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=N659UExz7-8A:10 a=7OsogOcEt9IA:10 a=wqjDAO3sHL17RyNg200A:9 a=pILNOxqGKmIA:10 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1699 Lines: 51 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 > Cc: Guenter Roeck > Cc: lm-sensors@lm-sensors.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Eduardo Valentin Acked-by: Guenter Roeck > --- > 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 */ >