2016-03-09 21:35:47

by Eduardo Valentin

[permalink] [raw]
Subject: [PATCH 00/13] thermal: convert users of thermal_zone_of_sensor_register to devm_

Hello,

Given that now we have a devm version of thermal_zone_of_sensor_register [1],
I am sending this series of patches to convert its users to use the devm_
API.

Driver's authors, please comment.

BR,

Eduardo Valentin (13):
hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register
hwmon: convert ntc_thermistor to use
devm_thermal_zone_of_sensor_register
hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register
hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register
input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register
thermal: convert hisi_thermal to use
devm_thermal_zone_of_sensor_register
thermal: convert mtk_thermal to use
devm_thermal_zone_of_sensor_register
thermal: convert qcom-spmi to use devm_thermal_zone_of_sensor_register
thermal: convert rcar_thermal to use
devm_thermal_zone_of_sensor_register
thermal: convert rockchip_thermal to use
devm_thermal_zone_of_sensor_register
thermal: convert exynos to use devm_thermal_zone_of_sensor_register
thermal: convert tegra_thermal to use
devm_thermal_zone_of_sensor_register
thermal: convert ti-thermal to use
devm_thermal_zone_of_sensor_register

drivers/hwmon/lm75.c | 10 ++----
drivers/hwmon/ntc_thermistor.c | 12 +++----
drivers/hwmon/scpi-hwmon.c | 41 +++++-----------------
drivers/hwmon/tmp102.c | 8 ++---
drivers/input/touchscreen/sun4i-ts.c | 9 +----
drivers/thermal/hisi_thermal.c | 5 ++-
drivers/thermal/mtk_thermal.c | 12 ++-----
drivers/thermal/qcom-spmi-temp-alarm.c | 3 +-
drivers/thermal/rcar_thermal.c | 2 +-
drivers/thermal/rockchip_thermal.c | 17 +++------
drivers/thermal/samsung/exynos_tmu.c | 12 +++----
drivers/thermal/tegra_soctherm.c | 31 +++++-----------
drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 5 +--
13 files changed, 42 insertions(+), 125 deletions(-)

--
2.1.4


2016-03-09 21:36:01

by Eduardo Valentin

[permalink] [raw]
Subject: [PATCH 04/13] hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register

This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.

Cc: Jean Delvare <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Valentin <[email protected]>
---
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

2016-03-09 21:36:12

by Eduardo Valentin

[permalink] [raw]
Subject: [PATCH 03/13] hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register

This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.

Cc: Jean Delvare <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Valentin <[email protected]>
---
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

2016-03-09 21:36:20

by Eduardo Valentin

[permalink] [raw]
Subject: [PATCH 02/13] hwmon: convert ntc_thermistor to use devm_thermal_zone_of_sensor_register

This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.

Cc: Jean Delvare <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Valentin <[email protected]>
---
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

2016-03-09 21:36:29

by Eduardo Valentin

[permalink] [raw]
Subject: [PATCH 01/13] hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register

This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.

Cc: Jean Delvare <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Valentin <[email protected]>
---
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

2016-03-09 21:36:41

by Eduardo Valentin

[permalink] [raw]
Subject: [PATCH 05/13] input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register

This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.

Cc: Dmitry Torokhov <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Chen-Yu Tsai <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: Zhang Rui <[email protected]>
Cc: Lukasz Majewski <[email protected]>
Cc: Heiko Stuebner <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Jens Thiele <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Valentin <[email protected]>
---
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

2016-03-09 21:37:17

by Eduardo Valentin

[permalink] [raw]
Subject: [PATCH 13/13] thermal: convert ti-thermal to use devm_thermal_zone_of_sensor_register

This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.

Cc: Zhang Rui <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Valentin <[email protected]>
---
drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

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

2016-03-09 21:37:27

by Eduardo Valentin

[permalink] [raw]
Subject: [PATCH 10/13] thermal: convert rockchip_thermal to use devm_thermal_zone_of_sensor_register

This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.

Cc: Zhang Rui <[email protected]>
Cc: Heiko Stuebner <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Valentin <[email protected]>
---
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

