[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3570512.iIbC2pHGDl@kreacher>
Date: Fri, 10 May 2024 16:19:32 +0200
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Linux PM <linux-pm@...r.kernel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>, Lukasz Luba <lukasz.luba@....com>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
Zhang Rui <rui.zhang@...el.com>
Subject:
[PATCH v1 5/6] thermal: gov_bang_bang: Drop unnecessary cooling device target
state checks
From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
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@...el.com>
---
drivers/thermal/gov_bang_bang.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
Index: linux-pm/drivers/thermal/gov_bang_bang.c
===================================================================
--- linux-pm.orig/drivers/thermal/gov_bang_bang.c
+++ linux-pm/drivers/thermal/gov_bang_bang.c
@@ -57,24 +57,16 @@ static void bang_bang_control(struct the
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);
Powered by blists - more mailing lists