Skip to content

Commit 43bac10

Browse files
committed
thermal: core: Relocate thermal zone initialization routine
Move thermal_zone_device_init() along with thermal_zone_device_check() closer to the callers of the former, where they fit better together. No functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Lukasz Luba <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 6d5537d commit 43bac10

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

drivers/thermal/thermal_core.c

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -429,14 +429,6 @@ static void move_trip_to_sorted_list(struct thermal_trip_desc *td,
429429
list_add(&td->list_node, list);
430430
}
431431

432-
static void thermal_zone_device_check(struct work_struct *work)
433-
{
434-
struct thermal_zone_device *tz = container_of(work, struct
435-
thermal_zone_device,
436-
poll_queue.work);
437-
thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
438-
}
439-
440432
static void move_to_trips_high(struct thermal_zone_device *tz,
441433
struct thermal_trip_desc *td)
442434
{
@@ -458,39 +450,6 @@ static void move_to_trips_invalid(struct thermal_zone_device *tz,
458450
list_move(&td->list_node, &tz->trips_invalid);
459451
}
460452

461-
static void thermal_zone_device_init(struct thermal_zone_device *tz)
462-
{
463-
struct thermal_trip_desc *td, *next;
464-
465-
INIT_DELAYED_WORK(&tz->poll_queue, thermal_zone_device_check);
466-
467-
tz->temperature = THERMAL_TEMP_INIT;
468-
tz->passive = 0;
469-
tz->prev_low_trip = -INT_MAX;
470-
tz->prev_high_trip = INT_MAX;
471-
for_each_trip_desc(tz, td) {
472-
struct thermal_instance *instance;
473-
474-
list_for_each_entry(instance, &td->thermal_instances, trip_node)
475-
instance->initialized = false;
476-
}
477-
/*
478-
* At this point, all valid trips need to be moved to trips_high so that
479-
* mitigation can be started if the zone temperature is above them.
480-
*/
481-
list_for_each_entry_safe(td, next, &tz->trips_invalid, list_node) {
482-
if (td->trip.temperature != THERMAL_TEMP_INVALID)
483-
move_to_trips_high(tz, td);
484-
}
485-
/* The trips_reached list may not be empty during system resume. */
486-
list_for_each_entry_safe(td, next, &tz->trips_reached, list_node) {
487-
if (td->trip.temperature == THERMAL_TEMP_INVALID)
488-
move_to_trips_invalid(tz, td);
489-
else
490-
move_to_trips_high(tz, td);
491-
}
492-
}
493-
494453
static void thermal_governor_trip_crossed(struct thermal_governor *governor,
495454
struct thermal_zone_device *tz,
496455
const struct thermal_trip *trip,
@@ -1426,6 +1385,47 @@ int thermal_zone_get_crit_temp(struct thermal_zone_device *tz, int *temp)
14261385
}
14271386
EXPORT_SYMBOL_GPL(thermal_zone_get_crit_temp);
14281387

1388+
static void thermal_zone_device_check(struct work_struct *work)
1389+
{
1390+
struct thermal_zone_device *tz = container_of(work, struct
1391+
thermal_zone_device,
1392+
poll_queue.work);
1393+
thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
1394+
}
1395+
1396+
static void thermal_zone_device_init(struct thermal_zone_device *tz)
1397+
{
1398+
struct thermal_trip_desc *td, *next;
1399+
1400+
INIT_DELAYED_WORK(&tz->poll_queue, thermal_zone_device_check);
1401+
1402+
tz->temperature = THERMAL_TEMP_INIT;
1403+
tz->passive = 0;
1404+
tz->prev_low_trip = -INT_MAX;
1405+
tz->prev_high_trip = INT_MAX;
1406+
for_each_trip_desc(tz, td) {
1407+
struct thermal_instance *instance;
1408+
1409+
list_for_each_entry(instance, &td->thermal_instances, trip_node)
1410+
instance->initialized = false;
1411+
}
1412+
/*
1413+
* At this point, all valid trips need to be moved to trips_high so that
1414+
* mitigation can be started if the zone temperature is above them.
1415+
*/
1416+
list_for_each_entry_safe(td, next, &tz->trips_invalid, list_node) {
1417+
if (td->trip.temperature != THERMAL_TEMP_INVALID)
1418+
move_to_trips_high(tz, td);
1419+
}
1420+
/* The trips_reached list may not be empty during system resume. */
1421+
list_for_each_entry_safe(td, next, &tz->trips_reached, list_node) {
1422+
if (td->trip.temperature == THERMAL_TEMP_INVALID)
1423+
move_to_trips_invalid(tz, td);
1424+
else
1425+
move_to_trips_high(tz, td);
1426+
}
1427+
}
1428+
14291429
static int thermal_zone_init_governor(struct thermal_zone_device *tz)
14301430
{
14311431
struct thermal_governor *governor;

0 commit comments

Comments
 (0)