]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
thermal_hwmon: Pass the originating device down to hwmon_device_register_with_info
authorMarc Zyngier <marc.zyngier@arm.com>
Tue, 10 Jul 2018 15:40:35 +0000 (16:40 +0100)
committerEduardo Valentin <edubezval@gmail.com>
Fri, 27 Jul 2018 21:43:21 +0000 (14:43 -0700)
When registering the hwmon device, we pass NULL as the device.
While this doesn't result in any immediate breakage, it leaves
the hwmon device at the root of the virtual devices, rather than
attached to the thermal zone hierarchy.

Instead, let's pass the actual device, which is part of the
thermal_zone_device structure. This also avoids the rather
unpleasant ""NULL device *" which can be generated by dev_{err,info}
in the hwmon subsystem.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
drivers/thermal/thermal_hwmon.c

index 0bd47007c57fc6ed215f182b3872a3d7362b5057..40c69a533b240787c2dfa7a9328aecb05ed24bbf 100644 (file)
@@ -143,7 +143,7 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
        INIT_LIST_HEAD(&hwmon->tz_list);
        strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH);
        strreplace(hwmon->type, '-', '_');
-       hwmon->device = hwmon_device_register_with_info(NULL, hwmon->type,
+       hwmon->device = hwmon_device_register_with_info(&tz->device, hwmon->type,
                                                        hwmon, NULL, NULL);
        if (IS_ERR(hwmon->device)) {
                result = PTR_ERR(hwmon->device);