From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux ACPI <linux-acpi@vger.kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Zhang Rui <rui.zhang@intel.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
"Rafael J. Wysocki" <rafael@kernel.org>
Subject: [PATCH v1 1/4] thermal: core: Add function to walk trips under zone lock
Date: Mon, 02 Oct 2023 19:59:35 +0200 [thread overview]
Message-ID: <2306658.ElGaqSPkdT@kreacher> (raw)
In-Reply-To: <4871671.31r3eYUQgx@kreacher>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Add a wrapper around for_each_thermal_trip(), called
thermal_zone_for_each_trip(), that will invoke the former under the
thermal zone lock and pass its return value to the caller.
Two drivers will be modified subsequently to use this new function.
No functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/thermal/thermal_trip.c | 14 ++++++++++++++
include/linux/thermal.h | 3 +++
2 files changed, 17 insertions(+)
Index: linux-pm/drivers/thermal/thermal_trip.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_trip.c
+++ linux-pm/drivers/thermal/thermal_trip.c
@@ -27,6 +27,20 @@ int for_each_thermal_trip(struct thermal
}
EXPORT_SYMBOL_GPL(for_each_thermal_trip);
+int thermal_zone_for_each_trip(struct thermal_zone_device *tz,
+ int (*cb)(struct thermal_trip *, void *),
+ void *data)
+{
+ int ret;
+
+ mutex_lock(&tz->lock);
+ ret = for_each_thermal_trip(tz, cb, data);
+ mutex_unlock(&tz->lock);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(thermal_zone_for_each_trip);
+
int thermal_zone_get_num_trips(struct thermal_zone_device *tz)
{
return tz->num_trips;
Index: linux-pm/include/linux/thermal.h
===================================================================
--- linux-pm.orig/include/linux/thermal.h
+++ linux-pm/include/linux/thermal.h
@@ -287,6 +287,9 @@ int thermal_zone_set_trip(struct thermal
int for_each_thermal_trip(struct thermal_zone_device *tz,
int (*cb)(struct thermal_trip *, void *),
void *data);
+int thermal_zone_for_each_trip(struct thermal_zone_device *tz,
+ int (*cb)(struct thermal_trip *, void *),
+ void *data);
int thermal_zone_get_num_trips(struct thermal_zone_device *tz);
int thermal_zone_get_crit_temp(struct thermal_zone_device *tz, int *temp);
next prev parent reply other threads:[~2023-10-02 18:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-02 17:58 [PATCH v1 0/4] thermal: Improve iteration over trip points Rafael J. Wysocki
2023-10-02 17:59 ` Rafael J. Wysocki [this message]
2023-10-02 18:00 ` [PATCH v1 2/4] ACPI: thermal: Use thermal_zone_for_each_trip() Rafael J. Wysocki
2023-10-02 18:02 ` [PATCH v1 3/4] thermal: core: Drop thermal_zone_device_exec() Rafael J. Wysocki
2023-10-02 18:03 ` [PATCH v1 4/4] thermal: int340x: Use thermal_zone_for_each_trip() Rafael J. Wysocki
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=2306658.ElGaqSPkdT@kreacher \
--to=rjw@rjwysocki.net \
--cc=daniel.lezcano@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=srinivas.pandruvada@linux.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