2016-03-09 21:37:34

by Eduardo Valentin

[permalink] [raw]
Subject: [PATCH 13/13] hwmon: convert ti-thermal to use devm_thermal_zone_of_sensor_register

This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.

Cc: Zhang Rui <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Valentin <[email protected]>
---
drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

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

2016-03-09 21:37:39

by Eduardo Valentin

[permalink] [raw]
Subject: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register

This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.

Cc: Zhang Rui <[email protected]>
Cc: Stephen Warren <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Alexandre Courbot <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Valentin <[email protected]>
---
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

2016-03-09 21:37:45

by Eduardo Valentin

[permalink] [raw]
Subject: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register

This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.

Cc: Lukasz Majewski <[email protected]>
Cc: Zhang Rui <[email protected]>
Cc: Kukjin Kim <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Valentin <[email protected]>
---
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

2016-03-09 21:37:52

by Eduardo Valentin

[permalink] [raw]
Subject: [PATCH 09/13] thermal: convert rcar_thermal to use devm_thermal_zone_of_sensor_register

This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.

Cc: Zhang Rui <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Valentin <[email protected]>
---
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

2016-03-09 21:38:58

by Eduardo Valentin

[permalink] [raw]
Subject: [PATCH 08/13] thermal: convert qcom-spmi to use devm_thermal_zone_of_sensor_register

This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.

Cc: Zhang Rui <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Valentin <[email protected]>
---
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

2016-03-09 21:39:11

by Eduardo Valentin

[permalink] [raw]
Subject: [PATCH 07/13] thermal: convert mtk_thermal to use devm_thermal_zone_of_sensor_register

This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.

Cc: Zhang Rui <[email protected]>
Cc: Matthias Brugger <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Valentin <[email protected]>
---
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

2016-03-09 21:39:17

by Eduardo Valentin

[permalink] [raw]
Subject: [PATCH 06/13] thermal: convert hisi_thermal to use devm_thermal_zone_of_sensor_register

This changes the driver to use the devm_ version
of thermal_zone_of_sensor_register and cleans
up the local points and unregister calls.

Cc: Zhang Rui <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Eduardo Valentin <[email protected]>
---
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

2016-03-09 21:45:22

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH 05/13] input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register

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 <[email protected]>
> Cc: Maxime Ripard <[email protected]>
> Cc: Chen-Yu Tsai <[email protected]>
> Cc: Hans de Goede <[email protected]>
> Cc: Zhang Rui <[email protected]>
> Cc: Lukasz Majewski <[email protected]>
> Cc: Heiko Stuebner <[email protected]>
> Cc: Sascha Hauer <[email protected]>
> Cc: Jens Thiele <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Eduardo Valentin <[email protected]>

Acked-by: Dmitry Torokhov <[email protected]>

I guess it will make sense to merge through your tree unless you want to
hold off until after I merge winth mainline (around -rc3) assuming that
it even makes into 4.6.

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

2016-03-09 22:13:04

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 13/13] thermal: convert ti-thermal to use devm_thermal_zone_of_sensor_register

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


Attachments:
(No filename) (2.01 kB)
.config.gz (44.06 kB)
Download all attachments

2016-03-09 22:23:43

by Heiko Stübner

[permalink] [raw]
Subject: Re: [PATCH 10/13] thermal: convert rockchip_thermal to use devm_thermal_zone_of_sensor_register

Am Mittwoch, 9. M?rz 2016, 13:35:32 schrieb Eduardo Valentin:
> 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 <[email protected]>
> Cc: Heiko Stuebner <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Eduardo Valentin <[email protected]>

to me this looks ok
Reviewed-by: Heiko Stuebner <[email protected]>

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

2016-03-09 23:24:34

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 07/13] thermal: convert mtk_thermal to use devm_thermal_zone_of_sensor_register

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


Attachments:
(No filename) (1.68 kB)
.config.gz (42.70 kB)
Download all attachments

2016-03-10 00:03:21

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 01/13] hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register

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


Attachments:
(No filename) (1.68 kB)
.config.gz (43.03 kB)
Download all attachments

2016-03-10 00:15:17

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 02/13] hwmon: convert ntc_thermistor to use devm_thermal_zone_of_sensor_register

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


Attachments:
(No filename) (2.43 kB)
.config.gz (43.03 kB)
Download all attachments

2016-03-10 00:16:47

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register

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 <[email protected]>
> Cc: Zhang Rui <[email protected]>
> Cc: Kukjin Kim <[email protected]>
> Cc: Krzysztof Kozlowski <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Eduardo Valentin <[email protected]>
> ---
> 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);
>

2016-03-10 02:18:25

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 02/13] hwmon: convert ntc_thermistor to use devm_thermal_zone_of_sensor_register

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


Attachments:
(No filename) (1.92 kB)
.config.gz (43.03 kB)
Download all attachments

2016-03-10 02:29:36

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 04/13] hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register

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 <[email protected]>
> Cc: Guenter Roeck <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Eduardo Valentin <[email protected]>
> ---
> 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);
>
>

2016-03-10 02:36:51

by Caesar Wang

[permalink] [raw]
Subject: Re: [PATCH 10/13] thermal: convert rockchip_thermal to use devm_thermal_zone_of_sensor_register



在 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 <[email protected]>
> Cc: Heiko Stuebner <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Eduardo Valentin <[email protected]>

Tested-by: Caesar Wang <[email protected]>
Reviewed-by: Caesar Wang <[email protected]>

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

2016-03-10 03:19:06

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 01/13] hwmon: convert lm75 to use devm_thermal_zone_of_sensor_register

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 <[email protected]>
> Cc: Guenter Roeck <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Eduardo Valentin <[email protected]>

Acked-by: Guenter Roeck <[email protected]>

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

2016-03-10 03:19:55

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 02/13] hwmon: convert ntc_thermistor to use devm_thermal_zone_of_sensor_register

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 <[email protected]>
> Cc: Guenter Roeck <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Eduardo Valentin <[email protected]>

Acked-by: Guenter Roeck <[email protected]>

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

2016-03-10 03:20:33

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 03/13] hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register

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 <[email protected]>
> Cc: Guenter Roeck <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Eduardo Valentin <[email protected]>

Acked-by: Guenter Roeck <[email protected]>

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

2016-03-10 04:44:40

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 03/13] hwmon: convert tmp102 to use devm_thermal_zone_of_sensor_register

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


Attachments:
(No filename) (1.71 kB)
.config.gz (43.03 kB)
Download all attachments

2016-03-10 08:47:06

by Wei Ni

[permalink] [raw]
Subject: Re: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register



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 <[email protected]>
> Cc: Stephen Warren <[email protected]>
> Cc: Thierry Reding <[email protected]>
> Cc: Alexandre Courbot <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Eduardo Valentin <[email protected]>
> ---
> 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);
>

2016-03-10 09:16:40

by Lukasz Majewski

[permalink] [raw]
Subject: Re: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register

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 <[email protected]>
> Cc: Zhang Rui <[email protected]>
> Cc: Kukjin Kim <[email protected]>
> Cc: Krzysztof Kozlowski <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Eduardo Valentin <[email protected]>
> ---
> 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 <[email protected]>

--
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

2016-03-10 09:35:09

by Sascha Hauer

[permalink] [raw]
Subject: Re: [PATCH 05/13] input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register

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 <[email protected]>
> Cc: Maxime Ripard <[email protected]>
> Cc: Chen-Yu Tsai <[email protected]>
> Cc: Hans de Goede <[email protected]>
> Cc: Zhang Rui <[email protected]>
> Cc: Lukasz Majewski <[email protected]>
> Cc: Heiko Stuebner <[email protected]>
> Cc: Sascha Hauer <[email protected]>
> Cc: Jens Thiele <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Eduardo Valentin <[email protected]>
> ---
> 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 |

