Skip to content

Commit cb573ee

Browse files
committed
thermal: core: Introduce thermal_trip_crossed()
Add a helper function called thermal_trip_crossed() to be invoked by __thermal_zone_device_update() in order to notify user space, the thermal debug code and the zone governor about trip crossing. Subsequently, this will also be used in the case when a trip point becomes invalid after being crossed on the way up. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 5a599e1 commit cb573ee

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

drivers/thermal/thermal_core.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,21 @@ static void thermal_governor_trip_crossed(struct thermal_governor *governor,
467467
governor->trip_crossed(tz, trip, crossed_up);
468468
}
469469

470+
static void thermal_trip_crossed(struct thermal_zone_device *tz,
471+
const struct thermal_trip *trip,
472+
struct thermal_governor *governor,
473+
bool crossed_up)
474+
{
475+
if (crossed_up) {
476+
thermal_notify_tz_trip_up(tz, trip);
477+
thermal_debug_tz_trip_up(tz, trip);
478+
} else {
479+
thermal_notify_tz_trip_down(tz, trip);
480+
thermal_debug_tz_trip_down(tz, trip);
481+
}
482+
thermal_governor_trip_crossed(governor, tz, trip, crossed_up);
483+
}
484+
470485
static int thermal_trip_notify_cmp(void *ascending, const struct list_head *a,
471486
const struct list_head *b)
472487
{
@@ -506,18 +521,12 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,
506521
handle_thermal_trip(tz, td, &way_up_list, &way_down_list);
507522

508523
list_sort(&way_up_list, &way_up_list, thermal_trip_notify_cmp);
509-
list_for_each_entry(td, &way_up_list, notify_list_node) {
510-
thermal_notify_tz_trip_up(tz, &td->trip);
511-
thermal_debug_tz_trip_up(tz, &td->trip);
512-
thermal_governor_trip_crossed(governor, tz, &td->trip, true);
513-
}
524+
list_for_each_entry(td, &way_up_list, notify_list_node)
525+
thermal_trip_crossed(tz, &td->trip, governor, true);
514526

515527
list_sort(NULL, &way_down_list, thermal_trip_notify_cmp);
516-
list_for_each_entry(td, &way_down_list, notify_list_node) {
517-
thermal_notify_tz_trip_down(tz, &td->trip);
518-
thermal_debug_tz_trip_down(tz, &td->trip);
519-
thermal_governor_trip_crossed(governor, tz, &td->trip, false);
520-
}
528+
list_for_each_entry(td, &way_down_list, notify_list_node)
529+
thermal_trip_crossed(tz, &td->trip, governor, false);
521530

522531
if (governor->manage)
523532
governor->manage(tz);

0 commit comments

Comments
 (0)