summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-05-28 18:54:01 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-29 17:35:53 +0200
commitfaf271f85d16d952efe497396a56d1af59b2c83b (patch)
treed89798c7b612874a29b396c6098c5c8f57630ef5
parent8d457d3c6c93c6707c4633cd5add5e768ecab2c9 (diff)
downloadlinux-stable-faf271f85d16d952efe497396a56d1af59b2c83b.tar.gz
linux-stable-faf271f85d16d952efe497396a56d1af59b2c83b.tar.bz2
linux-stable-faf271f85d16d952efe497396a56d1af59b2c83b.zip
thermal: gov_bang_bang: Drop unnecessary cooling device target state checks
[ Upstream commit 2c637af8a74d9a2a52ee5456a75dd29c8cb52da5 ] 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> Stable-dep-of: 84248e35d9b6 ("thermal: gov_bang_bang: Split bang_bang_control()") Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/thermal/gov_bang_bang.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
index 2a6a651e9d92..b9474c6af72b 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);