diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2024-05-28 18:54:01 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2024-06-11 21:06:44 +0200 |
commit | 2c637af8a74d9a2a52ee5456a75dd29c8cb52da5 (patch) | |
tree | 5e238d0b6fb705426c654aa3af4993e85fdcd80e /drivers/thermal | |
parent | thermal: trip: Use READ_ONCE() for lockless access to trip properties (diff) | |
download | linux-2c637af8a74d9a2a52ee5456a75dd29c8cb52da5.tar.xz linux-2c637af8a74d9a2a52ee5456a75dd29c8cb52da5.zip |
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>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/gov_bang_bang.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c index acb52c9ee10f..4a2e869b9538 100644 --- a/drivers/thermal/gov_bang_bang.c +++ b/drivers/thermal/gov_bang_bang.c @@ -57,24 +57,16 @@ static void bang_bang_control(struct thermal_zone_device *tz, if (instance->trip != trip) continue; - if (instance->target == THERMAL_NO_TARGET) - instance->target = 0; - - if (instance->target != 0 && instance->target != 1) { + if (instance->target != 0 && instance->target != 1 && + instance->target != THERMAL_NO_TARGET) pr_debug("Unexpected state %ld of thermal instance %s in bang-bang\n", instance->target, instance->name); - instance->target = 1; - } - /* * Enable the fan when the trip is crossed on the way up and * disable it when the trip is crossed on the way down. */ - if (instance->target == 0 && crossed_up) - instance->target = 1; - else if (instance->target == 1 && !crossed_up) - instance->target = 0; + instance->target = crossed_up; dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target); |