From: Guenter Roeck <linux@roeck-us.net>
To: Daniel Lezcano <daniel.lezcano@linexp.org>
Cc: daniel.lezcano@linaro.org, rafael@kernel.org,
rui.zhang@intel.com, khilman@baylibre.com, abailon@baylibre.com,
amitk@kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, Jean Delvare <jdelvare@suse.com>,
"open list:HARDWARE MONITORING" <linux-hwmon@vger.kernel.org>
Subject: Re: [PATCH v1 26/33] hwmon/drivers: Switch to new of thermal API
Date: Wed, 13 Jul 2022 06:43:01 -0700 [thread overview]
Message-ID: <20220713134301.GA3798984@roeck-us.net> (raw)
In-Reply-To: <20220710212423.681301-27-daniel.lezcano@linexp.org>
On Sun, Jul 10, 2022 at 11:24:16PM +0200, Daniel Lezcano wrote:
> The thermal OF code has a new API allowing to migrate the OF
> initialization to a simpler approach.
>
> Use this new API.
>
> 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..a98c35fbce87 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 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..9c89db8e56a7 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 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
prev parent reply other threads:[~2022-07-13 13:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220710212423.681301-1-daniel.lezcano@linexp.org>
2022-07-10 21:24 ` [PATCH v1 26/33] hwmon/drivers: Switch to new of thermal API Daniel Lezcano
2022-07-13 13:43 ` Guenter Roeck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220713134301.GA3798984@roeck-us.net \
--to=linux@roeck-us.net \
--cc=abailon@baylibre.com \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=daniel.lezcano@linexp.org \
--cc=jdelvare@suse.com \
--cc=khilman@baylibre.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox