[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231221124825.149141-16-angelogioacchino.delregno@collabora.com>
Date: Thu, 21 Dec 2023 13:48:14 +0100
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
To: daniel.lezcano@...aro.org
Cc: rafael@...nel.org,
rui.zhang@...el.com,
lukasz.luba@....com,
linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
kernel@...labora.com
Subject: [RFC PATCH 15/26] power: supply: core: Migrate to thermal_zone_device_register()
The thermal API has a new thermal_zone_device_register() function which
is deprecating the older thermal_zone_device_register_with_trips() and
thermal_tripless_zone_device_register().
Migrate to the new thermal zone device registration function.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
---
drivers/power/supply/power_supply_core.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 73265001dd4b..d656a2e39157 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -1297,6 +1297,12 @@ static struct thermal_zone_device_ops psy_tzd_ops = {
static int psy_register_thermal(struct power_supply *psy)
{
+ struct thermal_zone_device_params tzdp = {
+ /* Prefer our hwmon device and avoid duplicates */
+ .tzp = { .no_hwmon = IS_ENABLED(CONFIG_POWER_SUPPLY_HWMON) },
+ .ops = &psy_tzd_ops,
+ .devdata = psy
+ };
int ret;
if (psy->desc->no_thermal)
@@ -1304,12 +1310,8 @@ static int psy_register_thermal(struct power_supply *psy)
/* Register battery zone device psy reports temperature */
if (psy_has_property(psy->desc, POWER_SUPPLY_PROP_TEMP)) {
- /* Prefer our hwmon device and avoid duplicates */
- struct thermal_zone_params tzp = {
- .no_hwmon = IS_ENABLED(CONFIG_POWER_SUPPLY_HWMON)
- };
- psy->tzd = thermal_tripless_zone_device_register(psy->desc->name,
- psy, &psy_tzd_ops, &tzp);
+ tzdp.name = psy->desc->name;
+ psy->tzd = thermal_zone_device_register(&tzdp);
if (IS_ERR(psy->tzd))
return PTR_ERR(psy->tzd);
ret = thermal_zone_device_enable(psy->tzd);
--
2.43.0
Powered by blists - more mailing lists