Skip to content

Commit fdcf70e

Browse files
committed
thermal: gov_step_wise: Fold update_passive_instance() into its caller
Fold update_passive_instance() into thermal_zone_trip_update() that is its only caller so as to make the code in question easier to follow. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Daniel Lezcano <[email protected]> Reviewed-by: Lukasz Luba <[email protected]>
1 parent 94be1d2 commit fdcf70e

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

drivers/thermal/gov_step_wise.c

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,6 @@ static unsigned long get_target_state(struct thermal_instance *instance,
6868
return next_target;
6969
}
7070

71-
static void update_passive_instance(struct thermal_zone_device *tz,
72-
enum thermal_trip_type type, int value)
73-
{
74-
/*
75-
* If value is +1, activate a passive instance.
76-
* If value is -1, deactivate a passive instance.
77-
*/
78-
if (type == THERMAL_TRIP_PASSIVE)
79-
tz->passive += value;
80-
}
81-
8271
static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id)
8372
{
8473
const struct thermal_trip *trip = &tz->trips[trip_id];
@@ -109,14 +98,17 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id
10998
if (instance->initialized && old_target == instance->target)
11099
continue;
111100

112-
/* Activate a passive thermal instance */
113101
if (old_target == THERMAL_NO_TARGET &&
114-
instance->target != THERMAL_NO_TARGET)
115-
update_passive_instance(tz, trip->type, 1);
116-
/* Deactivate a passive thermal instance */
117-
else if (old_target != THERMAL_NO_TARGET &&
118-
instance->target == THERMAL_NO_TARGET)
119-
update_passive_instance(tz, trip->type, -1);
102+
instance->target != THERMAL_NO_TARGET) {
103+
/* Activate a passive thermal instance */
104+
if (trip->type == THERMAL_TRIP_PASSIVE)
105+
tz->passive++;
106+
} else if (old_target != THERMAL_NO_TARGET &&
107+
instance->target == THERMAL_NO_TARGET) {
108+
/* Deactivate a passive thermal instance */
109+
if (trip->type == THERMAL_TRIP_PASSIVE)
110+
tz->passive--;
111+
}
120112

121113
instance->initialized = true;
122114
mutex_lock(&instance->cdev->lock);

0 commit comments

Comments
 (0)