2016-03-10 13:20:10

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH 05/13] input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register

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 <[email protected]>
>> Cc: Maxime Ripard <[email protected]>
>> Cc: Chen-Yu Tsai <[email protected]>
>> Cc: Hans de Goede <[email protected]>
>> Cc: Zhang Rui <[email protected]>
>> Cc: Lukasz Majewski <[email protected]>
>> Cc: Heiko Stuebner <[email protected]>
>> Cc: Sascha Hauer <[email protected]>
>> Cc: Jens Thiele <[email protected]>
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Signed-off-by: Eduardo Valentin <[email protected]>
>> ---
>> 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 <[email protected]>

Regards,

Hans

2016-03-14 19:48:23

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH 11/13] thermal: convert exynos to use devm_thermal_zone_of_sensor_register

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 <[email protected]>
> > Cc: Zhang Rui <[email protected]>
> > Cc: Kukjin Kim <[email protected]>
> > Cc: Krzysztof Kozlowski <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
> > Cc: [email protected]
> > Cc: [email protected]
> > Signed-off-by: Eduardo Valentin <[email protected]>
> > ---
> > 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);
> >
>

2016-03-14 19:50:04

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH 04/13] hwmon: convert scpi-hwmon to use devm_thermal_zone_of_sensor_register

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 <[email protected]>
> >Cc: Guenter Roeck <[email protected]>
> >Cc: [email protected]
> >Cc: [email protected]
> >Signed-off-by: Eduardo Valentin <[email protected]>
> >---
> > 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


Attachments:
(No filename) (2.37 kB)
signature.asc (473.00 B)
Digital signature
Download all attachments

2016-03-14 21:07:29

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH 05/13] input: convert sun4i-ts to use devm_thermal_zone_of_sensor_register

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 <[email protected]>
> > Cc: Maxime Ripard <[email protected]>
> > Cc: Chen-Yu Tsai <[email protected]>
> > Cc: Hans de Goede <[email protected]>
> > Cc: Zhang Rui <[email protected]>
> > Cc: Lukasz Majewski <[email protected]>
> > Cc: Heiko Stuebner <[email protected]>
> > Cc: Sascha Hauer <[email protected]>
> > Cc: Jens Thiele <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
> > Cc: [email protected]
> > Signed-off-by: Eduardo Valentin <[email protected]>
>
> Acked-by: Dmitry Torokhov <[email protected]>
>
> I guess it will make sense to merge through your tree unless you want to
> hold off until after I merge winth mainline (around -rc3) assuming that
> it even makes into 4.6.

No rush from my side. I would rather get the right review cycles.

The devm_ APIs were sent to 4.6-rc1 (well, right now in Rui's tree, but
I assume he is sending them).

Thanks for your review.


Attachments:
(No filename) (1.27 kB)
signature.asc (473.00 B)
Digital signature
Download all attachments

2016-03-14 21:16:15

by Eduardo Valentin

[permalink] [raw]
Subject: Re: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register

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 <[email protected]>
> > Cc: Stephen Warren <[email protected]>
> > Cc: Thierry Reding <[email protected]>
> > Cc: Alexandre Courbot <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
> > Cc: [email protected]
> > Signed-off-by: Eduardo Valentin <[email protected]>
> > ---
> > 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?





Attachments:
(No filename) (3.01 kB)
signature.asc (473.00 B)
Digital signature
Download all attachments

2016-03-15 05:42:16

by Wei Ni

[permalink] [raw]
Subject: Re: [PATCH 12/13] thermal: convert tegra_thermal to use devm_thermal_zone_of_sensor_register



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 <[email protected]>
>>> Cc: Stephen Warren <[email protected]>
>>> Cc: Thierry Reding <[email protected]>
>>> Cc: Alexandre Courbot <[email protected]>
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Signed-off-by: Eduardo Valentin <[email protected]>
>>> ---
>>> 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
>

2016-03-15 12:28:27

by Keerthy

[permalink] [raw]
Subject: Re: [PATCH 13/13] thermal: convert ti-thermal to use devm_thermal_zone_of_sensor_register

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 <[email protected]>


> Cc: Zhang Rui <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Eduardo Valentin <[email protected]>
> ---
> drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> 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;
>