Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <rafael.j.wysocki@intel.com>

+19 -10
+19 -10
drivers/thermal/thermal_core.c
··· 467 467 governor->trip_crossed(tz, trip, crossed_up); 468 468 } 469 469 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 + 470 485 static int thermal_trip_notify_cmp(void *ascending, const struct list_head *a, 471 486 const struct list_head *b) 472 487 { ··· 521 506 handle_thermal_trip(tz, td, &way_up_list, &way_down_list); 522 507 523 508 list_sort(&way_up_list, &way_up_list, thermal_trip_notify_cmp); 524 - list_for_each_entry(td, &way_up_list, notify_list_node) { 525 - thermal_notify_tz_trip_up(tz, &td->trip); 526 - thermal_debug_tz_trip_up(tz, &td->trip); 527 - thermal_governor_trip_crossed(governor, tz, &td->trip, true); 528 - } 509 + list_for_each_entry(td, &way_up_list, notify_list_node) 510 + thermal_trip_crossed(tz, &td->trip, governor, true); 529 511 530 512 list_sort(NULL, &way_down_list, thermal_trip_notify_cmp); 531 - list_for_each_entry(td, &way_down_list, notify_list_node) { 532 - thermal_notify_tz_trip_down(tz, &td->trip); 533 - thermal_debug_tz_trip_down(tz, &td->trip); 534 - thermal_governor_trip_crossed(governor, tz, &td->trip, false); 535 - } 513 + list_for_each_entry(td, &way_down_list, notify_list_node) 514 + thermal_trip_crossed(tz, &td->trip, governor, false); 536 515 537 516 if (governor->manage) 538 517 governor->manage(tz);