* [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_
@ 2016-03-09 21:35 Eduardo Valentin
2016-03-09 21:35 ` [PATCH 01/13] hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register Eduardo Valentin
` (13 more replies)
0 siblings, 14 replies; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-09 21:35 UTC (permalink / raw)
To: Rui Zhang; +Cc: Linux PM, LKML, lm-sensors, Eduardo Valentin
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(-)
--
2.1.4
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH 01/13] hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin
@ 2016-03-09 21:35 ` Eduardo Valentin
2016-03-10 0:02 ` kbuild test robot
2016-03-10 3:18 ` Guenter Roeck
2016-03-09 21:35 ` [PATCH 02/13] hwmon: convert ntc_thermistor " Eduardo Valentin
` (12 subsequent siblings)
13 siblings, 2 replies; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-09 21:35 UTC (permalink / raw)
To: Rui Zhang
Cc: Linux PM, LKML, lm-sensors, Eduardo Valentin, Jean Delvare,
Guenter Roeck
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(-)
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;
--
2.1.4
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 02/13] hwmon: convert ntc_thermistor to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin
2016-03-09 21:35 ` [PATCH 01/13] hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register Eduardo Valentin
@ 2016-03-09 21:35 ` Eduardo Valentin
2016-03-10 0:14 ` kbuild test robot
` (2 more replies)
2016-03-09 21:35 ` [PATCH 03/13] hwmon: convert tmp102 " Eduardo Valentin
` (11 subsequent siblings)
13 siblings, 3 replies; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-09 21:35 UTC (permalink / raw)
To: Rui Zhang
Cc: Linux PM, LKML, lm-sensors, Eduardo Valentin, Jean Delvare,
Guenter Roeck
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/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;
}
--
2.1.4
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 03/13] hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin
2016-03-09 21:35 ` [PATCH 01/13] hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register Eduardo Valentin
2016-03-09 21:35 ` [PATCH 02/13] hwmon: convert ntc_thermistor " Eduardo Valentin
@ 2016-03-09 21:35 ` Eduardo Valentin
2016-03-10 3:20 ` Guenter Roeck
2016-03-10 4:43 ` kbuild test robot
2016-03-09 21:35 ` [PATCH 04/13] hwmon: convert scpi-hwmon " Eduardo Valentin
` (10 subsequent siblings)
13 siblings, 2 replies; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-09 21:35 UTC (permalink / raw)
To: Rui Zhang
Cc: Linux PM, LKML, lm-sensors, Eduardo Valentin, Jean Delvare,
Guenter Roeck
This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: lm-sensors@lm-sensors.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
drivers/hwmon/tmp102.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
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 */
--
2.1.4
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 04/13] hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin
` (2 preceding siblings ...)
2016-03-09 21:35 ` [PATCH 03/13] hwmon: convert tmp102 " Eduardo Valentin
@ 2016-03-09 21:35 ` Eduardo Valentin
2016-03-10 2:29 ` Guenter Roeck
2016-03-09 21:35 ` [PATCH 05/13] input: convert sun4i-ts " Eduardo Valentin
` (9 subsequent siblings)
13 siblings, 1 reply; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-09 21:35 UTC (permalink / raw)
To: Rui Zhang
Cc: Linux PM, LKML, lm-sensors, Eduardo Valentin, Jean Delvare,
Guenter Roeck
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/scpi-hwmon.c | 41 ++++++++---------------------------------
1 file changed, 8 insertions(+), 33 deletions(-)
diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c
index 7e20567..2309e47 100644
--- a/drivers/hwmon/scpi-hwmon.c
+++ b/drivers/hwmon/scpi-hwmon.c
@@ -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);
--
2.1.4
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 05/13] input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin
` (3 preceding siblings ...)
2016-03-09 21:35 ` [PATCH 04/13] hwmon: convert scpi-hwmon " Eduardo Valentin
@ 2016-03-09 21:35 ` Eduardo Valentin
2016-03-09 21:45 ` Dmitry Torokhov
2016-03-10 9:34 ` Sascha Hauer
2016-03-09 21:35 ` [PATCH 06/13] thermal: convert hisi_thermal " Eduardo Valentin
` (8 subsequent siblings)
13 siblings, 2 replies; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-09 21:35 UTC (permalink / raw)
To: Rui Zhang
Cc: Linux PM, LKML, lm-sensors, Eduardo Valentin, Dmitry Torokhov,
Maxime Ripard, Chen-Yu Tsai, Hans de Goede, Lukasz Majewski,
Heiko Stuebner, Sascha Hauer, Jens Thiele, linux-input,
linux-arm-kernel
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: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Jens Thiele <karme@karme.de>
Cc: linux-input@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
drivers/input/touchscreen/sun4i-ts.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index 4857943..d07dd29 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -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);
--
2.1.4
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 06/13] thermal: convert hisi_thermal to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin
` (4 preceding siblings ...)
2016-03-09 21:35 ` [PATCH 05/13] input: convert sun4i-ts " Eduardo Valentin
@ 2016-03-09 21:35 ` Eduardo Valentin
2016-03-09 21:35 ` [PATCH 07/13] thermal: convert mtk_thermal " Eduardo Valentin
` (7 subsequent siblings)
13 siblings, 0 replies; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-09 21:35 UTC (permalink / raw)
To: Rui Zhang; +Cc: Linux PM, LKML, lm-sensors, Eduardo Valentin
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: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
drivers/thermal/hisi_thermal.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c
index 36d0729..c9b2f81 100644
--- a/drivers/thermal/hisi_thermal.c
+++ b/drivers/thermal/hisi_thermal.c
@@ -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);
--
2.1.4
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 07/13] thermal: convert mtk_thermal to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin
` (5 preceding siblings ...)
2016-03-09 21:35 ` [PATCH 06/13] thermal: convert hisi_thermal " Eduardo Valentin
@ 2016-03-09 21:35 ` Eduardo Valentin
2016-03-09 23:18 ` kbuild test robot
2016-03-09 21:35 ` [PATCH 08/13] thermal: convert qcom-spmi " Eduardo Valentin
` (6 subsequent siblings)
13 siblings, 1 reply; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-09 21:35 UTC (permalink / raw)
To: Rui Zhang
Cc: Linux PM, LKML, lm-sensors, Eduardo Valentin, Matthias Brugger,
linux-arm-kernel, linux-mediatek
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: Zhang Rui <rui.zhang@intel.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
drivers/thermal/mtk_thermal.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
index 3d93b1c..2c40b0f 100644
--- a/drivers/thermal/mtk_thermal.c
+++ b/drivers/thermal/mtk_thermal.c
@@ -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);
--
2.1.4
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 08/13] thermal: convert qcom-spmi to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin
` (6 preceding siblings ...)
2016-03-09 21:35 ` [PATCH 07/13] thermal: convert mtk_thermal " Eduardo Valentin
@ 2016-03-09 21:35 ` Eduardo Valentin
2016-03-09 21:35 ` [PATCH 09/13] thermal: convert rcar_thermal " Eduardo Valentin
` (5 subsequent siblings)
13 siblings, 0 replies; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-09 21:35 UTC (permalink / raw)
To: Rui Zhang; +Cc: Linux PM, LKML, lm-sensors, Eduardo Valentin
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: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
drivers/thermal/qcom-spmi-temp-alarm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/thermal/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom-spmi-temp-alarm.c
index b677aad..f8a3c60 100644
--- a/drivers/thermal/qcom-spmi-temp-alarm.c
+++ b/drivers/thermal/qcom-spmi-temp-alarm.c
@@ -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);
--
2.1.4
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 09/13] thermal: convert rcar_thermal to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin
` (7 preceding siblings ...)
2016-03-09 21:35 ` [PATCH 08/13] thermal: convert qcom-spmi " Eduardo Valentin
@ 2016-03-09 21:35 ` Eduardo Valentin
2016-03-09 21:35 ` [PATCH 10/13] thermal: convert rockchip_thermal " Eduardo Valentin
` (4 subsequent siblings)
13 siblings, 0 replies; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-09 21:35 UTC (permalink / raw)
To: Rui Zhang; +Cc: Linux PM, LKML, lm-sensors, Eduardo Valentin
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: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
drivers/thermal/rcar_thermal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 0e735ac..a5e4181 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -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
--
2.1.4
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 10/13] thermal: convert rockchip_thermal to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin
` (8 preceding siblings ...)
2016-03-09 21:35 ` [PATCH 09/13] thermal: convert rcar_thermal " Eduardo Valentin
@ 2016-03-09 21:35 ` Eduardo Valentin
2016-03-09 22:23 ` Heiko Stübner
2016-03-10 2:36 ` Caesar Wang
2016-03-09 21:35 ` [PATCH 11/13] thermal: convert exynos " Eduardo Valentin
` (3 subsequent siblings)
13 siblings, 2 replies; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-09 21:35 UTC (permalink / raw)
To: Rui Zhang
Cc: Linux PM, LKML, lm-sensors, Eduardo Valentin, Heiko Stuebner,
linux-arm-kernel, linux-rockchip
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: Zhang Rui <rui.zhang@intel.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: linux-pm@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
drivers/thermal/rockchip_thermal.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index b58e3fb..792c5d0 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -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);
--
2.1.4
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin
` (9 preceding siblings ...)
2016-03-09 21:35 ` [PATCH 10/13] thermal: convert rockchip_thermal " Eduardo Valentin
@ 2016-03-09 21:35 ` Eduardo Valentin
2016-03-10 0:16 ` Krzysztof Kozlowski
2016-03-10 9:16 ` Lukasz Majewski
2016-03-09 21:35 ` [PATCH 12/13] thermal: convert tegra_thermal " Eduardo Valentin
` (2 subsequent siblings)
13 siblings, 2 replies; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-09 21:35 UTC (permalink / raw)
To: Rui Zhang
Cc: Linux PM, LKML, lm-sensors, Eduardo Valentin, Lukasz Majewski,
Kukjin Kim, Krzysztof Kozlowski, linux-samsung-soc,
linux-arm-kernel
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: Lukasz Majewski <l.majewski@samsung.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
drivers/thermal/samsung/exynos_tmu.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index fa61eff..256039e 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -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);
--
2.1.4
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin
` (10 preceding siblings ...)
2016-03-09 21:35 ` [PATCH 11/13] thermal: convert exynos " Eduardo Valentin
@ 2016-03-09 21:35 ` Eduardo Valentin
2016-03-10 8:46 ` Wei Ni
2016-03-09 21:35 ` [PATCH 13/13] hwmon: convert ti-thermal " Eduardo Valentin
2016-03-09 21:35 ` [PATCH 13/13] thermal: " Eduardo Valentin
13 siblings, 1 reply; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-09 21:35 UTC (permalink / raw)
To: Rui Zhang
Cc: Linux PM, LKML, lm-sensors, Eduardo Valentin, Stephen Warren,
Thierry Reding, Alexandre Courbot, linux-tegra
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: Zhang Rui <rui.zhang@intel.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
drivers/thermal/tegra_soctherm.c | 31 +++++++++----------------------
1 file changed, 9 insertions(+), 22 deletions(-)
diff --git a/drivers/thermal/tegra_soctherm.c b/drivers/thermal/tegra_soctherm.c
index 74ea576..0018ccd 100644
--- a/drivers/thermal/tegra_soctherm.c
+++ b/drivers/thermal/tegra_soctherm.c
@@ -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);
--
2.1.4
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 13/13] hwmon: convert ti-thermal to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin
` (11 preceding siblings ...)
2016-03-09 21:35 ` [PATCH 12/13] thermal: convert tegra_thermal " Eduardo Valentin
@ 2016-03-09 21:35 ` Eduardo Valentin
2016-03-09 21:35 ` [PATCH 13/13] thermal: " Eduardo Valentin
13 siblings, 0 replies; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-09 21:35 UTC (permalink / raw)
To: Rui Zhang; +Cc: Linux PM, LKML, lm-sensors, Eduardo Valentin, linux-omap
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: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-omap@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
index b213a12..15c0a9a 100644
--- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
+++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
@@ -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;
--
2.1.4
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 13/13] thermal: convert ti-thermal to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin
` (12 preceding siblings ...)
2016-03-09 21:35 ` [PATCH 13/13] hwmon: convert ti-thermal " Eduardo Valentin
@ 2016-03-09 21:35 ` Eduardo Valentin
2016-03-09 22:11 ` kbuild test robot
2016-03-15 12:26 ` Keerthy
13 siblings, 2 replies; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-09 21:35 UTC (permalink / raw)
To: Rui Zhang; +Cc: Linux PM, LKML, lm-sensors, Eduardo Valentin, linux-omap
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: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-omap@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
index b213a12..15c0a9a 100644
--- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
+++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
@@ -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;
--
2.1.4
^ permalink raw reply related [flat|nested] 39+ messages in thread
* Re: [PATCH 05/13] input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 05/13] input: convert sun4i-ts " Eduardo Valentin
@ 2016-03-09 21:45 ` Dmitry Torokhov
2016-03-14 21:07 ` Eduardo Valentin
2016-03-10 9:34 ` Sascha Hauer
1 sibling, 1 reply; 39+ messages in thread
From: Dmitry Torokhov @ 2016-03-09 21:45 UTC (permalink / raw)
To: Eduardo Valentin
Cc: Rui Zhang, Linux PM, LKML, lm-sensors, Maxime Ripard,
Chen-Yu Tsai, Hans de Goede, Lukasz Majewski, Heiko Stuebner,
Sascha Hauer, Jens Thiele, linux-input, linux-arm-kernel
On Wed, Mar 09, 2016 at 01:35:27PM -0800, 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: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Heiko Stuebner <heiko@sntech.de>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Jens Thiele <karme@karme.de>
> Cc: linux-input@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
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.
> ---
> drivers/input/touchscreen/sun4i-ts.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
> index 4857943..d07dd29 100644
> --- a/drivers/input/touchscreen/sun4i-ts.c
> +++ b/drivers/input/touchscreen/sun4i-ts.c
> @@ -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);
>
> --
> 2.1.4
>
--
Dmitry
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 13/13] thermal: convert ti-thermal to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 13/13] thermal: " Eduardo Valentin
@ 2016-03-09 22:11 ` kbuild test robot
2016-03-15 12:26 ` Keerthy
1 sibling, 0 replies; 39+ messages in thread
From: kbuild test robot @ 2016-03-09 22:11 UTC (permalink / raw)
To: Eduardo Valentin
Cc: kbuild-all, Rui Zhang, Linux PM, LKML, lm-sensors,
Eduardo Valentin, linux-omap
[-- Attachment #1: Type: text/plain, Size: 2061 bytes --]
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
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 45120 bytes --]
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 10/13] thermal: convert rockchip_thermal to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 10/13] thermal: convert rockchip_thermal " Eduardo Valentin
@ 2016-03-09 22:23 ` Heiko Stübner
2016-03-10 2:36 ` Caesar Wang
1 sibling, 0 replies; 39+ messages in thread
From: Heiko Stübner @ 2016-03-09 22:23 UTC (permalink / raw)
To: Eduardo Valentin, Shawn Lin, Caesar Wang
Cc: Rui Zhang, Linux PM, LKML, lm-sensors, linux-arm-kernel, linux-rockchip
Am Mittwoch, 9. März 2016, 13:35:32 schrieb Eduardo Valentin:
> 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: Zhang Rui <rui.zhang@intel.com>
> Cc: Heiko Stuebner <heiko@sntech.de>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-rockchip@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
to me this looks ok
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
I've also added in some Rockchip people that were working on the driver in the
past.
Heiko
> ---
> drivers/thermal/rockchip_thermal.c | 17 ++++-------------
> 1 file changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/thermal/rockchip_thermal.c
> b/drivers/thermal/rockchip_thermal.c index b58e3fb..792c5d0 100644
> --- a/drivers/thermal/rockchip_thermal.c
> +++ b/drivers/thermal/rockchip_thermal.c
> @@ -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);
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 07/13] thermal: convert mtk_thermal to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 07/13] thermal: convert mtk_thermal " Eduardo Valentin
@ 2016-03-09 23:18 ` kbuild test robot
0 siblings, 0 replies; 39+ messages in thread
From: kbuild test robot @ 2016-03-09 23:18 UTC (permalink / raw)
To: Eduardo Valentin
Cc: kbuild-all, Rui Zhang, Linux PM, LKML, lm-sensors,
Eduardo Valentin, Matthias Brugger, linux-arm-kernel,
linux-mediatek
[-- Attachment #1: Type: text/plain, Size: 1720 bytes --]
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
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 43726 bytes --]
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 01/13] hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 01/13] hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register Eduardo Valentin
@ 2016-03-10 0:02 ` kbuild test robot
2016-03-10 3:18 ` Guenter Roeck
1 sibling, 0 replies; 39+ messages in thread
From: kbuild test robot @ 2016-03-10 0:02 UTC (permalink / raw)
To: Eduardo Valentin
Cc: kbuild-all, Rui Zhang, Linux PM, LKML, lm-sensors,
Eduardo Valentin, Jean Delvare, Guenter Roeck
[-- Attachment #1: Type: text/plain, Size: 1724 bytes --]
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
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 44067 bytes --]
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 02/13] hwmon: convert ntc_thermistor to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 02/13] hwmon: convert ntc_thermistor " Eduardo Valentin
@ 2016-03-10 0:14 ` kbuild test robot
2016-03-10 2:16 ` kbuild test robot
2016-03-10 3:19 ` Guenter Roeck
2 siblings, 0 replies; 39+ messages in thread
From: kbuild test robot @ 2016-03-10 0:14 UTC (permalink / raw)
To: Eduardo Valentin
Cc: kbuild-all, Rui Zhang, Linux PM, LKML, lm-sensors,
Eduardo Valentin, Jean Delvare, Guenter Roeck
[-- Attachment #1: Type: text/plain, Size: 2488 bytes --]
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
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 44067 bytes --]
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 11/13] thermal: convert exynos " Eduardo Valentin
@ 2016-03-10 0:16 ` Krzysztof Kozlowski
2016-03-14 19:48 ` Eduardo Valentin
2016-03-10 9:16 ` Lukasz Majewski
1 sibling, 1 reply; 39+ messages in thread
From: Krzysztof Kozlowski @ 2016-03-10 0:16 UTC (permalink / raw)
To: Eduardo Valentin, Rui Zhang
Cc: Linux PM, LKML, lm-sensors, Lukasz Majewski, Kukjin Kim,
linux-samsung-soc, linux-arm-kernel
On 10.03.2016 06:35, 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: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-samsung-soc@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> ---
> drivers/thermal/samsung/exynos_tmu.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index fa61eff..256039e 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -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);
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
> exynos_tmu_control(pdev, false);
>
> clk_disable_unprepare(data->sclk);
>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 02/13] hwmon: convert ntc_thermistor to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 02/13] hwmon: convert ntc_thermistor " Eduardo Valentin
2016-03-10 0:14 ` kbuild test robot
@ 2016-03-10 2:16 ` kbuild test robot
2016-03-10 3:19 ` Guenter Roeck
2 siblings, 0 replies; 39+ messages in thread
From: kbuild test robot @ 2016-03-10 2:16 UTC (permalink / raw)
To: Eduardo Valentin
Cc: kbuild-all, Rui Zhang, Linux PM, LKML, lm-sensors,
Eduardo Valentin, Jean Delvare, Guenter Roeck
[-- Attachment #1: Type: text/plain, Size: 1968 bytes --]
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
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 44067 bytes --]
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 04/13] hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 04/13] hwmon: convert scpi-hwmon " Eduardo Valentin
@ 2016-03-10 2:29 ` Guenter Roeck
2016-03-14 19:49 ` Eduardo Valentin
0 siblings, 1 reply; 39+ messages in thread
From: Guenter Roeck @ 2016-03-10 2:29 UTC (permalink / raw)
To: Eduardo Valentin, Rui Zhang; +Cc: Linux PM, LKML, lm-sensors, Jean Delvare
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>
> ---
> drivers/hwmon/scpi-hwmon.c | 41 ++++++++---------------------------------
> 1 file changed, 8 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c
> index 7e20567..2309e47 100644
> --- a/drivers/hwmon/scpi-hwmon.c
> +++ b/drivers/hwmon/scpi-hwmon.c
> @@ -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;
return -ENOMEM;
... and drop the unnecessary label.
Thanks,
Guenter
> }
>
> 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);
>
>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 10/13] thermal: convert rockchip_thermal to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 10/13] thermal: convert rockchip_thermal " Eduardo Valentin
2016-03-09 22:23 ` Heiko Stübner
@ 2016-03-10 2:36 ` Caesar Wang
1 sibling, 0 replies; 39+ messages in thread
From: Caesar Wang @ 2016-03-10 2:36 UTC (permalink / raw)
To: Eduardo Valentin
Cc: Rui Zhang, Heiko Stuebner, Linux PM, LKML, lm-sensors,
linux-rockchip, linux-arm-kernel
在 2016年03月10日 05:35, Eduardo Valentin 写道:
> 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: Zhang Rui <rui.zhang@intel.com>
> Cc: Heiko Stuebner <heiko@sntech.de>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-rockchip@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Tested-by: Caesar Wang <wxt@rock-chips.com>
Reviewed-by: Caesar Wang <wxt@rock-chips.com>
I just cherry-pick the devm* patches to test the rockchip thermal.
> ---
> drivers/thermal/rockchip_thermal.c | 17 ++++-------------
> 1 file changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
> index b58e3fb..792c5d0 100644
> --- a/drivers/thermal/rockchip_thermal.c
> +++ b/drivers/thermal/rockchip_thermal.c
> @@ -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);
--
Thanks,
Caesar
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 01/13] hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 01/13] hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register Eduardo Valentin
2016-03-10 0:02 ` kbuild test robot
@ 2016-03-10 3:18 ` Guenter Roeck
1 sibling, 0 replies; 39+ messages in thread
From: Guenter Roeck @ 2016-03-10 3:18 UTC (permalink / raw)
To: Eduardo Valentin, Rui Zhang; +Cc: Linux PM, LKML, lm-sensors, Jean Delvare
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;
>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 02/13] hwmon: convert ntc_thermistor to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 02/13] hwmon: convert ntc_thermistor " Eduardo Valentin
2016-03-10 0:14 ` kbuild test robot
2016-03-10 2:16 ` kbuild test robot
@ 2016-03-10 3:19 ` Guenter Roeck
2 siblings, 0 replies; 39+ messages in thread
From: Guenter Roeck @ 2016-03-10 3:19 UTC (permalink / raw)
To: Eduardo Valentin, Rui Zhang; +Cc: Linux PM, LKML, lm-sensors, Jean Delvare
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/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;
> }
>
>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 03/13] hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 03/13] hwmon: convert tmp102 " Eduardo Valentin
@ 2016-03-10 3:20 ` Guenter Roeck
2016-03-10 4:43 ` kbuild test robot
1 sibling, 0 replies; 39+ messages in thread
From: Guenter Roeck @ 2016-03-10 3:20 UTC (permalink / raw)
To: Eduardo Valentin, Rui Zhang; +Cc: Linux PM, LKML, lm-sensors, Jean Delvare
On 03/09/2016 01:35 PM, Eduardo Valentin wrote:
> This changes the driver to use the devm_ version
> of thermal_zone_of_sensor_register and cleans
> up the local points and unregister calls.
>
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: lm-sensors@lm-sensors.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/hwmon/tmp102.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c
> index 5289aa0..f1e96fd 100644
> --- a/drivers/hwmon/tmp102.c
> +++ b/drivers/hwmon/tmp102.c
> @@ -53,7 +53,6 @@
> struct tmp102 {
> struct i2c_client *client;
> struct device *hwmon_dev;
> - struct thermal_zone_device *tz;
> struct mutex lock;
> u16 config_orig;
> unsigned long last_update;
> @@ -232,10 +231,8 @@ static int tmp102_probe(struct i2c_client *client,
> goto fail_restore_config;
> }
> tmp102->hwmon_dev = hwmon_dev;
> - tmp102->tz = thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
> - &tmp102_of_thermal_ops);
> - if (IS_ERR(tmp102->tz))
> - tmp102->tz = NULL;
> + devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
> + &tmp102_of_thermal_ops);
>
> dev_info(dev, "initialized\n");
>
> @@ -251,7 +248,6 @@ static int tmp102_remove(struct i2c_client *client)
> {
> struct tmp102 *tmp102 = i2c_get_clientdata(client);
>
> - thermal_zone_of_sensor_unregister(tmp102->hwmon_dev, tmp102->tz);
> hwmon_device_unregister(tmp102->hwmon_dev);
>
> /* Stop monitoring if device was stopped originally */
>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 03/13] hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 03/13] hwmon: convert tmp102 " Eduardo Valentin
2016-03-10 3:20 ` Guenter Roeck
@ 2016-03-10 4:43 ` kbuild test robot
1 sibling, 0 replies; 39+ messages in thread
From: kbuild test robot @ 2016-03-10 4:43 UTC (permalink / raw)
To: Eduardo Valentin
Cc: kbuild-all, Rui Zhang, Linux PM, LKML, lm-sensors,
Eduardo Valentin, Jean Delvare, Guenter Roeck
[-- Attachment #1: Type: text/plain, Size: 1753 bytes --]
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
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 44067 bytes --]
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 12/13] thermal: convert tegra_thermal " Eduardo Valentin
@ 2016-03-10 8:46 ` Wei Ni
2016-03-14 21:16 ` Eduardo Valentin
0 siblings, 1 reply; 39+ messages in thread
From: Wei Ni @ 2016-03-10 8:46 UTC (permalink / raw)
To: Eduardo Valentin, Rui Zhang
Cc: Linux PM, LKML, lm-sensors, Stephen Warren, Thierry Reding,
Alexandre Courbot, linux-tegra
On 2016年03月10日 05:35, 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: Zhang Rui <rui.zhang@intel.com>
> Cc: Stephen Warren <swarren@wwwdotorg.org>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Alexandre Courbot <gnurou@gmail.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-tegra@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> ---
> drivers/thermal/tegra_soctherm.c | 31 +++++++++----------------------
> 1 file changed, 9 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/thermal/tegra_soctherm.c b/drivers/thermal/tegra_soctherm.c
> index 74ea576..0018ccd 100644
> --- a/drivers/thermal/tegra_soctherm.c
> +++ b/drivers/thermal/tegra_soctherm.c
> @@ -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,
I prefer to still use "tz", it seems this line isn't over 80 characters, or we
can add newline.
> + &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);
>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 11/13] thermal: convert exynos " Eduardo Valentin
2016-03-10 0:16 ` Krzysztof Kozlowski
@ 2016-03-10 9:16 ` Lukasz Majewski
1 sibling, 0 replies; 39+ messages in thread
From: Lukasz Majewski @ 2016-03-10 9:16 UTC (permalink / raw)
To: Eduardo Valentin
Cc: Rui Zhang, Linux PM, LKML, lm-sensors, Kukjin Kim,
Krzysztof Kozlowski, linux-samsung-soc, linux-arm-kernel
Hi Eduardo,
> 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: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-samsung-soc@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> ---
> drivers/thermal/samsung/exynos_tmu.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/thermal/samsung/exynos_tmu.c
> b/drivers/thermal/samsung/exynos_tmu.c index fa61eff..256039e 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -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);
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
--
Best regards,
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 05/13] input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 05/13] input: convert sun4i-ts " Eduardo Valentin
2016-03-09 21:45 ` Dmitry Torokhov
@ 2016-03-10 9:34 ` Sascha Hauer
2016-03-10 13:19 ` Hans de Goede
1 sibling, 1 reply; 39+ messages in thread
From: Sascha Hauer @ 2016-03-10 9:34 UTC (permalink / raw)
To: Eduardo Valentin
Cc: Rui Zhang, Linux PM, LKML, lm-sensors, Dmitry Torokhov,
Maxime Ripard, Chen-Yu Tsai, Hans de Goede, Lukasz Majewski,
Heiko Stuebner, Jens Thiele, linux-input, linux-arm-kernel
On Wed, Mar 09, 2016 at 01:35:27PM -0800, 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: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Heiko Stuebner <heiko@sntech.de>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Jens Thiele <karme@karme.de>
> Cc: linux-input@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> ---
> drivers/input/touchscreen/sun4i-ts.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
> index 4857943..d07dd29 100644
> --- a/drivers/input/touchscreen/sun4i-ts.c
> +++ b/drivers/input/touchscreen/sun4i-ts.c
> @@ -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);
Shouldn't we check the return value? There are a few possibilities for
thermal_zone_of_sensor_register to fail.
Sascha
--
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 |
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 05/13] input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register
2016-03-10 9:34 ` Sascha Hauer
@ 2016-03-10 13:19 ` Hans de Goede
0 siblings, 0 replies; 39+ messages in thread
From: Hans de Goede @ 2016-03-10 13:19 UTC (permalink / raw)
To: Sascha Hauer, Eduardo Valentin
Cc: Rui Zhang, Linux PM, LKML, lm-sensors, Dmitry Torokhov,
Maxime Ripard, Chen-Yu Tsai, Lukasz Majewski, Heiko Stuebner,
Jens Thiele, linux-input, linux-arm-kernel
Hi,
On 10-03-16 10:34, Sascha Hauer wrote:
> On Wed, Mar 09, 2016 at 01:35:27PM -0800, 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: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
>> Cc: Chen-Yu Tsai <wens@csie.org>
>> Cc: Hans de Goede <hdegoede@redhat.com>
>> Cc: Zhang Rui <rui.zhang@intel.com>
>> Cc: Lukasz Majewski <l.majewski@samsung.com>
>> Cc: Heiko Stuebner <heiko@sntech.de>
>> Cc: Sascha Hauer <s.hauer@pengutronix.de>
>> Cc: Jens Thiele <karme@karme.de>
>> Cc: linux-input@vger.kernel.org
>> Cc: linux-arm-kernel@lists.infradead.org
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
>> ---
>> drivers/input/touchscreen/sun4i-ts.c | 9 +--------
>> 1 file changed, 1 insertion(+), 8 deletions(-)
>>
>> diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
>> index 4857943..d07dd29 100644
>> --- a/drivers/input/touchscreen/sun4i-ts.c
>> +++ b/drivers/input/touchscreen/sun4i-ts.c
>> @@ -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);
>
> Shouldn't we check the return value? There are a few possibilities for
> thermal_zone_of_sensor_register to 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:
Acked-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register
2016-03-10 0:16 ` Krzysztof Kozlowski
@ 2016-03-14 19:48 ` Eduardo Valentin
0 siblings, 0 replies; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-14 19:48 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Rui Zhang, Linux PM, LKML, lm-sensors, Lukasz Majewski,
Kukjin Kim, linux-samsung-soc, linux-arm-kernel
On Thu, Mar 10, 2016 at 09:16:36AM +0900, Krzysztof Kozlowski wrote:
> On 10.03.2016 06:35, 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: Lukasz Majewski <l.majewski@samsung.com>
> > Cc: Zhang Rui <rui.zhang@intel.com>
> > Cc: Kukjin Kim <kgene@kernel.org>
> > Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Cc: linux-pm@vger.kernel.org
> > Cc: linux-samsung-soc@vger.kernel.org
> > Cc: linux-arm-kernel@lists.infradead.org
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> > ---
> > drivers/thermal/samsung/exynos_tmu.c | 12 ++++--------
> > 1 file changed, 4 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> > index fa61eff..256039e 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.c
> > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > @@ -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);
>
> 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?
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.
>
> Best regards,
> Krzysztof
>
> > exynos_tmu_control(pdev, false);
> >
> > clk_disable_unprepare(data->sclk);
> >
>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 04/13] hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register
2016-03-10 2:29 ` Guenter Roeck
@ 2016-03-14 19:49 ` Eduardo Valentin
0 siblings, 0 replies; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-14 19:49 UTC (permalink / raw)
To: Guenter Roeck; +Cc: Rui Zhang, Linux PM, LKML, lm-sensors, Jean Delvare
[-- Attachment #1: Type: text/plain, Size: 2496 bytes --]
On Wed, Mar 09, 2016 at 06:29:17PM -0800, Guenter Roeck wrote:
> 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>
> >---
> > drivers/hwmon/scpi-hwmon.c | 41 ++++++++---------------------------------
> > 1 file changed, 8 insertions(+), 33 deletions(-)
> >
> >diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c
> >index 7e20567..2309e47 100644
> >--- a/drivers/hwmon/scpi-hwmon.c
> >+++ b/drivers/hwmon/scpi-hwmon.c
> >@@ -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;
>
> return -ENOMEM;
>
> ... and drop the unnecessary label.
True. I will change as requested.
Thanks
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 05/13] input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register
2016-03-09 21:45 ` Dmitry Torokhov
@ 2016-03-14 21:07 ` Eduardo Valentin
0 siblings, 0 replies; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-14 21:07 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Rui Zhang, Linux PM, LKML, lm-sensors, Maxime Ripard,
Chen-Yu Tsai, Hans de Goede, Lukasz Majewski, Heiko Stuebner,
Sascha Hauer, Jens Thiele, linux-input, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 1331 bytes --]
On Wed, Mar 09, 2016 at 01:45:14PM -0800, Dmitry Torokhov wrote:
> On Wed, Mar 09, 2016 at 01:35:27PM -0800, 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: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> > Cc: Chen-Yu Tsai <wens@csie.org>
> > Cc: Hans de Goede <hdegoede@redhat.com>
> > Cc: Zhang Rui <rui.zhang@intel.com>
> > Cc: Lukasz Majewski <l.majewski@samsung.com>
> > Cc: Heiko Stuebner <heiko@sntech.de>
> > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > Cc: Jens Thiele <karme@karme.de>
> > Cc: linux-input@vger.kernel.org
> > Cc: linux-arm-kernel@lists.infradead.org
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
>
> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>
> 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.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register
2016-03-10 8:46 ` Wei Ni
@ 2016-03-14 21:16 ` Eduardo Valentin
2016-03-15 5:42 ` Wei Ni
0 siblings, 1 reply; 39+ messages in thread
From: Eduardo Valentin @ 2016-03-14 21:16 UTC (permalink / raw)
To: Wei Ni
Cc: Rui Zhang, Linux PM, LKML, lm-sensors, Stephen Warren,
Thierry Reding, Alexandre Courbot, linux-tegra
[-- Attachment #1: Type: text/plain, Size: 3179 bytes --]
On Thu, Mar 10, 2016 at 04:46:55PM +0800, Wei Ni wrote:
>
>
> On 2016年03月10日 05:35, 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: Zhang Rui <rui.zhang@intel.com>
> > Cc: Stephen Warren <swarren@wwwdotorg.org>
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Cc: Alexandre Courbot <gnurou@gmail.com>
> > Cc: linux-pm@vger.kernel.org
> > Cc: linux-tegra@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> > ---
> > drivers/thermal/tegra_soctherm.c | 31 +++++++++----------------------
> > 1 file changed, 9 insertions(+), 22 deletions(-)
> >
> > diff --git a/drivers/thermal/tegra_soctherm.c b/drivers/thermal/tegra_soctherm.c
> > index 74ea576..0018ccd 100644
> > --- a/drivers/thermal/tegra_soctherm.c
> > +++ b/drivers/thermal/tegra_soctherm.c
> > @@ -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,
>
> I prefer to still use "tz", it seems this line isn't over 80 characters, or we
> can add newline.
Yeah,
>
> > + &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?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register
2016-03-14 21:16 ` Eduardo Valentin
@ 2016-03-15 5:42 ` Wei Ni
0 siblings, 0 replies; 39+ messages in thread
From: Wei Ni @ 2016-03-15 5:42 UTC (permalink / raw)
To: Eduardo Valentin
Cc: Rui Zhang, Linux PM, LKML, lm-sensors, Stephen Warren,
Thierry Reding, Alexandre Courbot, linux-tegra
On 2016年03月15日 05:16, Eduardo Valentin wrote:
> * PGP Signed by an unknown key
>
> On Thu, Mar 10, 2016 at 04:46:55PM +0800, Wei Ni wrote:
>>
>>
>> On 2016年03月10日 05:35, 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: Zhang Rui <rui.zhang@intel.com>
>>> Cc: Stephen Warren <swarren@wwwdotorg.org>
>>> Cc: Thierry Reding <thierry.reding@gmail.com>
>>> Cc: Alexandre Courbot <gnurou@gmail.com>
>>> Cc: linux-pm@vger.kernel.org
>>> Cc: linux-tegra@vger.kernel.org
>>> Cc: linux-kernel@vger.kernel.org
>>> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
>>> ---
>>> drivers/thermal/tegra_soctherm.c | 31 +++++++++----------------------
>>> 1 file changed, 9 insertions(+), 22 deletions(-)
>>>
>>> diff --git a/drivers/thermal/tegra_soctherm.c b/drivers/thermal/tegra_soctherm.c
>>> index 74ea576..0018ccd 100644
>>> --- a/drivers/thermal/tegra_soctherm.c
>>> +++ b/drivers/thermal/tegra_soctherm.c
>>> @@ -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,
>>
>> I prefer to still use "tz", it seems this line isn't over 80 characters, or we
>> can add newline.
>
>
> Yeah,
>
>
>>
>>> + &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?
Hmm, I see.
Ok, it's better to use "z" to resolve it.
Wei.
>
>
>
>
>
> * Unknown Key
> * 0x7DA4E256
>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH 13/13] thermal: convert ti-thermal to use devm_thermal_zone_of_sensor_register
2016-03-09 21:35 ` [PATCH 13/13] thermal: " Eduardo Valentin
2016-03-09 22:11 ` kbuild test robot
@ 2016-03-15 12:26 ` Keerthy
1 sibling, 0 replies; 39+ messages in thread
From: Keerthy @ 2016-03-15 12:26 UTC (permalink / raw)
To: Eduardo Valentin, Rui Zhang; +Cc: Linux PM, LKML, lm-sensors, linux-omap
Hi Eduardo,
On Thursday 10 March 2016 03:05 AM, 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.
>
Boot tested on dra7xx-evm, dra72x-evm, pandaboard-es.
Also checked the thermal sysfs entries on am57xx-beagle-x15.
Tested-by: Keerthy <j-keerthy@ti.com>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-omap@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> ---
> drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> index b213a12..15c0a9a 100644
> --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> @@ -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;
>
^ permalink raw reply [flat|nested] 39+ messages in thread
end of thread, other threads:[~2016-03-15 12:28 UTC | newest]
Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-09 21:35 [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_ Eduardo Valentin
2016-03-09 21:35 ` [PATCH 01/13] hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register Eduardo Valentin
2016-03-10 0:02 ` kbuild test robot
2016-03-10 3:18 ` Guenter Roeck
2016-03-09 21:35 ` [PATCH 02/13] hwmon: convert ntc_thermistor " Eduardo Valentin
2016-03-10 0:14 ` kbuild test robot
2016-03-10 2:16 ` kbuild test robot
2016-03-10 3:19 ` Guenter Roeck
2016-03-09 21:35 ` [PATCH 03/13] hwmon: convert tmp102 " Eduardo Valentin
2016-03-10 3:20 ` Guenter Roeck
2016-03-10 4:43 ` kbuild test robot
2016-03-09 21:35 ` [PATCH 04/13] hwmon: convert scpi-hwmon " Eduardo Valentin
2016-03-10 2:29 ` Guenter Roeck
2016-03-14 19:49 ` Eduardo Valentin
2016-03-09 21:35 ` [PATCH 05/13] input: convert sun4i-ts " Eduardo Valentin
2016-03-09 21:45 ` Dmitry Torokhov
2016-03-14 21:07 ` Eduardo Valentin
2016-03-10 9:34 ` Sascha Hauer
2016-03-10 13:19 ` Hans de Goede
2016-03-09 21:35 ` [PATCH 06/13] thermal: convert hisi_thermal " Eduardo Valentin
2016-03-09 21:35 ` [PATCH 07/13] thermal: convert mtk_thermal " Eduardo Valentin
2016-03-09 23:18 ` kbuild test robot
2016-03-09 21:35 ` [PATCH 08/13] thermal: convert qcom-spmi " Eduardo Valentin
2016-03-09 21:35 ` [PATCH 09/13] thermal: convert rcar_thermal " Eduardo Valentin
2016-03-09 21:35 ` [PATCH 10/13] thermal: convert rockchip_thermal " Eduardo Valentin
2016-03-09 22:23 ` Heiko Stübner
2016-03-10 2:36 ` Caesar Wang
2016-03-09 21:35 ` [PATCH 11/13] thermal: convert exynos " Eduardo Valentin
2016-03-10 0:16 ` Krzysztof Kozlowski
2016-03-14 19:48 ` Eduardo Valentin
2016-03-10 9:16 ` Lukasz Majewski
2016-03-09 21:35 ` [PATCH 12/13] thermal: convert tegra_thermal " Eduardo Valentin
2016-03-10 8:46 ` Wei Ni
2016-03-14 21:16 ` Eduardo Valentin
2016-03-15 5:42 ` Wei Ni
2016-03-09 21:35 ` [PATCH 13/13] hwmon: convert ti-thermal " Eduardo Valentin
2016-03-09 21:35 ` [PATCH 13/13] thermal: " Eduardo Valentin
2016-03-09 22:11 ` kbuild test robot
2016-03-15 12:26 ` Keerthy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).