* [PATCH v5 26/33] hwmon/drivers/pm_bus: Switch to new of thermal API
[not found] <20220804224349.1926752-1-daniel.lezcano@linexp.org>
@ 2022-08-04 22:43 ` Daniel Lezcano
2022-08-08 10:29 ` Guenter Roeck
2022-08-04 22:43 ` [PATCH v5 27/33] hwmon/drivers/core: " Daniel Lezcano
1 sibling, 1 reply; 6+ messages in thread
From: Daniel Lezcano @ 2022-08-04 22:43 UTC (permalink / raw)
To: daniel.lezcano, rafael
Cc: rui.zhang, linux-pm, linux-kernel, khilman, abailon, lukasz.luba,
broonie, damien.lemoal, heiko, hayashi.kunihiko, mhiramat, talel,
thierry.reding, digetx, jonathanh, anarsoul, tiny.windzz,
baolin.wang7, f.fainelli, bjorn.andersson, mcoquelin.stm32,
glaroque, miquel.raynal, shawnguo, niklas.soderlund,
matthias.bgg, j-keerthy, Guenter Roeck, Jean Delvare,
open list:PMBUS HARDWARE MONITORING DRIVERS
The thermal OF code has a new API allowing to migrate the OF
initialization to a simpler approach. The ops are no longer device
tree specific and are the generic ones provided by the core code.
Convert the ops to the thermal_zone_device_ops format and use the new
API to register the thermal zone with these generic ops.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
---
drivers/hwmon/pmbus/pmbus_core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 02912022853d..3b9bb2123a1a 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -1109,9 +1109,9 @@ struct pmbus_thermal_data {
struct pmbus_sensor *sensor;
};
-static int pmbus_thermal_get_temp(void *data, int *temp)
+static int pmbus_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
{
- struct pmbus_thermal_data *tdata = data;
+ struct pmbus_thermal_data *tdata = tz->devdata;
struct pmbus_sensor *sensor = tdata->sensor;
struct pmbus_data *pmbus_data = tdata->pmbus_data;
struct i2c_client *client = to_i2c_client(pmbus_data->dev);
@@ -1135,7 +1135,7 @@ static int pmbus_thermal_get_temp(void *data, int *temp)
return ret;
}
-static const struct thermal_zone_of_device_ops pmbus_thermal_ops = {
+static const struct thermal_zone_device_ops pmbus_thermal_ops = {
.get_temp = pmbus_thermal_get_temp,
};
@@ -1153,8 +1153,8 @@ static int pmbus_thermal_add_sensor(struct pmbus_data *pmbus_data,
tdata->sensor = sensor;
tdata->pmbus_data = pmbus_data;
- tzd = devm_thermal_zone_of_sensor_register(dev, index, tdata,
- &pmbus_thermal_ops);
+ tzd = devm_thermal_of_zone_register(dev, index, tdata,
+ &pmbus_thermal_ops);
/*
* If CONFIG_THERMAL_OF is disabled, this returns -ENODEV,
* so ignore that error but forward any other error.
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v5 27/33] hwmon/drivers/core: Switch to new of thermal API
[not found] <20220804224349.1926752-1-daniel.lezcano@linexp.org>
2022-08-04 22:43 ` [PATCH v5 26/33] hwmon/drivers/pm_bus: Switch to new of thermal API Daniel Lezcano
@ 2022-08-04 22:43 ` Daniel Lezcano
2022-08-08 10:27 ` Guenter Roeck
1 sibling, 1 reply; 6+ messages in thread
From: Daniel Lezcano @ 2022-08-04 22:43 UTC (permalink / raw)
To: daniel.lezcano, rafael
Cc: rui.zhang, linux-pm, linux-kernel, khilman, abailon, lukasz.luba,
broonie, damien.lemoal, heiko, hayashi.kunihiko, mhiramat, talel,
thierry.reding, digetx, jonathanh, anarsoul, tiny.windzz,
baolin.wang7, f.fainelli, bjorn.andersson, mcoquelin.stm32,
glaroque, miquel.raynal, shawnguo, niklas.soderlund,
matthias.bgg, j-keerthy, Guenter Roeck, Jean Delvare,
open list:HARDWARE MONITORING
The thermal OF code has a new API allowing to migrate the OF
initialization to a simpler approach. The ops are no longer device
tree specific and are the generic ones provided by the core code.
Convert the ops to the thermal_zone_device_ops format and use the new
API to register the thermal zone with these generic ops.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/hwmon/hwmon.c | 14 +++++++-------
drivers/hwmon/scpi-hwmon.c | 14 +++++++-------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 2e2cd79d89eb..4218750d5a66 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -151,9 +151,9 @@ static DEFINE_IDA(hwmon_ida);
* between hwmon and thermal_sys modules.
*/
#ifdef CONFIG_THERMAL_OF
-static int hwmon_thermal_get_temp(void *data, int *temp)
+static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
{
- struct hwmon_thermal_data *tdata = data;
+ struct hwmon_thermal_data *tdata = tz->devdata;
struct hwmon_device *hwdev = to_hwmon_device(tdata->dev);
int ret;
long t;
@@ -168,9 +168,9 @@ static int hwmon_thermal_get_temp(void *data, int *temp)
return 0;
}
-static int hwmon_thermal_set_trips(void *data, int low, int high)
+static int hwmon_thermal_set_trips(struct thermal_zone_device *tz, int low, int high)
{
- struct hwmon_thermal_data *tdata = data;
+ struct hwmon_thermal_data *tdata = tz->devdata;
struct hwmon_device *hwdev = to_hwmon_device(tdata->dev);
const struct hwmon_chip_info *chip = hwdev->chip;
const struct hwmon_channel_info **info = chip->info;
@@ -203,7 +203,7 @@ static int hwmon_thermal_set_trips(void *data, int low, int high)
return 0;
}
-static const struct thermal_zone_of_device_ops hwmon_thermal_ops = {
+static const struct thermal_zone_device_ops hwmon_thermal_ops = {
.get_temp = hwmon_thermal_get_temp,
.set_trips = hwmon_thermal_set_trips,
};
@@ -227,8 +227,8 @@ static int hwmon_thermal_add_sensor(struct device *dev, int index)
tdata->dev = dev;
tdata->index = index;
- tzd = devm_thermal_zone_of_sensor_register(dev, index, tdata,
- &hwmon_thermal_ops);
+ tzd = devm_thermal_of_zone_register(dev, index, tdata,
+ &hwmon_thermal_ops);
if (IS_ERR(tzd)) {
if (PTR_ERR(tzd) != -ENODEV)
return PTR_ERR(tzd);
diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c
index 5187c6dd5a4f..4d75385f7d5e 100644
--- a/drivers/hwmon/scpi-hwmon.c
+++ b/drivers/hwmon/scpi-hwmon.c
@@ -62,9 +62,9 @@ static void scpi_scale_reading(u64 *value, struct sensor_data *sensor)
}
}
-static int scpi_read_temp(void *dev, int *temp)
+static int scpi_read_temp(struct thermal_zone_device *tz, int *temp)
{
- struct scpi_thermal_zone *zone = dev;
+ struct scpi_thermal_zone *zone = tz->devdata;
struct scpi_sensors *scpi_sensors = zone->scpi_sensors;
struct scpi_ops *scpi_ops = scpi_sensors->scpi_ops;
struct sensor_data *sensor = &scpi_sensors->data[zone->sensor_id];
@@ -121,7 +121,7 @@ scpi_show_label(struct device *dev, struct device_attribute *attr, char *buf)
return sprintf(buf, "%s\n", sensor->info.name);
}
-static const struct thermal_zone_of_device_ops scpi_sensor_ops = {
+static const struct thermal_zone_device_ops scpi_sensor_ops = {
.get_temp = scpi_read_temp,
};
@@ -275,10 +275,10 @@ static int scpi_hwmon_probe(struct platform_device *pdev)
zone->sensor_id = i;
zone->scpi_sensors = scpi_sensors;
- z = devm_thermal_zone_of_sensor_register(dev,
- sensor->info.sensor_id,
- zone,
- &scpi_sensor_ops);
+ z = devm_thermal_of_zone_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
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v5 27/33] hwmon/drivers/core: Switch to new of thermal API
2022-08-04 22:43 ` [PATCH v5 27/33] hwmon/drivers/core: " Daniel Lezcano
@ 2022-08-08 10:27 ` Guenter Roeck
0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2022-08-08 10:27 UTC (permalink / raw)
To: Daniel Lezcano
Cc: daniel.lezcano, rafael, rui.zhang, linux-pm, linux-kernel,
khilman, abailon, lukasz.luba, broonie, damien.lemoal, heiko,
hayashi.kunihiko, mhiramat, talel, thierry.reding, digetx,
jonathanh, anarsoul, tiny.windzz, baolin.wang7, f.fainelli,
bjorn.andersson, mcoquelin.stm32, glaroque, miquel.raynal,
shawnguo, niklas.soderlund, matthias.bgg, j-keerthy,
Jean Delvare, open list:HARDWARE MONITORING
On Fri, Aug 05, 2022 at 12:43:43AM +0200, Daniel Lezcano wrote:
> The thermal OF code has a new API allowing to migrate the OF
> initialization to a simpler approach. The ops are no longer device
> tree specific and are the generic ones provided by the core code.
>
> Convert the ops to the thermal_zone_device_ops format and use the new
> API to register the thermal zone with these generic ops.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
> Acked-by: Guenter Roeck <linux@roeck-us.net>
Based on other feedback, it apears that with this patch in place the
hwmon device fails to register unless it is indeed part of a configured
thermal zone (which so far was optional). Given that, I have to withdraw
my Acked-by: tag until this problem has been resolved.
Guenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5 26/33] hwmon/drivers/pm_bus: Switch to new of thermal API
2022-08-04 22:43 ` [PATCH v5 26/33] hwmon/drivers/pm_bus: Switch to new of thermal API Daniel Lezcano
@ 2022-08-08 10:29 ` Guenter Roeck
2022-08-10 10:23 ` Daniel Lezcano
0 siblings, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2022-08-08 10:29 UTC (permalink / raw)
To: Daniel Lezcano
Cc: daniel.lezcano, rafael, rui.zhang, linux-pm, linux-kernel,
khilman, abailon, lukasz.luba, broonie, damien.lemoal, heiko,
hayashi.kunihiko, mhiramat, talel, thierry.reding, digetx,
jonathanh, anarsoul, tiny.windzz, baolin.wang7, f.fainelli,
bjorn.andersson, mcoquelin.stm32, glaroque, miquel.raynal,
shawnguo, niklas.soderlund, matthias.bgg, j-keerthy,
Jean Delvare, open list:PMBUS HARDWARE MONITORING DRIVERS
On Fri, Aug 05, 2022 at 12:43:42AM +0200, Daniel Lezcano wrote:
> The thermal OF code has a new API allowing to migrate the OF
> initialization to a simpler approach. The ops are no longer device
> tree specific and are the generic ones provided by the core code.
>
> Convert the ops to the thermal_zone_device_ops format and use the new
> API to register the thermal zone with these generic ops.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
Subject tag should be something like "hwmon: (pmbus) ...".
Also, from other patches it appears that this would or might result
in a registration failure if a thermal zone for the sensor does not
exist. This will need to be resolved before the patch is can be applied.
Guenter
> ---
> drivers/hwmon/pmbus/pmbus_core.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index 02912022853d..3b9bb2123a1a 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -1109,9 +1109,9 @@ struct pmbus_thermal_data {
> struct pmbus_sensor *sensor;
> };
>
> -static int pmbus_thermal_get_temp(void *data, int *temp)
> +static int pmbus_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
> {
> - struct pmbus_thermal_data *tdata = data;
> + struct pmbus_thermal_data *tdata = tz->devdata;
> struct pmbus_sensor *sensor = tdata->sensor;
> struct pmbus_data *pmbus_data = tdata->pmbus_data;
> struct i2c_client *client = to_i2c_client(pmbus_data->dev);
> @@ -1135,7 +1135,7 @@ static int pmbus_thermal_get_temp(void *data, int *temp)
> return ret;
> }
>
> -static const struct thermal_zone_of_device_ops pmbus_thermal_ops = {
> +static const struct thermal_zone_device_ops pmbus_thermal_ops = {
> .get_temp = pmbus_thermal_get_temp,
> };
>
> @@ -1153,8 +1153,8 @@ static int pmbus_thermal_add_sensor(struct pmbus_data *pmbus_data,
> tdata->sensor = sensor;
> tdata->pmbus_data = pmbus_data;
>
> - tzd = devm_thermal_zone_of_sensor_register(dev, index, tdata,
> - &pmbus_thermal_ops);
> + tzd = devm_thermal_of_zone_register(dev, index, tdata,
> + &pmbus_thermal_ops);
> /*
> * If CONFIG_THERMAL_OF is disabled, this returns -ENODEV,
> * so ignore that error but forward any other error.
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5 26/33] hwmon/drivers/pm_bus: Switch to new of thermal API
2022-08-08 10:29 ` Guenter Roeck
@ 2022-08-10 10:23 ` Daniel Lezcano
2022-08-10 12:41 ` Guenter Roeck
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Lezcano @ 2022-08-10 10:23 UTC (permalink / raw)
To: Guenter Roeck, Daniel Lezcano
Cc: rafael, rui.zhang, linux-pm, linux-kernel, khilman, abailon,
lukasz.luba, broonie, damien.lemoal, heiko, hayashi.kunihiko,
mhiramat, talel, thierry.reding, digetx, jonathanh, anarsoul,
tiny.windzz, baolin.wang7, f.fainelli, bjorn.andersson,
mcoquelin.stm32, glaroque, miquel.raynal, shawnguo,
niklas.soderlund, matthias.bgg, j-keerthy, Jean Delvare,
open list:PMBUS HARDWARE MONITORING DRIVERS
On 08/08/2022 12:29, Guenter Roeck wrote:
> On Fri, Aug 05, 2022 at 12:43:42AM +0200, Daniel Lezcano wrote:
>> The thermal OF code has a new API allowing to migrate the OF
>> initialization to a simpler approach. The ops are no longer device
>> tree specific and are the generic ones provided by the core code.
>>
>> Convert the ops to the thermal_zone_device_ops format and use the new
>> API to register the thermal zone with these generic ops.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
>
> Subject tag should be something like "hwmon: (pmbus) ...".
>
> Also, from other patches it appears that this would or might result
> in a registration failure if a thermal zone for the sensor does not
> exist. This will need to be resolved before the patch is can be applied.
With the subject fixed, shall I add your Acked-by ?
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5 26/33] hwmon/drivers/pm_bus: Switch to new of thermal API
2022-08-10 10:23 ` Daniel Lezcano
@ 2022-08-10 12:41 ` Guenter Roeck
0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2022-08-10 12:41 UTC (permalink / raw)
To: Daniel Lezcano, Daniel Lezcano
Cc: rafael, rui.zhang, linux-pm, linux-kernel, khilman, abailon,
lukasz.luba, broonie, damien.lemoal, heiko, hayashi.kunihiko,
mhiramat, talel, thierry.reding, digetx, jonathanh, anarsoul,
tiny.windzz, baolin.wang7, f.fainelli, bjorn.andersson,
mcoquelin.stm32, glaroque, miquel.raynal, shawnguo,
niklas.soderlund, matthias.bgg, j-keerthy, Jean Delvare,
open list:PMBUS HARDWARE MONITORING DRIVERS
On 8/10/22 03:23, Daniel Lezcano wrote:
> On 08/08/2022 12:29, Guenter Roeck wrote:
>> On Fri, Aug 05, 2022 at 12:43:42AM +0200, Daniel Lezcano wrote:
>>> The thermal OF code has a new API allowing to migrate the OF
>>> initialization to a simpler approach. The ops are no longer device
>>> tree specific and are the generic ones provided by the core code.
>>>
>>> Convert the ops to the thermal_zone_device_ops format and use the new
>>> API to register the thermal zone with these generic ops.
>>>
>>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org>
>>
>> Subject tag should be something like "hwmon: (pmbus) ...".
>>
>> Also, from other patches it appears that this would or might result
>> in a registration failure if a thermal zone for the sensor does not
>> exist. This will need to be resolved before the patch is can be applied.
>
> With the subject fixed, shall I add your Acked-by ?
>
Yes. With subject fixed:
Acked-by: Guenter Roeck <linux@roeck-us.net>
Thanks,
Guenter
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-08-10 12:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20220804224349.1926752-1-daniel.lezcano@linexp.org>
2022-08-04 22:43 ` [PATCH v5 26/33] hwmon/drivers/pm_bus: Switch to new of thermal API Daniel Lezcano
2022-08-08 10:29 ` Guenter Roeck
2022-08-10 10:23 ` Daniel Lezcano
2022-08-10 12:41 ` Guenter Roeck
2022-08-04 22:43 ` [PATCH v5 27/33] hwmon/drivers/core: " Daniel Lezcano
2022-08-08 10:27 ` Guenter Roeck
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).