linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, khilman@baylibre.com,
	abailon@baylibre.com, lukasz.luba@arm.com, broonie@kernel.org,
	damien.lemoal@opensource.wdc.com, heiko@sntech.de,
	hayashi.kunihiko@socionext.com, mhiramat@kernel.org,
	talel@amazon.com, thierry.reding@gmail.com, digetx@gmail.com,
	jonathanh@nvidia.com, anarsoul@gmail.com, tiny.windzz@gmail.com,
	baolin.wang7@gmail.com, f.fainelli@gmail.com,
	bjorn.andersson@linaro.org, mcoquelin.stm32@gmail.com,
	glaroque@baylibre.com, miquel.raynal@bootlin.com,
	shawnguo@kernel.org, niklas.soderlund@ragnatech.se,
	matthias.bgg@gmail.com, j-keerthy@ti.com,
	Jean Delvare <jdelvare@suse.com>,
	"open list:PMBUS HARDWARE MONITORING DRIVERS" 
	<linux-hwmon@vger.kernel.org>
Subject: Re: [PATCH v5 26/33] hwmon/drivers/pm_bus: Switch to new of thermal API
Date: Mon, 8 Aug 2022 03:29:49 -0700	[thread overview]
Message-ID: <20220808102949.GC1969424@roeck-us.net> (raw)
In-Reply-To: <20220804224349.1926752-27-daniel.lezcano@linexp.org>

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
> 

  reply	other threads:[~2022-08-08 10:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
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

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=20220808102949.GC1969424@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=abailon@baylibre.com \
    --cc=anarsoul@gmail.com \
    --cc=baolin.wang7@gmail.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=daniel.lezcano@linexp.org \
    --cc=digetx@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=glaroque@baylibre.com \
    --cc=hayashi.kunihiko@socionext.com \
    --cc=heiko@sntech.de \
    --cc=j-keerthy@ti.com \
    --cc=jdelvare@suse.com \
    --cc=jonathanh@nvidia.com \
    --cc=khilman@baylibre.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mhiramat@kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=shawnguo@kernel.org \
    --cc=talel@amazon.com \
    --cc=thierry.reding@gmail.com \
    --cc=tiny.windzz@gmail.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;
as well as URLs for NNTP newsgroup(s).