Skip to content

Commit f1164d3

Browse files
committed
thermal: gov_step_wise: Simplify get_target_state()
The step-wise governor's get_target_state() function contains redundant braces, redundant parens and a redundant next_target local variable, so get rid of all that stuff. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
1 parent fec50db commit f1164d3

1 file changed

Lines changed: 10 additions & 17 deletions

File tree

drivers/thermal/gov_step_wise.c

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,40 +32,33 @@ static unsigned long get_target_state(struct thermal_instance *instance,
3232
{
3333
struct thermal_cooling_device *cdev = instance->cdev;
3434
unsigned long cur_state;
35-
unsigned long next_target;
3635

3736
/*
3837
* We keep this instance the way it is by default.
3938
* Otherwise, we use the current state of the
4039
* cdev in use to determine the next_target.
4140
*/
4241
cdev->ops->get_cur_state(cdev, &cur_state);
43-
next_target = instance->target;
4442
dev_dbg(&cdev->device, "cur_state=%ld\n", cur_state);
4543

4644
if (!instance->initialized) {
47-
if (throttle) {
48-
next_target = clamp((cur_state + 1), instance->lower, instance->upper);
49-
} else {
50-
next_target = THERMAL_NO_TARGET;
51-
}
45+
if (throttle)
46+
return clamp(cur_state + 1, instance->lower, instance->upper);
5247

53-
return next_target;
48+
return THERMAL_NO_TARGET;
5449
}
5550

5651
if (throttle) {
5752
if (trend == THERMAL_TREND_RAISING)
58-
next_target = clamp((cur_state + 1), instance->lower, instance->upper);
59-
} else {
60-
if (trend == THERMAL_TREND_DROPPING) {
61-
if (cur_state <= instance->lower)
62-
next_target = THERMAL_NO_TARGET;
63-
else
64-
next_target = clamp((cur_state - 1), instance->lower, instance->upper);
65-
}
53+
return clamp(cur_state + 1, instance->lower, instance->upper);
54+
} else if (trend == THERMAL_TREND_DROPPING) {
55+
if (cur_state <= instance->lower)
56+
return THERMAL_NO_TARGET;
57+
58+
return clamp(cur_state - 1, instance->lower, instance->upper);
6659
}
6760

68-
return next_target;
61+
return instance->target;
6962
}
7063

7164
static void thermal_zone_trip_update(struct thermal_zone_device *tz,

0 commit comments

Comments
 (0)