Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934968AbcCJDTz (ORCPT ); Wed, 9 Mar 2016 22:19:55 -0500 Received: from forward.webhostbox.net ([162.251.85.61]:47038 "EHLO forward.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934596AbcCJDTp (ORCPT ); Wed, 9 Mar 2016 22:19:45 -0500 Subject: Re: [PATCH 02/13] hwmon: convert ntc_thermistor 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-3-git-send-email-edubezval@gmail.com> Cc: Linux PM , LKML , lm-sensors@lm-sensors.org, Jean Delvare From: Guenter Roeck Message-ID: <56E0E7CB.7040607@roeck-us.net> Date: Wed, 9 Mar 2016 19:19:39 -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-3-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=MpLykzue c=1 sm=1 tr=0 a=9TTQYYGGY7a1eFc7Vblcuw==:117 a=2cfIYNtKkjgZNaOwnGXpGw==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=N659UExz7-8A:10 a=7OsogOcEt9IA:10 a=xEcmXqHN86RddJtQA3oA:9 a=pILNOxqGKmIA:10 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2163 Lines: 63 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/ntc_thermistor.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c > index feed306..ffc12f1 100644 > --- a/drivers/hwmon/ntc_thermistor.c > +++ b/drivers/hwmon/ntc_thermistor.c > @@ -221,7 +221,6 @@ struct ntc_data { > struct device *dev; > int n_comp; > char name[PLATFORM_NAME_SIZE]; > - struct thermal_zone_device *tz; > }; > > #if defined(CONFIG_OF) && IS_ENABLED(CONFIG_IIO) > @@ -539,6 +538,7 @@ static const struct thermal_zone_of_device_ops ntc_of_thermal_ops = { > > static int ntc_thermistor_probe(struct platform_device *pdev) > { > + struct thermal_zone_device *tz; > const struct of_device_id *of_id = > of_match_device(of_match_ptr(ntc_match), &pdev->dev); > const struct platform_device_id *pdev_id; > @@ -633,12 +633,10 @@ static int ntc_thermistor_probe(struct platform_device *pdev) > dev_info(&pdev->dev, "Thermistor type: %s successfully probed.\n", > pdev_id->name); > > - data->tz = thermal_zone_of_sensor_register(data->dev, 0, data->dev, > - &ntc_of_thermal_ops); > - if (IS_ERR(data->tz)) { > + tz = devm_thermal_zone_of_sensor_register(data->dev, 0, data->dev, > + &ntc_of_thermal_ops); > + if (IS_ERR(tz)) > dev_dbg(&pdev->dev, "Failed to register to thermal fw.\n"); > - data->tz = NULL; > - } > > return 0; > err_after_sysfs: > @@ -656,8 +654,6 @@ static int ntc_thermistor_remove(struct platform_device *pdev) > sysfs_remove_group(&data->dev->kobj, &ntc_attr_group); > ntc_iio_channel_release(pdata); > > - thermal_zone_of_sensor_unregister(data->dev, data->tz); > - > return 0; > } > >