summaryrefslogtreecommitdiff
path: root/drivers/thermal/thermal_hwmon.c
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2023-03-01 23:14:36 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-03-03 22:45:02 +0300
commit4a16c190f761cb3a87dcbbf355f91c71ce1f8c0b (patch)
treee43ca75ccef305b6c8bc2bbdd3eb65fe0b9890dc /drivers/thermal/thermal_hwmon.c
parent8f3f4ad4ad45e2e30c814de42629ef4c9688e92c (diff)
downloadlinux-4a16c190f761cb3a87dcbbf355f91c71ce1f8c0b.tar.xz
thermal/hwmon: Use the right device for devm_thermal_add_hwmon_sysfs()
The devres variant of thermal_add_hwmon_sysfs() only takes the thermal zone structure pointer as parameter. Actually, it uses the tz->device to add it in the devres list. It is preferable to use the device registering the thermal zone instead of the thermal zone device itself. That prevents the driver accessing the thermal zone structure internals and it is from my POV more correct regarding how devm_ is used. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> #amlogic_thermal Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> #sun8i_thermal Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> #MediaTek auxadc Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/thermal/thermal_hwmon.c')
-rw-r--r--drivers/thermal/thermal_hwmon.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index c594c42bea6d..964db7941e31 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -263,7 +263,7 @@ static void devm_thermal_hwmon_release(struct device *dev, void *res)
thermal_remove_hwmon_sysfs(*(struct thermal_zone_device **)res);
}
-int devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
+int devm_thermal_add_hwmon_sysfs(struct device *dev, struct thermal_zone_device *tz)
{
struct thermal_zone_device **ptr;
int ret;
@@ -280,7 +280,7 @@ int devm_thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
}
*ptr = tz;
- devres_add(&tz->device, ptr);
+ devres_add(dev, ptr);
return ret;
}