@@ -595,6 +595,8 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,
high = td->threshold;
}
+ thermal_thresholds_handle(tz, &low, &high);
+
thermal_zone_set_trips(tz, low, high);
list_sort(NULL, &way_up_list, thermal_trip_notify_cmp);
@@ -1514,6 +1516,10 @@ thermal_zone_device_register_with_trips(const char *type,
goto unregister;
}
+ result = thermal_thresholds_init(tz);
+ if (result)
+ goto remove_hwmon;
+
mutex_lock(&thermal_list_lock);
mutex_lock(&tz->lock);
@@ -1537,6 +1543,8 @@ thermal_zone_device_register_with_trips(const char *type,
return tz;
+remove_hwmon:
+ thermal_remove_hwmon_sysfs(tz);
unregister:
device_del(&tz->device);
release_device:
@@ -1624,6 +1632,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
thermal_set_governor(tz, NULL);
+ thermal_thresholds_exit(tz);
thermal_remove_hwmon_sysfs(tz);
ida_free(&thermal_tz_ida, tz->id);
ida_destroy(&tz->ida);
Initialize, de-initialize and handle the threshold in the same place than the trip points. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> --- drivers/thermal/thermal_core.c | 9 +++++++++ 1 file changed, 9 insertions(+)