thermal: convert users of thermal_zone_of_sensor_register to devm_
Subsystems (13)
Eduardo Valentin
maintainercover thermal: convert users of thermal_zone_of_sensor_register to devm_
Hello,
Given that now we have a devm version of thermal_zone_of_sensor_register [1], I am sending this series of patches to convert its users to use the devm_ API.
Driver's authors, please comment.
BR,
Eduardo Valentin (13):
hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register
hwmon: convert ntc_thermistor to use
devm_thermal_zone_of_sensor_register
hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register
hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register
input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register
thermal: convert hisi_thermal to use
devm_thermal_zone_of_sensor_register
thermal: convert mtk_thermal to use
devm_thermal_zone_of_sensor_register
thermal: convert qcom-spmi to use devm_thermal_zone_of_sensor_register
thermal: convert rcar_thermal to use
devm_thermal_zone_of_sensor_register
thermal: convert rockchip_thermal to use
devm_thermal_zone_of_sensor_register
thermal: convert exynos to use devm_thermal_zone_of_sensor_register
thermal: convert tegra_thermal to use
devm_thermal_zone_of_sensor_register
thermal: convert ti-thermal to use
devm_thermal_zone_of_sensor_register
drivers/hwmon/lm75.c | 10 ++---- drivers/hwmon/ntc_thermistor.c | 12 +++---- drivers/hwmon/scpi-hwmon.c | 41 +++++----------------- drivers/hwmon/tmp102.c | 8 ++--- drivers/input/touchscreen/sun4i-ts.c | 9 +---- drivers/thermal/hisi_thermal.c | 5 ++- drivers/thermal/mtk_thermal.c | 12 ++----- drivers/thermal/qcom-spmi-temp-alarm.c | 3 +- drivers/thermal/rcar_thermal.c | 2 +- drivers/thermal/rockchip_thermal.c | 17 +++------ drivers/thermal/samsung/exynos_tmu.c | 12 +++---- drivers/thermal/tegra_soctherm.c | 31 +++++----------- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 5 +-- 13 files changed, 42 insertions(+), 125 deletions(-)
Signature · 7 lines
2.1.4 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Eduardo Valentin
maintainerPATCH 1/13 hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register
This changes the driver to use the devm_ version of thermal_zone_of_sensor_register and cleans up the local points and unregister calls.
--- drivers/hwmon/lm75.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/hwmon/lm75.c +3 -7
@@ -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 ;
Signature · 7 lines
2.1.4 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
kbuild test robot
build botRe: [PATCH 01/13] hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register
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…
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
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [PATCH 01/13] hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinQuoted 9 lines · Eduardo Valentin
This changes the driver to use the
devm_version ofthermal_zone_of_sensor_registerand cleans up the local points and unregister calls.Cc Jean Delvare <[email protected]>Cc Guenter Roeck <[email protected]>Signed-off-by Eduardo Valentin <[email protected]>
Quoted 40 lines
--- drivers/hwmon/lm75.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)drivers/hwmon/lm75.c +3
-7@@ -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 ;
Eduardo Valentin
maintainerPATCH 2/13 hwmon: convert ntc_thermistor to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinThis changes the driver to use the devm_ version of thermal_zone_of_sensor_register and cleans up the local points and unregister calls.
--- drivers/hwmon/ntc_thermistor.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/hwmon/ntc_thermistor.c +4 -8
@@ -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 ; }
Signature · 7 lines
2.1.4 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
kbuild test robot
build botRe: [PATCH 02/13] hwmon: convert ntc_thermistor to use devm_thermal_zone_of_sensor_register
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…
Hi Eduardo,
[auto build test WARNING on soc-thermal/next]
[also build test WARNING 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 warnings (new ones prefixed by >>):
drivers/hwmon/ntc_thermistor.c: In function 'ntc_thermistor_probe':
drivers/hwmon/ntc_thermistor.c:636:2: error: implicit declaration of function 'devm_thermal_zone_of_sensor_register' [-Werror=implicit-function-declaration]
tz = devm_thermal_zone_of_sensor_register(data->dev, 0, data->dev,
^
>> drivers/hwmon/ntc_thermistor.c:636:5: warning: assignment makes pointer from integer without a cast
tz = devm_thermal_zone_of_sensor_register(data->dev, 0, data->dev,
^cc1: some warnings being treated as errors
vim +636 drivers/hwmon/ntc_thermistor.c
620 ret = sysfs_create_group(&data->dev->kobj, &ntc_attr_group);
621 if (ret) {
622 dev_err(data->dev, "unable to create sysfs files\n");
623 return ret;
624 }
625
626 data->hwmon_dev = hwmon_device_register(data->dev);
627 if (IS_ERR(data->hwmon_dev)) {
628 dev_err(data->dev, "unable to register as hwmon device.\n");
629 ret = PTR_ERR(data->hwmon_dev);
630 goto err_after_sysfs;
631 }
632
633 dev_info(&pdev->dev, "Thermistor type: %s successfully probed.\n",
634 pdev_id->name);
635
> 636 tz = devm_thermal_zone_of_sensor_register(data->dev, 0, data->dev,
637 &ntc_of_thermal_ops);
638 if (IS_ERR(tz))
639 dev_dbg(&pdev->dev, "Failed to register to thermal fw.\n");
640
641 return 0;
642 err_after_sysfs:
643 sysfs_remove_group(&data->dev->kobj, &ntc_attr_group);
644 ntc_iio_channel_release(pdata);
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
kbuild test robot
build botRe: [PATCH 02/13] hwmon: convert ntc_thermistor to use devm_thermal_zone_of_sensor_register
In reply to Eduardo Valentinreproduce: 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…
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/ntc_thermistor.c: In function 'ntc_thermistor_probe':
>> drivers/hwmon/ntc_thermistor.c:636:2: error: implicit declaration of function 'devm_thermal_zone_of_sensor_register' [-Werror=implicit-function-declaration]
tz = devm_thermal_zone_of_sensor_register(data->dev, 0, data->dev,
^
drivers/hwmon/ntc_thermistor.c:636:5: warning: assignment makes pointer from integer without a cast
tz = devm_thermal_zone_of_sensor_register(data->dev, 0, data->dev,
^cc1: some warnings being treated as errors
vim +/devm_thermal_zone_of_sensor_register +636 drivers/hwmon/ntc_thermistor.c
630 goto err_after_sysfs;
631 }
632
633 dev_info(&pdev->dev, "Thermistor type: %s successfully probed.\n",
634 pdev_id->name);
635
> 636 tz = devm_thermal_zone_of_sensor_register(data->dev, 0, data->dev,
637 &ntc_of_thermal_ops);
638 if (IS_ERR(tz))
639 dev_dbg(&pdev->dev, "Failed to register to thermal fw.\n");
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [PATCH 02/13] hwmon: convert ntc_thermistor to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinQuoted 9 lines · Eduardo Valentin
This changes the driver to use the
devm_version ofthermal_zone_of_sensor_registerand cleans up the local points and unregister calls.Cc Jean Delvare <[email protected]>Cc Guenter Roeck <[email protected]>Signed-off-by Eduardo Valentin <[email protected]>
Quoted 50 lines
--- drivers/hwmon/ntc_thermistor.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)drivers/hwmon/ntc_thermistor.c +4
-8@@ -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 ; }
Eduardo Valentin
maintainerPATCH 3/13 hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinThis changes the driver to use the devm_ version of thermal_zone_of_sensor_register and cleans up the local points and unregister calls.
--- drivers/hwmon/tmp102.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/hwmon/tmp102.c +2 -6
@@ -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 */
Signature · 1 line
2.1.4
Re: [PATCH 03/13] hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register
Quoted 9 lines · Eduardo Valentin
This changes the driver to use the
devm_version ofthermal_zone_of_sensor_registerand cleans up the local points and unregister calls.Cc Jean Delvare <[email protected]>Cc Guenter Roeck <[email protected]>Signed-off-by Eduardo Valentin <[email protected]>
Quoted 31 lines
--- drivers/hwmon/tmp102.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/hwmon/tmp102.c +2
-5@@ -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" );
drivers/hwmon/tmp102.c static int tmp102_remove(struct i2c_client *client) · line 253
Quoted 7 lines
drivers/hwmon/tmp102.c +0
-1@@ -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 */
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
kbuild test robot
build botRe: [PATCH 03/13] hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register
In reply to Eduardo Valentinreproduce: 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…
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
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Eduardo Valentin
maintainerPATCH 4/13 hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinThis changes the driver to use the devm_ version of thermal_zone_of_sensor_register and cleans up the local points and unregister calls.
--- drivers/hwmon/scpi-hwmon.c | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-)
drivers/hwmon/scpi-hwmon.c +8 -33
@@ -31,10 +31,8 @@ struct sensor_data { };struct scpi_thermal_zone { -struct list_head list;int sensor_id;struct scpi_sensors *scpi_sensors; -struct thermal_zone_device *tzd; };struct scpi_sensors {
@@ -92,20 +90,6 @@ scpi_show_label(struct device *dev, struct device_attribute *attr, char *buf)return sprintf (buf,"%s\n" , sensor->info.name); } -static void -unregister_thermal_zones (struct platform_device *pdev, -struct scpi_sensors *scpi_sensors) -{ -struct list_head *pos; - -list_for_each (pos, &scpi_sensors->thermal_zones) { -struct scpi_thermal_zone *zone; - - zone = list_entry(pos, struct scpi_thermal_zone, list); -thermal_zone_of_sensor_unregister (&pdev->dev, zone->tzd); - } -} -static struct thermal_zone_of_device_ops scpi_sensor_ops = { .get_temp = scpi_read_temp, };
@@ -224,6 +208,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev)INIT_LIST_HEAD (&scpi_sensors->thermal_zones);for (i =0 ; i < nr_sensors; i++) {struct sensor_data *sensor = &scpi_sensors->data[i]; +struct thermal_zone_device *z;struct scpi_thermal_zone *zone;if (sensor->info.class !=TEMPERATURE )
@@ -232,42 +217,33 @@ static int scpi_hwmon_probe(struct platform_device *pdev) zone =devm_kzalloc (dev,sizeof (*zone),GFP_KERNEL );if (!zone) { ret = -ENOMEM ; - goto unregister_tzd; + goto mfail; } zone->sensor_id = i; zone->scpi_sensors = scpi_sensors; - zone->tzd =thermal_zone_of_sensor_register (dev, - sensor->info.sensor_id, zone, &scpi_sensor_ops); + z =devm_thermal_zone_of_sensor_register (dev, + sensor->info.sensor_id, + zone, + &scpi_sensor_ops);/* * The call to thermal_zone_of_sensor_register returns * an error for sensors that are not associated with * any thermal zones or if the thermal subsystem is * not configured. */ -if (IS_ERR (zone->tzd)) { +if (IS_ERR (z)) {devm_kfree (dev, zone);continue ; } -list_add (&zone->list, &scpi_sensors->thermal_zones); }return 0 ; -unregister_tzd: -unregister_thermal_zones (pdev, scpi_sensors); +mfail:return ret; } -static int scpi_hwmon_remove (struct platform_device *pdev) -{ -struct scpi_sensors *scpi_sensors =platform_get_drvdata (pdev); - -unregister_thermal_zones (pdev, scpi_sensors); - -return 0 ; -} -static const struct of_device_id scpi_of_match[] = { {.compatible ="arm,scpi-sensors" }, {},
@@ -280,7 +256,6 @@ static struct platform_driver scpi_hwmon_platdrv = { .of_match_table = scpi_of_match, }, .probe = scpi_hwmon_probe, - .remove = scpi_hwmon_remove, };module_platform_driver (scpi_hwmon_platdrv);
Signature · 7 lines
2.1.4 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Guenter Roeck
maintainerRe: [PATCH 04/13] hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register
Quoted 58 lines · Eduardo Valentin
This changes the driver to use the
devm_version ofthermal_zone_of_sensor_registerand cleans up the local points and unregister calls.Cc Jean Delvare <[email protected]>Cc Guenter Roeck <[email protected]>Signed-off-by Eduardo Valentin <[email protected]>--- drivers/hwmon/scpi-hwmon.c | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-)drivers/hwmon/scpi-hwmon.c +1
-16@@ -31,10 +31,8 @@ struct sensor_data { };struct scpi_thermal_zone { -struct list_head list;int sensor_id;struct scpi_sensors *scpi_sensors; -struct thermal_zone_device *tzd; };struct scpi_sensors {@@ -92,20 +90,6 @@ scpi_show_label(struct device *dev, struct device_attribute *attr, char *buf)return sprintf (buf,"%s\n" , sensor->info.name); } -static void -unregister_thermal_zones (struct platform_device *pdev, -struct scpi_sensors *scpi_sensors) -{ -struct list_head *pos; - -list_for_each (pos, &scpi_sensors->thermal_zones) { -struct scpi_thermal_zone *zone; - - zone = list_entry(pos, struct scpi_thermal_zone, list); -thermal_zone_of_sensor_unregister (&pdev->dev, zone->tzd); - } -} -static struct thermal_zone_of_device_ops scpi_sensor_ops = { .get_temp = scpi_read_temp, };@@ -224,6 +208,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev)INIT_LIST_HEAD (&scpi_sensors->thermal_zones);for (i =0 ; i < nr_sensors; i++) {struct sensor_data *sensor = &scpi_sensors->data[i]; +struct thermal_zone_device *z;struct scpi_thermal_zone *zone;if (sensor->info.class !=TEMPERATURE )
drivers/hwmon/scpi-hwmon.c static int scpi_hwmon_probe(struct platform_device *pdev) · line 220
Quoted 5 lines
drivers/hwmon/scpi-hwmon.c +1
-1@@ -232,42 +217,33 @@ static int scpi_hwmon_probe(struct platform_device *pdev) zone =devm_kzalloc (dev,sizeof (*zone),GFP_KERNEL );if (!zone) { ret = -ENOMEM ; - goto unregister_tzd; + goto mfail;
return -ENOMEM;
... and drop the unnecessary label.
Thanks,
Guenter
Quoted 53 lines
drivers/hwmon/scpi-hwmon.c +6
-16} zone->sensor_id = i; zone->scpi_sensors = scpi_sensors; - zone->tzd =thermal_zone_of_sensor_register (dev, - sensor->info.sensor_id, zone, &scpi_sensor_ops); + z =devm_thermal_zone_of_sensor_register (dev, + sensor->info.sensor_id, + zone, + &scpi_sensor_ops);/* * The call to thermal_zone_of_sensor_register returns * an error for sensors that are not associated with * any thermal zones or if the thermal subsystem is * not configured. */ -if (IS_ERR (zone->tzd)) { +if (IS_ERR (z)) {devm_kfree (dev, zone);continue ; } -list_add (&zone->list, &scpi_sensors->thermal_zones); }return 0 ; -unregister_tzd: -unregister_thermal_zones (pdev, scpi_sensors); +mfail:return ret; } -static int scpi_hwmon_remove (struct platform_device *pdev) -{ -struct scpi_sensors *scpi_sensors =platform_get_drvdata (pdev); - -unregister_thermal_zones (pdev, scpi_sensors); - -return 0 ; -} -static const struct of_device_id scpi_of_match[] = { {.compatible ="arm,scpi-sensors" }, {},@@ -280,7 +256,6 @@ static struct platform_driver scpi_hwmon_platdrv = { .of_match_table = scpi_of_match, }, .probe = scpi_hwmon_probe, - .remove = scpi_hwmon_remove, };module_platform_driver (scpi_hwmon_platdrv);
Eduardo Valentin
maintainerRe: [PATCH 04/13] hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register
Quoted 67 lines · Guenter Roeck
Quoted 58 lines · Eduardo Valentin
This changes the driver to use the
devm_version ofthermal_zone_of_sensor_registerand cleans up the local points and unregister calls.Cc Jean Delvare <[email protected]>Cc Guenter Roeck <[email protected]>Signed-off-by Eduardo Valentin <[email protected]>--- drivers/hwmon/scpi-hwmon.c | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-)drivers/hwmon/scpi-hwmon.c +1
-16@@ -31,10 +31,8 @@ struct sensor_data { };struct scpi_thermal_zone { -struct list_head list;int sensor_id;struct scpi_sensors *scpi_sensors; -struct thermal_zone_device *tzd; };struct scpi_sensors {@@ -92,20 +90,6 @@ scpi_show_label(struct device *dev, struct device_attribute *attr, char *buf)return sprintf (buf,"%s\n" , sensor->info.name); } -static void -unregister_thermal_zones (struct platform_device *pdev, -struct scpi_sensors *scpi_sensors) -{ -struct list_head *pos; - -list_for_each (pos, &scpi_sensors->thermal_zones) { -struct scpi_thermal_zone *zone; - - zone = list_entry(pos, struct scpi_thermal_zone, list); -thermal_zone_of_sensor_unregister (&pdev->dev, zone->tzd); - } -} -static struct thermal_zone_of_device_ops scpi_sensor_ops = { .get_temp = scpi_read_temp, };@@ -224,6 +208,7 @@ static int scpi_hwmon_probe(struct platform_device *pdev)INIT_LIST_HEAD (&scpi_sensors->thermal_zones);for (i =0 ; i < nr_sensors; i++) {struct sensor_data *sensor = &scpi_sensors->data[i]; +struct thermal_zone_device *z;struct scpi_thermal_zone *zone;if (sensor->info.class !=TEMPERATURE )drivers/hwmon/scpi-hwmon.c static int scpi_hwmon_probe(struct platform_device *pdev) · line 220
Quoted 5 lines
drivers/hwmon/scpi-hwmon.c +1
-1@@ -232,42 +217,33 @@ static int scpi_hwmon_probe(struct platform_device *pdev) zone =devm_kzalloc (dev,sizeof (*zone),GFP_KERNEL );if (!zone) { ret = -ENOMEM ; - goto unregister_tzd; + goto mfail;return -ENOMEM;
Quoted 1 line
... and drop the unnecessary label.
True. I will change as requested.
Thanks
Eduardo Valentin
maintainerPATCH 5/13 input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinThis changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.
--- drivers/input/touchscreen/sun4i-ts.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/input/touchscreen/sun4i-ts.c +1 -8
@@ -115,7 +115,6 @@struct sun4i_ts_data {struct device *dev;struct input_dev *input; -struct thermal_zone_device *tz;void __iomem *base;unsigned int irq;bool ignore_fifo_data;
@@ -366,10 +365,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)if (IS_ERR (hwmon))return PTR_ERR (hwmon); - ts->tz =thermal_zone_of_sensor_register (ts->dev,0 , ts, - &sun4i_ts_tz_ops); -if (IS_ERR (ts->tz)) - ts->tz =NULL ; +devm_thermal_zone_of_sensor_register (ts->dev,0 , ts, &sun4i_ts_tz_ops);writel (TEMP_IRQ_EN (1 ), ts->base +TP_INT_FIFOC );
@@ -377,7 +373,6 @@ static int sun4i_ts_probe(struct platform_device *pdev) error =input_register_device (ts->input);if (error) {writel (0 , ts->base +TP_INT_FIFOC ); -thermal_zone_of_sensor_unregister (ts->dev, ts->tz);return error; } }
@@ -394,8 +389,6 @@ static int sun4i_ts_remove(struct platform_device *pdev)if (ts->input)input_unregister_device (ts->input); -thermal_zone_of_sensor_unregister (ts->dev, ts->tz); -/* Deactivate all IRQs */ writel (0 , ts->base +TP_INT_FIFOC );
Signature · 1 line
2.1.4
Re: [PATCH 05/13] input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register
Quoted 4 lines · Eduardo Valentin
This changes the driver to use the
devm_version
ofthermal_zone_of_sensor_registerand cleans
up the local points and unregister calls.
Quoted 13 lines
Cc Dmitry Torokhov <[email protected]>Cc Maxime Ripard <[email protected]>Cc Chen-Yu Tsai <[email protected]>Cc Hans de Goede <[email protected]>Cc Zhang Rui <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Heiko Stuebner <[email protected]>Cc Sascha Hauer <[email protected]>Cc Jens Thiele <[email protected]>Cc linux-input at vger.kernel.orgCc linux-arm-kernel at lists.infradead.orgCc linux-kernel at vger.kernel.orgSigned-off-by Eduardo Valentin <[email protected]>
I guess it will make sense to merge through your tree unless you want to hold off until after I merge winth mainline (around -rc3) assuming that it even makes into 4.6.
Thanks.
Quoted 48 lines
--- drivers/input/touchscreen/sun4i-ts.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)drivers/input/touchscreen/sun4i-ts.c +1
-8@@ -115,7 +115,6 @@struct sun4i_ts_data {struct device *dev;struct input_dev *input; -struct thermal_zone_device *tz;void __iomem *base;unsigned int irq;bool ignore_fifo_data;@@ -366,10 +365,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)if (IS_ERR (hwmon))return PTR_ERR (hwmon); - ts->tz =thermal_zone_of_sensor_register (ts->dev,0 , ts, - &sun4i_ts_tz_ops); -if (IS_ERR (ts->tz)) - ts->tz =NULL ; +devm_thermal_zone_of_sensor_register (ts->dev,0 , ts, &sun4i_ts_tz_ops);writel (TEMP_IRQ_EN (1 ), ts->base +TP_INT_FIFOC );@@ -377,7 +373,6 @@ static int sun4i_ts_probe(struct platform_device *pdev) error =input_register_device (ts->input);if (error) {writel (0 , ts->base +TP_INT_FIFOC ); -thermal_zone_of_sensor_unregister (ts->dev, ts->tz);return error; } }@@ -394,8 +389,6 @@ static int sun4i_ts_remove(struct platform_device *pdev)if (ts->input)input_unregister_device (ts->input); -thermal_zone_of_sensor_unregister (ts->dev, ts->tz); -/* Deactivate all IRQs */ writel (0 , ts->base +TP_INT_FIFOC );Signature · 1 line
2.1.4
Signature · 1 line
Dmitry
Eduardo Valentin
maintainerRe: [PATCH 05/13] input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register
Quoted 19 lines · Dmitry Torokhov
Quoted 4 lines · Eduardo Valentin
This changes the driver to use the
devm_version
ofthermal_zone_of_sensor_registerand cleans
up the local points and unregister calls.Quoted 13 lines
Cc Dmitry Torokhov <[email protected]>Cc Maxime Ripard <[email protected]>Cc Chen-Yu Tsai <[email protected]>Cc Hans de Goede <[email protected]>Cc Zhang Rui <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Heiko Stuebner <[email protected]>Cc Sascha Hauer <[email protected]>Cc Jens Thiele <[email protected]>Cc linux-input at vger.kernel.orgCc linux-arm-kernel at lists.infradead.orgCc linux-kernel at vger.kernel.orgSigned-off-by Eduardo Valentin <[email protected]>
Quoted 5 lines
Acked-by Dmitry Torokhov <[email protected]>I guess it will make sense to merge through your tree unless you want to hold off until after I merge winth mainline (around -rc3) assuming that it even makes into 4.6.
No rush from my side. I would rather get the right review cycles.
The devm_ APIs were sent to 4.6-rc1 (well, right now in Rui's tree, but I assume he is sending them).
Thanks for your review.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160314/49ac3d45/attachment.sig>
Re: [PATCH 05/13] input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinQuoted 34 lines · Eduardo Valentin
This changes the driver to use the
devm_version
ofthermal_zone_of_sensor_registerand cleans
up the local points and unregister calls.Cc Dmitry Torokhov <[email protected]>Cc Maxime Ripard <[email protected]>Cc Chen-Yu Tsai <[email protected]>Cc Hans de Goede <[email protected]>Cc Zhang Rui <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Heiko Stuebner <[email protected]>Cc Sascha Hauer <[email protected]>Cc Jens Thiele <[email protected]>Cc linux-input at vger.kernel.orgCc linux-arm-kernel at lists.infradead.orgCc linux-kernel at vger.kernel.orgSigned-off-by Eduardo Valentin <[email protected]>--- drivers/input/touchscreen/sun4i-ts.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)drivers/input/touchscreen/sun4i-ts.c +0
-1@@ -115,7 +115,6 @@struct sun4i_ts_data {struct device *dev;struct input_dev *input; -struct thermal_zone_device *tz;void __iomem *base;unsigned int irq;bool ignore_fifo_data;
drivers/input/touchscreen/sun4i-ts.c static int sun4i_ts_probe(struct platform_device *pdev) · line 368
Quoted 8 lines
drivers/input/touchscreen/sun4i-ts.c +1
-4@@ -366,10 +365,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)if (IS_ERR (hwmon))return PTR_ERR (hwmon); - ts->tz =thermal_zone_of_sensor_register (ts->dev,0 , ts, - &sun4i_ts_tz_ops); -if (IS_ERR (ts->tz)) - ts->tz =NULL ; +devm_thermal_zone_of_sensor_register (ts->dev,0 , ts, &sun4i_ts_tz_ops);
Shouldn't we check the return value? There are a few possibilities for thermal_zone_of_sensor_register to fail.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Hans de Goede
Acked-byRe: [PATCH 05/13] input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register
Hi,
Quoted 38 lines · Sascha Hauer
Quoted 37 lines · Eduardo Valentin
This changes the driver to use the
devm_version
ofthermal_zone_of_sensor_registerand cleans
up the local points and unregister calls.Cc Dmitry Torokhov <[email protected]>Cc Maxime Ripard <[email protected]>Cc Chen-Yu Tsai <[email protected]>Cc Hans de Goede <[email protected]>Cc Zhang Rui <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Heiko Stuebner <[email protected]>Cc Sascha Hauer <[email protected]>Cc Jens Thiele <[email protected]>Cc linux-input at vger.kernel.orgCc linux-arm-kernel at lists.infradead.orgCc linux-kernel at vger.kernel.orgSigned-off-by Eduardo Valentin <[email protected]>--- drivers/input/touchscreen/sun4i-ts.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)drivers/input/touchscreen/sun4i-ts.c +0
-1@@ -115,7 +115,6 @@struct sun4i_ts_data {struct device *dev;struct input_dev *input; -struct thermal_zone_device *tz;void __iomem *base;unsigned int irq;bool ignore_fifo_data;@@ -366,10 +365,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)if (IS_ERR (hwmon))return PTR_ERR (hwmon);
Quoted 8 lines
drivers/input/touchscreen/sun4i-ts.c static int sun4i_ts_probe(struct platform_device *pdev) · line 368
Quoted 5 lines
drivers/input/touchscreen/sun4i-ts.c +1
-4- ts->tz =thermal_zone_of_sensor_register (ts->dev,0 , ts, - &sun4i_ts_tz_ops); -if (IS_ERR (ts->tz)) - ts->tz =NULL ; +devm_thermal_zone_of_sensor_register (ts->dev,0 , ts, &sun4i_ts_tz_ops);Shouldn't we check the return value? There are a few possibilities for
thermal_zone_of_sensor_registerto fail.
Note thee old code also was not checking this, it was simply continuing without having registered a tz-sensor.
I guess we could log an error in that case, but that should be done in a seperate follow-up patch.
The current patch looks good to me:
Regards,
Hans
Eduardo Valentin
maintainerPATCH 6/13 thermal: convert hisi_thermal to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinThis changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.
--- drivers/thermal/hisi_thermal.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/thermal/hisi_thermal.c +2 -3
@@ -243,8 +243,8 @@ static int hisi_thermal_register_sensor(struct platform_device *pdev, sensor->id = index; sensor->thermal = data; - sensor->tzd =thermal_zone_of_sensor_register (&pdev->dev, sensor->id, - sensor, &hisi_of_thermal_ops); + sensor->tzd =devm_thermal_zone_of_sensor_register (&pdev->dev, + sensor->id, sensor, &hisi_of_thermal_ops);if (IS_ERR (sensor->tzd)) { ret =PTR_ERR (sensor->tzd); dev_err(&pdev->dev, "failed to register sensor id %d: %d\n",
@@ -364,7 +364,6 @@ static int hisi_thermal_remove(struct platform_device *pdev)struct hisi_thermal_sensor *sensor = &data->sensors[i];hisi_thermal_toggle_sensor (sensor, false); -thermal_zone_of_sensor_unregister (&pdev->dev, sensor->tzd); }hisi_thermal_disable_sensor (data);
Signature · 7 lines
2.1.4 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Eduardo Valentin
maintainerPATCH 7/13 thermal: convert mtk_thermal to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinThis changes the driver to use the devm_ version of thermal_zone_of_sensor_register and cleans up the local points and unregister calls.
--- drivers/thermal/mtk_thermal.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/thermal/mtk_thermal.c +2 -10
@@ -145,7 +145,6 @@ struct mtk_thermal {s32 o_slope;s32 vts[MT8173_NUM_SENSORS ]; -struct thermal_zone_device *tzd; };struct mtk_thermal_bank_cfg {
@@ -573,16 +572,11 @@ static int mtk_thermal_probe(struct platform_device *pdev)platform_set_drvdata (pdev, mt); - mt->tzd =thermal_zone_of_sensor_register (&pdev->dev,0 , mt, - &mtk_thermal_ops); -if (IS_ERR (mt->tzd)) - goto err_register; +devm_thermal_zone_of_sensor_register (&pdev->dev,0 , mt, + &mtk_thermal_ops);return 0 ; -err_register: -clk_disable_unprepare (mt->clk_peri_therm); - err_disable_clk_auxadc:clk_disable_unprepare (mt->clk_auxadc);
@@ -593,8 +587,6 @@ static int mtk_thermal_remove(struct platform_device *pdev) {struct mtk_thermal *mt =platform_get_drvdata (pdev); -thermal_zone_of_sensor_unregister (&pdev->dev, mt->tzd); -clk_disable_unprepare (mt->clk_peri_therm);clk_disable_unprepare (mt->clk_auxadc);
Signature · 1 line
2.1.4
kbuild test robot
build botRe: [PATCH 07/13] thermal: convert mtk_thermal to use devm_thermal_zone_of_sensor_register
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…
Hi Eduardo,
[auto build test ERROR on soc-thermal/next]
[also build test ERROR on next-20160309]
[cannot apply to thermal/next v4.5-rc7]
[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: parisc-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=parisc
All errors (new ones prefixed by >>):
drivers/thermal/mtk_thermal.c: In function 'mtk_thermal_probe':
>> drivers/thermal/mtk_thermal.c:575:2: error: implicit declaration of function 'devm_thermal_zone_of_sensor_register' [-Werror=implicit-function-declaration]
devm_thermal_zone_of_sensor_register(&pdev->dev, 0, mt,
^cc1: some warnings being treated as errors
vim +/devm_thermal_zone_of_sensor_register +575 drivers/thermal/mtk_thermal.c
569 for (i = 0; i < MT8173_NUM_ZONES; i++)
570 mtk_thermal_init_bank(mt, i, apmixed_phys_base,
571 auxadc_phys_base);
572
573 platform_set_drvdata(pdev, mt);
574
> 575 devm_thermal_zone_of_sensor_register(&pdev->dev, 0, mt,
576 &mtk_thermal_ops);
577
578 return 0;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 43726 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160310/c73f7ba9/attachment-0001.obj>
Eduardo Valentin
maintainerPATCH 8/13 thermal: convert qcom-spmi to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinThis changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.
--- drivers/thermal/qcom-spmi-temp-alarm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/thermal/qcom-spmi-temp-alarm.c +1 -2
@@ -260,7 +260,7 @@ static int qpnp_tm_probe(struct platform_device *pdev)if (ret <0 ) goto fail; - chip->tz_dev =thermal_zone_of_sensor_register (&pdev->dev,0 , chip, + chip->tz_dev =devm_thermal_zone_of_sensor_register (&pdev->dev,0 , chip, &qpnp_tm_sensor_ops);if (IS_ERR (chip->tz_dev)) {dev_err (&pdev->dev,"failed to register sensor\n" );
@@ -281,7 +281,6 @@ static int qpnp_tm_remove(struct platform_device *pdev) {struct qpnp_tm_chip *chip =dev_get_drvdata (&pdev->dev); -thermal_zone_of_sensor_unregister (&pdev->dev, chip->tz_dev);if (!IS_ERR (chip->adc))iio_channel_release (chip->adc);
Signature · 7 lines
2.1.4 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Eduardo Valentin
maintainerPATCH 9/13 thermal: convert rcar_thermal to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinThis changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.
--- drivers/thermal/rcar_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/rcar_thermal.c +1 -1
@@ -493,7 +493,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) goto error_unregister;if (of_data ==USE_OF_THERMAL ) - priv->zone =thermal_zone_of_sensor_register ( + priv->zone =devm_thermal_zone_of_sensor_register ( dev, i, priv, &rcar_thermal_zone_of_ops);else
Signature · 1 line
2.1.4
Eduardo Valentin
maintainerPATCH 10/13 thermal: convert rockchip_thermal to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinThis changes the driver to use the devm_ version of thermal_zone_of_sensor_register and cleans up the local points and unregister calls.
--- drivers/thermal/rockchip_thermal.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/thermal/rockchip_thermal.c +4 -13
@@ -753,8 +753,8 @@ rockchip_thermal_register_sensor(struct platform_device *pdev, sensor->thermal = thermal; sensor->id = id; - sensor->tzd =thermal_zone_of_sensor_register (&pdev->dev, id, sensor, - &rockchip_of_thermal_ops); + sensor->tzd =devm_thermal_zone_of_sensor_register (&pdev->dev, id, + sensor, &rockchip_of_thermal_ops);if (IS_ERR (sensor->tzd)) { error =PTR_ERR (sensor->tzd); dev_err(&pdev->dev, "failed to register sensor %d: %d\n",
@@ -782,7 +782,7 @@ static int rockchip_thermal_probe(struct platform_device *pdev)const struct of_device_id *match;struct resource *res;int irq; -int i, j; +int i;int error; match =of_match_node (of_rockchip_thermal_match, np);
@@ -865,9 +865,6 @@ static int rockchip_thermal_probe(struct platform_device *pdev)dev_err (&pdev->dev,"failed to register sensor[%d] : error = %d\n" , i, error); -for (j =0 ; j < i; j++) -thermal_zone_of_sensor_unregister (&pdev->dev, - thermal->sensors[j].tzd); goto err_disable_pclk; } }
@@ -879,7 +876,7 @@ static int rockchip_thermal_probe(struct platform_device *pdev)if (error) {dev_err (&pdev->dev,"failed to request tsadc irq: %d\n" , error); - goto err_unregister_sensor; + goto err_disable_pclk; } thermal->chip->control (thermal->regs, true);
@@ -891,11 +888,6 @@ static int rockchip_thermal_probe(struct platform_device *pdev)return 0 ; -err_unregister_sensor: -while (i--) -thermal_zone_of_sensor_unregister (&pdev->dev, - thermal->sensors[i].tzd); - err_disable_pclk:clk_disable_unprepare (thermal->pclk); err_disable_clk:
@@ -913,7 +905,6 @@ static int rockchip_thermal_remove(struct platform_device *pdev)struct rockchip_thermal_sensor *sensor = &thermal->sensors[i];rockchip_thermal_toggle_sensor (sensor, false); -thermal_zone_of_sensor_unregister (&pdev->dev, sensor->tzd); } thermal->chip->control (thermal->regs, false);
Signature · 1 line
2.1.4
Re: [PATCH 10/13] thermal: convert rockchip_thermal to use devm_thermal_zone_of_sensor_register
Am Mittwoch, 9. M?rz 2016, 13:35:32 schrieb Eduardo Valentin:
Quoted 11 lines
This changes the driver to use the
devm_version ofthermal_zone_of_sensor_registerand cleans up the local points and unregister calls.Cc Zhang Rui <[email protected]>Cc Heiko Stuebner <[email protected]>Cc linux-pm at vger.kernel.orgCc linux-arm-kernel at lists.infradead.orgCc linux-rockchip at lists.infradead.orgCc linux-kernel at vger.kernel.orgSigned-off-by Eduardo Valentin <[email protected]>
to me this looks ok
I've also added in some Rockchip people that were working on the driver in the past.
Heiko
Quoted 70 lines
--- drivers/thermal/rockchip_thermal.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)(quoted diff) +0
-0
b/drivers/thermal/rockchip_thermal.cindex b58e3fb..792c5d0 100644drivers/thermal/rockchip_thermal.c +2
-2@@ -753,8 +753,8 @@ rockchip_thermal_register_sensor(struct platform_device *pdev, sensor->thermal = thermal; sensor->id = id; - sensor->tzd =thermal_zone_of_sensor_register (&pdev->dev, id, sensor, - &rockchip_of_thermal_ops); + sensor->tzd =devm_thermal_zone_of_sensor_register (&pdev->dev, id, + sensor, &rockchip_of_thermal_ops);if (IS_ERR (sensor->tzd)) { error =PTR_ERR (sensor->tzd);drivers/thermal/rockchip_thermal.c +2
-10dev_err(&pdev->dev, "failed to register sensor %d: %d\n",@@ -782,7 +782,7 @@ static int rockchip_thermal_probe(struct platform_device *pdev) const struct of_device_id *match;struct resource *res;int irq; -int i, j; +int i;int error; match =of_match_node (of_rockchip_thermal_match, np);@@ -865,9 +865,6 @@ static int rockchip_thermal_probe(struct platform_device *pdev) dev_err(&pdev->dev,"failed to register sensor[%d] : error = %d\n" , i, error); -for (j =0 ; j < i; j++) -thermal_zone_of_sensor_unregister (&pdev->dev, - thermal->sensors[j].tzd); goto err_disable_pclk; } }@@ -879,7 +876,7 @@ static int rockchip_thermal_probe(struct platform_device *pdev) if (error) {dev_err (&pdev->dev,"failed to request tsadc irq: %d\n" , error); - goto err_unregister_sensor; + goto err_disable_pclk; } thermal->chip->control (thermal->regs, true);@@ -891,11 +888,6 @@ static int rockchip_thermal_probe(struct platform_device *pdev)return 0 ; -err_unregister_sensor: -while (i--) -thermal_zone_of_sensor_unregister (&pdev->dev, - thermal->sensors[i].tzd); - err_disable_pclk:clk_disable_unprepare (thermal->pclk);
err_disable_clk:drivers/thermal/rockchip_thermal.c +0
-0@@ -913,7 +905,6 @@ static int rockchip_thermal_remove(struct
platform_device*pdev) structrockchip_thermal_sensor*sensor = &thermal->sensors[i];drivers/thermal/rockchip_thermal.c +0
-1rockchip_thermal_toggle_sensor (sensor, false); -thermal_zone_of_sensor_unregister (&pdev->dev, sensor->tzd); } thermal->chip->control (thermal->regs, false);
Re: [PATCH 10/13] thermal: convert rockchip_thermal to use devm_thermal_zone_of_sensor_register
In reply to Eduardo Valentin? 2016?03?10? 05:35, Eduardo Valentin ??:
Quoted 11 lines
This changes the driver to use the
devm_version ofthermal_zone_of_sensor_registerand cleans up the local points and unregister calls.Cc Zhang Rui <[email protected]>Cc Heiko Stuebner <[email protected]>Cc linux-pm at vger.kernel.orgCc linux-arm-kernel at lists.infradead.orgCc linux-rockchip at lists.infradead.orgCc linux-kernel at vger.kernel.orgSigned-off-by Eduardo Valentin <[email protected]>
I just cherry-pick the devm* patches to test the rockchip thermal.
Quoted 67 lines
--- drivers/thermal/rockchip_thermal.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)drivers/thermal/rockchip_thermal.c +4
-13@@ -753,8 +753,8 @@ rockchip_thermal_register_sensor(struct platform_device *pdev, sensor->thermal = thermal; sensor->id = id; - sensor->tzd =thermal_zone_of_sensor_register (&pdev->dev, id, sensor, - &rockchip_of_thermal_ops); + sensor->tzd =devm_thermal_zone_of_sensor_register (&pdev->dev, id, + sensor, &rockchip_of_thermal_ops);if (IS_ERR (sensor->tzd)) { error =PTR_ERR (sensor->tzd); dev_err(&pdev->dev, "failed to register sensor %d: %d\n",@@ -782,7 +782,7 @@ static int rockchip_thermal_probe(struct platform_device *pdev)const struct of_device_id *match;struct resource *res;int irq; -int i, j; +int i;int error; match =of_match_node (of_rockchip_thermal_match, np);@@ -865,9 +865,6 @@ static int rockchip_thermal_probe(struct platform_device *pdev)dev_err (&pdev->dev,"failed to register sensor[%d] : error = %d\n" , i, error); -for (j =0 ; j < i; j++) -thermal_zone_of_sensor_unregister (&pdev->dev, - thermal->sensors[j].tzd); goto err_disable_pclk; } }@@ -879,7 +876,7 @@ static int rockchip_thermal_probe(struct platform_device *pdev)if (error) {dev_err (&pdev->dev,"failed to request tsadc irq: %d\n" , error); - goto err_unregister_sensor; + goto err_disable_pclk; } thermal->chip->control (thermal->regs, true);@@ -891,11 +888,6 @@ static int rockchip_thermal_probe(struct platform_device *pdev)return 0 ; -err_unregister_sensor: -while (i--) -thermal_zone_of_sensor_unregister (&pdev->dev, - thermal->sensors[i].tzd); - err_disable_pclk:clk_disable_unprepare (thermal->pclk); err_disable_clk:@@ -913,7 +905,6 @@ static int rockchip_thermal_remove(struct platform_device *pdev)struct rockchip_thermal_sensor *sensor = &thermal->sensors[i];rockchip_thermal_toggle_sensor (sensor, false); -thermal_zone_of_sensor_unregister (&pdev->dev, sensor->tzd); } thermal->chip->control (thermal->regs, false);
Signature · 2 lines
Thanks, Caesar
Eduardo Valentin
maintainerPATCH 11/13 thermal: convert exynos to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinThis changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.
--- drivers/thermal/samsung/exynos_tmu.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/thermal/samsung/exynos_tmu.c +4 -8
@@ -1363,8 +1363,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)* data->tzd must be registered before calling exynos_tmu_initialize(), * requesting irq and calling exynos_tmu_control(). */ - data->tzd =thermal_zone_of_sensor_register (&pdev->dev,0 , data, - &exynos_sensor_ops); + data->tzd =devm_thermal_zone_of_sensor_register (&pdev->dev,0 , data, + &exynos_sensor_ops);if (IS_ERR (data->tzd)) { ret =PTR_ERR (data->tzd);dev_err (&pdev->dev,"Failed to register sensor: %d\n" , ret);
@@ -1374,21 +1374,19 @@ static int exynos_tmu_probe(struct platform_device *pdev) ret =exynos_tmu_initialize (pdev);if (ret) {dev_err (&pdev->dev,"Failed to initialize TMU\n" ); - goto err_thermal; + goto err_sclk; } ret =devm_request_irq (&pdev->dev, data->irq, exynos_tmu_irq,IRQF_TRIGGER_RISING |IRQF_SHARED ,dev_name (&pdev->dev), data);if (ret) {dev_err (&pdev->dev,"Failed to request irq: %d\n" , data->irq); - goto err_thermal; + goto err_sclk; }exynos_tmu_control (pdev, true);return 0 ; -err_thermal: -thermal_zone_of_sensor_unregister (&pdev->dev, data->tzd); err_sclk:clk_disable_unprepare (data->sclk); err_clk:
@@ -1406,9 +1404,7 @@ err_sensor:static int exynos_tmu_remove (struct platform_device *pdev) {struct exynos_tmu_data *data =platform_get_drvdata (pdev); -struct thermal_zone_device *tzd = data->tzd; -thermal_zone_of_sensor_unregister (&pdev->dev, tzd);exynos_tmu_control (pdev, false);clk_disable_unprepare (data->sclk);
Signature · 1 line
2.1.4
Re: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register
Quoted 57 lines · Eduardo Valentin
This changes the driver to use the
devm_version
ofthermal_zone_of_sensor_registerand cleans
up the local points and unregister calls.Cc Lukasz Majewski <[email protected]>Cc Zhang Rui <[email protected]>Cc Kukjin Kim <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc linux-pm at vger.kernel.orgCc linux-samsung-soc at vger.kernel.orgCc linux-arm-kernel at lists.infradead.orgCc linux-kernel at vger.kernel.orgSigned-off-by Eduardo Valentin <[email protected]>--- drivers/thermal/samsung/exynos_tmu.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)drivers/thermal/samsung/exynos_tmu.c +4
-6@@ -1363,8 +1363,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)* data->tzd must be registered before calling exynos_tmu_initialize(), * requesting irq and calling exynos_tmu_control(). */ - data->tzd =thermal_zone_of_sensor_register (&pdev->dev,0 , data, - &exynos_sensor_ops); + data->tzd =devm_thermal_zone_of_sensor_register (&pdev->dev,0 , data, + &exynos_sensor_ops);if (IS_ERR (data->tzd)) { ret =PTR_ERR (data->tzd);dev_err (&pdev->dev,"Failed to register sensor: %d\n" , ret);@@ -1374,21 +1374,19 @@ static int exynos_tmu_probe(struct platform_device *pdev) ret =exynos_tmu_initialize (pdev);if (ret) {dev_err (&pdev->dev,"Failed to initialize TMU\n" ); - goto err_thermal; + goto err_sclk; } ret =devm_request_irq (&pdev->dev, data->irq, exynos_tmu_irq,IRQF_TRIGGER_RISING |IRQF_SHARED ,dev_name (&pdev->dev), data);if (ret) {dev_err (&pdev->dev,"Failed to request irq: %d\n" , data->irq); - goto err_thermal; + goto err_sclk; }exynos_tmu_control (pdev, true);return 0 ; -err_thermal: -thermal_zone_of_sensor_unregister (&pdev->dev, data->tzd); err_sclk:clk_disable_unprepare (data->sclk); err_clk:
drivers/thermal/samsung/exynos_tmu.c err_sensor: · line 1411
Quoted 6 lines
drivers/thermal/samsung/exynos_tmu.c +0
-2@@ -1406,9 +1404,7 @@ err_sensor:static int exynos_tmu_remove (struct platform_device *pdev) {struct exynos_tmu_data *data =platform_get_drvdata (pdev); -struct thermal_zone_device *tzd = data->tzd; -thermal_zone_of_sensor_unregister (&pdev->dev, tzd);
Before, the sensor was removed from zone (ops like get_temp NULL-ified etc), then we stopped TMU, disabled clocks, disabled regulator and finally freed IRQ (through devm-like interface).
Now this will be different - first stop of TMU, disable clocks, disable, regulator, remove sensor from zone (through devm) and finally free IRQ.
Are you sure that changing order is okay?
Best regards,
Krzysztof
Quoted 4 lines
drivers/thermal/samsung/exynos_tmu.c +0
-0exynos_tmu_control (pdev, false);clk_disable_unprepare (data->sclk);
Eduardo Valentin
maintainerRe: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register
Quoted 69 lines · Krzysztof Kozlowski
Quoted 57 lines · Eduardo Valentin
This changes the driver to use the
devm_version
ofthermal_zone_of_sensor_registerand cleans
up the local points and unregister calls.Cc Lukasz Majewski <[email protected]>Cc Zhang Rui <[email protected]>Cc Kukjin Kim <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc linux-pm at vger.kernel.orgCc linux-samsung-soc at vger.kernel.orgCc linux-arm-kernel at lists.infradead.orgCc linux-kernel at vger.kernel.orgSigned-off-by Eduardo Valentin <[email protected]>--- drivers/thermal/samsung/exynos_tmu.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)drivers/thermal/samsung/exynos_tmu.c +4
-6@@ -1363,8 +1363,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)* data->tzd must be registered before calling exynos_tmu_initialize(), * requesting irq and calling exynos_tmu_control(). */ - data->tzd =thermal_zone_of_sensor_register (&pdev->dev,0 , data, - &exynos_sensor_ops); + data->tzd =devm_thermal_zone_of_sensor_register (&pdev->dev,0 , data, + &exynos_sensor_ops);if (IS_ERR (data->tzd)) { ret =PTR_ERR (data->tzd);dev_err (&pdev->dev,"Failed to register sensor: %d\n" , ret);@@ -1374,21 +1374,19 @@ static int exynos_tmu_probe(struct platform_device *pdev) ret =exynos_tmu_initialize (pdev);if (ret) {dev_err (&pdev->dev,"Failed to initialize TMU\n" ); - goto err_thermal; + goto err_sclk; } ret =devm_request_irq (&pdev->dev, data->irq, exynos_tmu_irq,IRQF_TRIGGER_RISING |IRQF_SHARED ,dev_name (&pdev->dev), data);if (ret) {dev_err (&pdev->dev,"Failed to request irq: %d\n" , data->irq); - goto err_thermal; + goto err_sclk; }exynos_tmu_control (pdev, true);return 0 ; -err_thermal: -thermal_zone_of_sensor_unregister (&pdev->dev, data->tzd); err_sclk:clk_disable_unprepare (data->sclk); err_clk:drivers/thermal/samsung/exynos_tmu.c err_sensor: · line 1411
Quoted 6 lines
drivers/thermal/samsung/exynos_tmu.c +0
-2@@ -1406,9 +1404,7 @@ err_sensor:static int exynos_tmu_remove (struct platform_device *pdev) {struct exynos_tmu_data *data =platform_get_drvdata (pdev); -struct thermal_zone_device *tzd = data->tzd; -thermal_zone_of_sensor_unregister (&pdev->dev, tzd);Before, the sensor was removed from zone (ops like
get_tempNULL-ified etc), then we stopped TMU, disabled clocks, disabled regulator and finally freed IRQ (through devm-like interface).
Quoted 4 lines
Now this will be different - first stop of TMU, disable clocks, disable, regulator, remove sensor from zone (through devm) and finally free IRQ.
Are you sure that changing order is okay?
Not really. After checking the driver code and your suggestions, I don't think this driver would benefit of this change, not at least the way it is currently.
Thanks for pointing out. I am taking this driver out of the series.
Quoted 9 lines
Best regards,
KrzysztofQuoted 4 lines
drivers/thermal/samsung/exynos_tmu.c +0
-0exynos_tmu_control (pdev, false);clk_disable_unprepare (data->sclk);
Re: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinHi Eduardo,
Quoted 63 lines
This changes the driver to use the
devm_version
ofthermal_zone_of_sensor_registerand cleans
up the local points and unregister calls.Cc Lukasz Majewski <[email protected]>Cc Zhang Rui <[email protected]>Cc Kukjin Kim <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc linux-pm at vger.kernel.orgCc linux-samsung-soc at vger.kernel.orgCc linux-arm-kernel at lists.infradead.orgCc linux-kernel at vger.kernel.orgSigned-off-by Eduardo Valentin <[email protected]>--- drivers/thermal/samsung/exynos_tmu.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)(quoted diff) +0
-0
b/drivers/thermal/samsung/exynos_tmu.cindex fa61eff..256039e 100644drivers/thermal/samsung/exynos_tmu.c +0
-2@@ -1363,8 +1363,8 @@ static int exynos_tmu_probe(structplatform_device *pdev) * data->tzd must be registered before calling exynos_tmu_initialize(), * requesting irq and calling exynos_tmu_control(). */ - data->tzd = thermal_zone_of_sensor_register(&pdev->dev, 0, data, -
&exynos_sensor_ops);drivers/thermal/samsung/exynos_tmu.c +1
-0+ data->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev,0, data,
+&exynos_sensor_ops); if (IS_ERR(data->tzd)) {drivers/thermal/samsung/exynos_tmu.c +0
-0ret =PTR_ERR (data->tzd); dev_err(&pdev->dev, "Failed to register sensor:%d\n", ret); @@ -1374,21 +1374,19 @@ static int
exynos_tmu_probe(struct platform_device *pdev)ret =exynos_tmu_initialize(pdev); if (ret) {drivers/thermal/samsung/exynos_tmu.c +1
-1dev_err (&pdev->dev,"Failed to initialize TMU\n" ); - goto err_thermal; + goto err_sclk; } ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq, IRQF_TRIGGER_RISING | IRQF_SHARED,
dev_name(&pdev->dev), data); if (ret) {
dev_err(&pdev->dev, "Failed to request irq: %d\n",data->irq);drivers/thermal/samsung/exynos_tmu.c +1
-3- goto err_thermal; + goto err_sclk; }exynos_tmu_control (pdev, true);return 0 ; -err_thermal: -thermal_zone_of_sensor_unregister (&pdev->dev, data->tzd); err_sclk:clk_disable_unprepare (data->sclk); err_clk:
drivers/thermal/samsung/exynos_tmu.c err_sensor: · line 1410
Quoted 9 lines
drivers/thermal/samsung/exynos_tmu.c +0
-2@@ -1406,9 +1404,7 @@ err_sensor:static int exynos_tmu_remove (struct platform_device *pdev) {struct exynos_tmu_data *data =platform_get_drvdata (pdev); -struct thermal_zone_device *tzd = data->tzd; -thermal_zone_of_sensor_unregister (&pdev->dev, tzd);exynos_tmu_control (pdev, false);clk_disable_unprepare (data->sclk);
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Eduardo Valentin
maintainerPATCH 12/13 thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinThis changes the driver to use the devm_ version of thermal_zone_of_sensor_register and cleans up the local points and unregister calls.
--- drivers/thermal/tegra_soctherm.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-)
drivers/thermal/tegra_soctherm.c +9 -22
@@ -168,7 +168,7 @@ struct tegra_soctherm {struct clk *clock_soctherm;void __iomem *regs; -struct thermal_zone_device *thermctl_tzs[4 ]; +#define ZONE_NUMBER 4 };struct tsensor_shared_calibration {
@@ -342,7 +342,7 @@ static const struct thermctl_zone_desc t124_thermctl_temp_zones[] = {static int tegra_soctherm_probe (struct platform_device *pdev) {struct tegra_soctherm *tegra; -struct thermal_zone_device *tz; +struct thermal_zone_device *z;struct tsensor_shared_calibration shared_calib;struct resource *res;unsigned int i;
@@ -408,36 +408,29 @@ static int tegra_soctherm_probe(struct platform_device *pdev)/* Initialize thermctl sensors */ -for (i =0 ; i <ARRAY_SIZE (tegra->thermctl_tzs); ++i) { +for (i =0 ; i <ZONE_NUMBER ; ++i) {struct tegra_thermctl_zone *zone =devm_kzalloc (&pdev->dev,sizeof (*zone),GFP_KERNEL );if (!zone) { err = -ENOMEM ; - goto unregister_tzs; + goto disable_clocks; } zone->reg = tegra->regs + t124_thermctl_temp_zones[i].offset; zone->shift = t124_thermctl_temp_zones[i].shift; - tz =thermal_zone_of_sensor_register (&pdev->dev, i, zone, - &tegra_of_thermal_ops); -if (IS_ERR (tz)) { - err =PTR_ERR (tz); + z =devm_thermal_zone_of_sensor_register (&pdev->dev, i, zone, + &tegra_of_thermal_ops); +if (IS_ERR (z)) { + err =PTR_ERR (z);dev_err (&pdev->dev,"failed to register sensor: %d\n" , err); - goto unregister_tzs; + goto disable_clocks; } - - tegra->thermctl_tzs[i] = tz; }return 0 ; -unregister_tzs: -while (i--) -thermal_zone_of_sensor_unregister (&pdev->dev, - tegra->thermctl_tzs[i]); - disable_clocks:clk_disable_unprepare (tegra->clock_tsensor);clk_disable_unprepare (tegra->clock_soctherm);
@@ -448,12 +441,6 @@ disable_clocks:static int tegra_soctherm_remove (struct platform_device *pdev) {struct tegra_soctherm *tegra =platform_get_drvdata (pdev); -unsigned int i; - -for (i =0 ; i <ARRAY_SIZE (tegra->thermctl_tzs); ++i) { -thermal_zone_of_sensor_unregister (&pdev->dev, - tegra->thermctl_tzs[i]); - }clk_disable_unprepare (tegra->clock_tsensor);clk_disable_unprepare (tegra->clock_soctherm);
Signature · 1 line
2.1.4
Re: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register
Quoted 50 lines · Eduardo Valentin
This changes the driver to use the
devm_version
ofthermal_zone_of_sensor_registerand cleans
up the local points and unregister calls.Cc Zhang Rui <[email protected]>Cc Stephen Warren <[email protected]>Cc Thierry Reding <[email protected]>Cc Alexandre Courbot <[email protected]>Signed-off-by Eduardo Valentin <[email protected]>--- drivers/thermal/tegra_soctherm.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-)drivers/thermal/tegra_soctherm.c +4
-4@@ -168,7 +168,7 @@ struct tegra_soctherm {struct clk *clock_soctherm;void __iomem *regs; -struct thermal_zone_device *thermctl_tzs[4 ]; +#define ZONE_NUMBER 4 };struct tsensor_shared_calibration {@@ -342,7 +342,7 @@ static const struct thermctl_zone_desc t124_thermctl_temp_zones[] = {static int tegra_soctherm_probe (struct platform_device *pdev) {struct tegra_soctherm *tegra; -struct thermal_zone_device *tz; +struct thermal_zone_device *z;struct tsensor_shared_calibration shared_calib;struct resource *res;unsigned int i;@@ -408,36 +408,29 @@ static int tegra_soctherm_probe(struct platform_device *pdev)/* Initialize thermctl sensors */ -for (i =0 ; i <ARRAY_SIZE (tegra->thermctl_tzs); ++i) { +for (i =0 ; i <ZONE_NUMBER ; ++i) {struct tegra_thermctl_zone *zone =devm_kzalloc (&pdev->dev,sizeof (*zone),GFP_KERNEL );if (!zone) { err = -ENOMEM ; - goto unregister_tzs; + goto disable_clocks;
drivers/thermal/tegra_soctherm.c static int tegra_soctherm_probe(struct platform_device *pdev) · line 422
Quoted 10 lines
drivers/thermal/tegra_soctherm.c +1
-4} zone->reg = tegra->regs + t124_thermctl_temp_zones[i].offset; zone->shift = t124_thermctl_temp_zones[i].shift; - tz =thermal_zone_of_sensor_register (&pdev->dev, i, zone, - &tegra_of_thermal_ops); -if (IS_ERR (tz)) { - err =PTR_ERR (tz); + z = devm_thermal_zone_of_sensor_register(&pdev->dev, i, zone,
I prefer to still use "tz", it seems this line isn't over 80 characters, or we can add newline.
Quoted 36 lines
drivers/thermal/tegra_soctherm.c +4
-14+ &tegra_of_thermal_ops); +if (IS_ERR (z)) { + err =PTR_ERR (z);dev_err (&pdev->dev,"failed to register sensor: %d\n" , err); - goto unregister_tzs; + goto disable_clocks; } - - tegra->thermctl_tzs[i] = tz; }return 0 ; -unregister_tzs: -while (i--) -thermal_zone_of_sensor_unregister (&pdev->dev, - tegra->thermctl_tzs[i]); - disable_clocks:clk_disable_unprepare (tegra->clock_tsensor);clk_disable_unprepare (tegra->clock_soctherm);@@ -448,12 +441,6 @@ disable_clocks:static int tegra_soctherm_remove (struct platform_device *pdev) {struct tegra_soctherm *tegra =platform_get_drvdata (pdev); -unsigned int i; - -for (i =0 ; i <ARRAY_SIZE (tegra->thermctl_tzs); ++i) { -thermal_zone_of_sensor_unregister (&pdev->dev, - tegra->thermctl_tzs[i]); - }clk_disable_unprepare (tegra->clock_tsensor);clk_disable_unprepare (tegra->clock_soctherm);
Eduardo Valentin
maintainerRe: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register
Quoted 58 lines · Wei Ni
Quoted 55 lines · Eduardo Valentin
This changes the driver to use the
devm_version ofthermal_zone_of_sensor_registerand cleans up the local points and unregister calls.Cc Zhang Rui <[email protected]>Cc Stephen Warren <[email protected]>Cc Thierry Reding <[email protected]>Cc Alexandre Courbot <[email protected]>Signed-off-by Eduardo Valentin <[email protected]>--- drivers/thermal/tegra_soctherm.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-)drivers/thermal/tegra_soctherm.c +4
-4@@ -168,7 +168,7 @@ struct tegra_soctherm {struct clk *clock_soctherm;void __iomem *regs; -struct thermal_zone_device *thermctl_tzs[4 ]; +#define ZONE_NUMBER 4 };struct tsensor_shared_calibration {@@ -342,7 +342,7 @@ static const struct thermctl_zone_desc t124_thermctl_temp_zones[] = {static int tegra_soctherm_probe (struct platform_device *pdev) {struct tegra_soctherm *tegra; -struct thermal_zone_device *tz; +struct thermal_zone_device *z;struct tsensor_shared_calibration shared_calib;struct resource *res;unsigned int i;@@ -408,36 +408,29 @@ static int tegra_soctherm_probe(struct platform_device *pdev)/* Initialize thermctl sensors */ -for (i =0 ; i <ARRAY_SIZE (tegra->thermctl_tzs); ++i) { +for (i =0 ; i <ZONE_NUMBER ; ++i) {struct tegra_thermctl_zone *zone =devm_kzalloc (&pdev->dev,sizeof (*zone),GFP_KERNEL );if (!zone) { err = -ENOMEM ; - goto unregister_tzs; + goto disable_clocks; } zone->reg = tegra->regs + t124_thermctl_temp_zones[i].offset; zone->shift = t124_thermctl_temp_zones[i].shift;
Quoted 8 lines
drivers/thermal/tegra_soctherm.c static int tegra_soctherm_probe(struct platform_device *pdev) · line 422
Quoted 5 lines
drivers/thermal/tegra_soctherm.c +1
-4- tz =thermal_zone_of_sensor_register (&pdev->dev, i, zone, - &tegra_of_thermal_ops); -if (IS_ERR (tz)) { - err =PTR_ERR (tz); + z = devm_thermal_zone_of_sensor_register(&pdev->dev, i, zone,I prefer to still use "tz", it seems this line isn't over 80 characters, or we can add newline.
Yeah,
Quoted 2 lines
drivers/thermal/tegra_soctherm.c static int tegra_soctherm_probe(struct platform_device *pdev) · line 423
Quoted 2 lines
drivers/thermal/tegra_soctherm.c +1
-0+ &tegra_of_thermal_ops);
CHECK: Alignment should match open parenthesis
#423: FILE: drivers/thermal/tegra_soctherm.c:423:
+ tz = devm_thermal_zone_of_sensor_register(&pdev->dev, i, zone,
+ &tegra_of_thermal_ops);
and if you align it, then, you get the warning:
WARNING: line over 80 characters
#423: FILE: drivers/thermal/tegra_soctherm.c:423:
+ &tegra_of_thermal_ops);
And I did not want to add either of the above to the driver.
But if you prefer tz over z, we can keep the first (check) then.
What do you prefer?
Re: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register
Quoted 87 lines · Eduardo Valentin
* PGP Signed by an unknown key
Quoted 58 lines · Wei Ni
Quoted 55 lines · Eduardo Valentin
This changes the driver to use the
devm_version
ofthermal_zone_of_sensor_registerand cleans
up the local points and unregister calls.Cc Zhang Rui <[email protected]>Cc Stephen Warren <[email protected]>Cc Thierry Reding <[email protected]>Cc Alexandre Courbot <[email protected]>Signed-off-by Eduardo Valentin <[email protected]>--- drivers/thermal/tegra_soctherm.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-)drivers/thermal/tegra_soctherm.c +4
-4@@ -168,7 +168,7 @@ struct tegra_soctherm {struct clk *clock_soctherm;void __iomem *regs; -struct thermal_zone_device *thermctl_tzs[4 ]; +#define ZONE_NUMBER 4 };struct tsensor_shared_calibration {@@ -342,7 +342,7 @@ static const struct thermctl_zone_desc t124_thermctl_temp_zones[] = {static int tegra_soctherm_probe (struct platform_device *pdev) {struct tegra_soctherm *tegra; -struct thermal_zone_device *tz; +struct thermal_zone_device *z;struct tsensor_shared_calibration shared_calib;struct resource *res;unsigned int i;@@ -408,36 +408,29 @@ static int tegra_soctherm_probe(struct platform_device *pdev)/* Initialize thermctl sensors */ -for (i =0 ; i <ARRAY_SIZE (tegra->thermctl_tzs); ++i) { +for (i =0 ; i <ZONE_NUMBER ; ++i) {struct tegra_thermctl_zone *zone =devm_kzalloc (&pdev->dev,sizeof (*zone),GFP_KERNEL );if (!zone) { err = -ENOMEM ; - goto unregister_tzs; + goto disable_clocks; } zone->reg = tegra->regs + t124_thermctl_temp_zones[i].offset; zone->shift = t124_thermctl_temp_zones[i].shift;Quoted 8 lines
drivers/thermal/tegra_soctherm.c static int tegra_soctherm_probe(struct platform_device *pdev) · line 422
Quoted 5 lines
drivers/thermal/tegra_soctherm.c +1
-4- tz =thermal_zone_of_sensor_register (&pdev->dev, i, zone, - &tegra_of_thermal_ops); -if (IS_ERR (tz)) { - err =PTR_ERR (tz); + z = devm_thermal_zone_of_sensor_register(&pdev->dev, i, zone,I prefer to still use "tz", it seems this line isn't over 80 characters, or we can add newline.
Yeah,
Quoted 2 lines
drivers/thermal/tegra_soctherm.c static int tegra_soctherm_probe(struct platform_device *pdev) · line 423
Quoted 2 lines
drivers/thermal/tegra_soctherm.c +1
-0+ &tegra_of_thermal_ops);CHECK: Alignment should match open parenthesis
#423: FILE:drivers/thermal/tegra_soctherm.c:423:(quoted diff) +2
-0+ tz = devm_thermal_zone_of_sensor_register(&pdev->dev, i, zone, + &tegra_of_thermal_ops);and if you align it, then, you get the warning:
WARNING: line over 80 characters
#423: FILE:drivers/thermal/tegra_soctherm.c:423:drivers/thermal/tegra_soctherm.c +1
-0+ &tegra_of_thermal_ops);
Quoted 5 lines
And I did not want to add either of the above to the driver.
But if you prefer tz over z, we can keep the first (check) then.
What do you prefer?
Hmm, I see.
Ok, it's better to use "z" to resolve it.
Wei.
Quoted 8 lines
* Unknown Key
*0x7DA4E256
Eduardo Valentin
maintainerPATCH 13/13 hwmon: convert ti-thermal to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinThis changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.
--- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/thermal/ti-soc-thermal/ti-thermal-common.c +1 -4
@@ -337,7 +337,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id,return -EINVAL ;/* in case this is specified by DT */ - data->ti_thermal =thermal_zone_of_sensor_register (bgp->dev, id, + data->ti_thermal =devm_thermal_zone_of_sensor_register (bgp->dev, id, data, &ti_of_thermal_ops);if (IS_ERR (data->ti_thermal)) {/* Create thermal zone */
@@ -368,9 +368,6 @@ int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id)if (data && data->ti_thermal) {if (data->our_zone)thermal_zone_device_unregister (data->ti_thermal); -else -thermal_zone_of_sensor_unregister (bgp->dev, - data->ti_thermal); }return 0 ;
Signature · 1 line
2.1.4
Eduardo Valentin
maintainerPATCH 13/13 thermal: convert ti-thermal to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinThis changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.
--- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/thermal/ti-soc-thermal/ti-thermal-common.c +1 -4
@@ -337,7 +337,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id,return -EINVAL ;/* in case this is specified by DT */ - data->ti_thermal =thermal_zone_of_sensor_register (bgp->dev, id, + data->ti_thermal =devm_thermal_zone_of_sensor_register (bgp->dev, id, data, &ti_of_thermal_ops);if (IS_ERR (data->ti_thermal)) {/* Create thermal zone */
@@ -368,9 +368,6 @@ int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id)if (data && data->ti_thermal) {if (data->our_zone)thermal_zone_device_unregister (data->ti_thermal); -else -thermal_zone_of_sensor_unregister (bgp->dev, - data->ti_thermal); }return 0 ;
Signature · 1 line
2.1.4
kbuild test robot
build botRe: [PATCH 13/13] thermal: convert ti-thermal to use devm_thermal_zone_of_sensor_register
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…
Hi Eduardo,
[auto build test ERROR on soc-thermal/next]
[also build test ERROR on next-20160309]
[cannot apply to thermal/next v4.5-rc7]
[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: sparc64-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=sparc64
All error/warnings (new ones prefixed by >>):
drivers/thermal/ti-soc-thermal/ti-thermal-common.c: In function 'ti_thermal_expose_sensor':
>> drivers/thermal/ti-soc-thermal/ti-thermal-common.c:340:2: error: implicit declaration of function 'devm_thermal_zone_of_sensor_register' [-Werror=implicit-function-declaration]
data->ti_thermal = devm_thermal_zone_of_sensor_register(bgp->dev, id,
^
>> drivers/thermal/ti-soc-thermal/ti-thermal-common.c:340:19: warning: assignment makes pointer from integer without a cast
data->ti_thermal = devm_thermal_zone_of_sensor_register(bgp->dev, id,
^cc1: some warnings being treated as errors
vim +/devm_thermal_zone_of_sensor_register +340 drivers/thermal/ti-soc-thermal/ti-thermal-common.c
334 data = ti_thermal_build_data(bgp, id);
335
336 if (!data)
337 return -EINVAL;
338
339 /* in case this is specified by DT */
> 340 data->ti_thermal = devm_thermal_zone_of_sensor_register(bgp->dev, id,
341 data, &ti_of_thermal_ops);
342 if (IS_ERR(data->ti_thermal)) {
343 /* Create thermal zone */
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH 13/13] thermal: convert ti-thermal to use devm_thermal_zone_of_sensor_register
In reply to Eduardo ValentinHi Eduardo,
Quoted 4 lines · Eduardo Valentin
This changes the driver to use the
devm_version
ofthermal_zone_of_sensor_registerand cleans
up the local points and unregister calls.
Boot tested on dra7xx-evm, dra72x-evm, pandaboard-es. Also checked the thermal sysfs entries on am57xx-beagle-x15.
Quoted 33 lines
Cc Zhang Rui <[email protected]>Signed-off-by Eduardo Valentin <[email protected]>--- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/thermal/ti-soc-thermal/ti-thermal-common.c +1
-4@@ -337,7 +337,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id,return -EINVAL ;/* in case this is specified by DT */ - data->ti_thermal =thermal_zone_of_sensor_register (bgp->dev, id, + data->ti_thermal =devm_thermal_zone_of_sensor_register (bgp->dev, id, data, &ti_of_thermal_ops);if (IS_ERR (data->ti_thermal)) {/* Create thermal zone */ @@ -368,9 +368,6 @@ int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id)if (data && data->ti_thermal) {if (data->our_zone)thermal_zone_device_unregister (data->ti_thermal); -else -thermal_zone_of_sensor_unregister (bgp->dev, - data->ti_thermal); }return 0 ;