Skip to content

Commit f831892

Browse files
committed
thermal: core: Introduce thermal_governor_trip_crossed()
Add a wrapper around the .trip_crossed() governor callback invocation to reduce code duplications slightly and improve the code layout in __thermal_zone_device_update(). No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Lukasz Luba <[email protected]>
1 parent a6258fd commit f831892

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

drivers/thermal/thermal_core.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,15 @@ static void thermal_zone_device_init(struct thermal_zone_device *tz)
450450
pos->initialized = false;
451451
}
452452

453+
static void thermal_governor_trip_crossed(struct thermal_governor *governor,
454+
struct thermal_zone_device *tz,
455+
const struct thermal_trip *trip,
456+
bool crossed_up)
457+
{
458+
if (governor->trip_crossed)
459+
governor->trip_crossed(tz, trip, crossed_up);
460+
}
461+
453462
static int thermal_trip_notify_cmp(void *ascending, const struct list_head *a,
454463
const struct list_head *b)
455464
{
@@ -489,16 +498,14 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,
489498
list_for_each_entry(td, &way_up_list, notify_list_node) {
490499
thermal_notify_tz_trip_up(tz, &td->trip);
491500
thermal_debug_tz_trip_up(tz, &td->trip);
492-
if (governor->trip_crossed)
493-
governor->trip_crossed(tz, &td->trip, true);
501+
thermal_governor_trip_crossed(governor, tz, &td->trip, true);
494502
}
495503

496504
list_sort(NULL, &way_down_list, thermal_trip_notify_cmp);
497505
list_for_each_entry(td, &way_down_list, notify_list_node) {
498506
thermal_notify_tz_trip_down(tz, &td->trip);
499507
thermal_debug_tz_trip_down(tz, &td->trip);
500-
if (governor->trip_crossed)
501-
governor->trip_crossed(tz, &td->trip, false);
508+
thermal_governor_trip_crossed(governor, tz, &td->trip, false);
502509
}
503510

504511
if (governor->manage)

0 commit comments

Comments
 (0)