Skip to content

Commit 85ee944

Browse files
dlezcanorafaeljw
authored andcommitted
thermal: core: Connect the threshold with the core
Initialize, de-initialize and handle the threshold in the same place than the trip points. Signed-off-by: Daniel Lezcano <[email protected]> Link: https://patch.msgid.link/[email protected] [ rjw: Subject edit ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 445936f commit 85ee944

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/thermal/thermal_core.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,
585585
high = td->threshold;
586586
}
587587

588+
thermal_thresholds_handle(tz, &low, &high);
589+
588590
thermal_zone_set_trips(tz, low, high);
589591

590592
list_sort(NULL, &way_up_list, thermal_trip_notify_cmp);
@@ -1491,6 +1493,10 @@ thermal_zone_device_register_with_trips(const char *type,
14911493
goto unregister;
14921494
}
14931495

1496+
result = thermal_thresholds_init(tz);
1497+
if (result)
1498+
goto remove_hwmon;
1499+
14941500
mutex_lock(&thermal_list_lock);
14951501

14961502
mutex_lock(&tz->lock);
@@ -1514,6 +1520,8 @@ thermal_zone_device_register_with_trips(const char *type,
15141520

15151521
return tz;
15161522

1523+
remove_hwmon:
1524+
thermal_remove_hwmon_sysfs(tz);
15171525
unregister:
15181526
device_del(&tz->device);
15191527
release_device:
@@ -1601,6 +1609,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
16011609

16021610
thermal_set_governor(tz, NULL);
16031611

1612+
thermal_thresholds_exit(tz);
16041613
thermal_remove_hwmon_sysfs(tz);
16051614
ida_free(&thermal_tz_ida, tz->id);
16061615
ida_destroy(&tz->ida);

0 commit comments

Comments
 (0)