Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 2c637af

Browse files
committed
thermal: gov_bang_bang: Drop unnecessary cooling device target state checks
Some cooling device target state checks in bang_bang_control() done before setting the new target state are not necessary after recent changes, so drop them. Also avoid updating the target state before checking it for unexpected values. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent a52641b commit 2c637af

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

drivers/thermal/gov_bang_bang.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,16 @@ static void bang_bang_control(struct thermal_zone_device *tz,
5757
if (instance->trip != trip)
5858
continue;
5959

60-
if (instance->target == THERMAL_NO_TARGET)
61-
instance->target = 0;
62-
63-
if (instance->target != 0 && instance->target != 1) {
60+
if (instance->target != 0 && instance->target != 1 &&
61+
instance->target != THERMAL_NO_TARGET)
6462
pr_debug("Unexpected state %ld of thermal instance %s in bang-bang\n",
6563
instance->target, instance->name);
6664

67-
instance->target = 1;
68-
}
69-
7065
/*
7166
* Enable the fan when the trip is crossed on the way up and
7267
* disable it when the trip is crossed on the way down.
7368
*/
74-
if (instance->target == 0 && crossed_up)
75-
instance->target = 1;
76-
else if (instance->target == 1 && !crossed_up)
77-
instance->target = 0;
69+
instance->target = crossed_up;
7870

7971
dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target);
8072

0 commit comments

Comments
 (0)