From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
"Lukasz Luba" <lukasz.luba@arm.com>,
"Daniel Lezcano" <daniel.lezcano@linaro.org>,
"Zhang Rui" <rui.zhang@intel.com>,
"Peter Kästle" <peter@piie.net>
Subject: [PATCH v1 2/4] thermal: gov_bang_bang: Split bang_bang_control()
Date: Tue, 13 Aug 2024 16:26:42 +0200 [thread overview]
Message-ID: <3313587.aeNJFYEL58@rjwysocki.net> (raw)
In-Reply-To: <1903691.tdWV9SEqCh@rjwysocki.net>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Move the setting of the thermal instance target state from
bang_bang_control() into a separate function that will be also called
in a different place going forward.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/thermal/gov_bang_bang.c | 42 +++++++++++++++++++++-------------------
1 file changed, 23 insertions(+), 19 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
@@ -13,6 +13,27 @@
#include "thermal_core.h"
+static void bang_bang_set_instance_target(struct thermal_instance *instance,
+ unsigned int target)
+{
+ 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);
+
+ /*
+ * Enable the fan when the trip is crossed on the way up and disable it
+ * when the trip is crossed on the way down.
+ */
+ instance->target = target;
+
+ dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target);
+
+ mutex_lock(&instance->cdev->lock);
+ __thermal_cdev_update(instance->cdev);
+ mutex_unlock(&instance->cdev->lock);
+}
+
/**
* bang_bang_control - controls devices associated with the given zone
* @tz: thermal_zone_device
@@ -54,25 +75,8 @@ static void bang_bang_control(struct the
tz->temperature, trip->hysteresis);
list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
- if (instance->trip != trip)
- continue;
-
- 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);
-
- /*
- * Enable the fan when the trip is crossed on the way up and
- * disable it when the trip is crossed on the way down.
- */
- instance->target = crossed_up;
-
- dev_dbg(&instance->cdev->device, "target=%ld\n", instance->target);
-
- mutex_lock(&instance->cdev->lock);
- __thermal_cdev_update(instance->cdev);
- mutex_unlock(&instance->cdev->lock);
+ if (instance->trip == trip)
+ bang_bang_set_instance_target(instance, crossed_up);
}
}
next prev parent reply other threads:[~2024-08-13 14:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-13 14:23 [PATCH v1 0/4] thermal: gov_bang_bang: Prevent cooling devices from getting stuck in the "on" state Rafael J. Wysocki
2024-08-13 14:25 ` [PATCH v1 1/4] thermal: gov_bang_bang: Call __thermal_cdev_update() directly Rafael J. Wysocki
2024-08-13 21:03 ` Peter Kästle
2024-08-14 6:18 ` Zhang, Rui
2024-08-14 17:34 ` Rafael J. Wysocki
2024-08-16 3:00 ` Zhang, Rui
2024-08-13 14:26 ` Rafael J. Wysocki [this message]
2024-08-13 21:03 ` [PATCH v1 2/4] thermal: gov_bang_bang: Split bang_bang_control() Peter Kästle
2024-08-16 3:00 ` Zhang, Rui
2024-08-13 14:27 ` [PATCH v1 3/4] thermal: gov_bang_bang: Add .manage() callback Rafael J. Wysocki
2024-08-13 21:04 ` Peter Kästle
2024-08-13 21:07 ` Peter Kästle
2024-08-14 17:18 ` Rafael J. Wysocki
2024-08-14 20:55 ` Peter Kästle
2024-08-16 3:00 ` Zhang, Rui
2024-08-13 14:29 ` [PATCH v1 4/4] thermal: gov_bang_bang: Use governor_data to reduce overhead Rafael J. Wysocki
2024-08-13 21:08 ` Peter Kästle
2024-08-14 6:09 ` Zhang, Rui
2024-08-14 17:26 ` Rafael J. Wysocki
2024-08-15 3:26 ` Zhang, Rui
2024-08-15 12:35 ` Rafael J. Wysocki
2024-08-16 2:59 ` Zhang, Rui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3313587.aeNJFYEL58@rjwysocki.net \
--to=rjw@rjwysocki.net \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=peter@piie.net \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox