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>,
Zhang Rui <rui.zhang@intel.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>
Subject: [PATCH v1 3/6] thermal: intel: int340x: Evaluate GTSH once
Date: Tue, 24 Jan 2023 20:16:09 +0100 [thread overview]
Message-ID: <2887081.e9J7NaK4W3@kreacher> (raw)
In-Reply-To: <12159228.O9o76ZdvQC@kreacher>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
It is not necessary to evaluate the GTSH ACPI object for every trip
point in int340x_thermal_zone_add() and the function used for that
is not really necessary either, because it only has one caller.
Accordingly, fold the evaluation of GTSH directly into
int340x_thermal_zone_add(), evaluate it only once and populate the
hysteresis for all of the trip points with the value produced by it.
No expected functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 24 +++--------
1 file changed, 8 insertions(+), 16 deletions(-)
Index: linux-pm/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
===================================================================
--- linux-pm.orig/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
+++ linux-pm/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
@@ -53,21 +53,6 @@ static int int340x_thermal_set_trip_temp
return 0;
}
-static int int340x_thermal_get_global_hyst(struct acpi_device *adev, int *temp)
-{
- acpi_status status;
- unsigned long long hyst;
-
- status = acpi_evaluate_integer(adev->handle, "GTSH", NULL, &hyst);
- if (ACPI_FAILURE(status))
- *temp = 0;
- else
- *temp = hyst * 100;
-
- return 0;
-}
-
-
static void int340x_thermal_critical(struct thermal_zone_device *zone)
{
dev_dbg(&zone->device, "%s: critical temperature reached\n", zone->type);
@@ -120,6 +105,7 @@ struct int34x_thermal_zone *int340x_ther
{
struct int34x_thermal_zone *int34x_zone;
unsigned long long trip_cnt = 0;
+ unsigned long long hyst;
int trip_mask = 0;
acpi_status status;
int i, ret;
@@ -156,8 +142,14 @@ struct int34x_thermal_zone *int340x_ther
trip_cnt = int340x_thermal_read_trips(int34x_zone);
+ status = acpi_evaluate_integer(adev->handle, "GTSH", NULL, &hyst);
+ if (ACPI_SUCCESS(status))
+ hyst *= 100;
+ else
+ hyst = 0;
+
for (i = 0; i < trip_cnt; ++i)
- int340x_thermal_get_global_hyst(adev, &int34x_zone->trips[i].hysteresis);
+ int34x_zone->trips[i].hysteresis = hyst;
for (i = 0; i < int34x_zone->aux_trip_nr; i++) {
int34x_zone->trips[i].type = THERMAL_TRIP_PASSIVE;
next prev parent reply other threads:[~2023-01-24 19:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-24 19:07 [PATCH v1 0/6] thermal: intel: int340x: Assorted cleanup changes Rafael J. Wysocki
2023-01-24 19:13 ` [PATCH v1 1/6] thermal: intel: int340x: Assorted minor cleanups Rafael J. Wysocki
2023-01-24 19:14 ` [PATCH v1 2/6] thermal: intel: int340x: Rename variable in int340x_thermal_zone_add() Rafael J. Wysocki
2023-01-24 19:16 ` Rafael J. Wysocki [this message]
2023-01-24 19:17 ` [PATCH v1 4/6] thermal: intel: int340x: Rearrange int340x_thermal_read_trips() Rafael J. Wysocki
2023-01-24 19:18 ` [PATCH v1 5/6] thermal: intel: int340x: Populate auxiliary trip points first Rafael J. Wysocki
2023-01-24 19:18 ` [PATCH v1 6/6] thermal: intel: int340x: Drop pointless cast to unsigned long 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=2887081.e9J7NaK4W3@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=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