public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
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>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Zhang Rui <rui.zhang@intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Lukasz Luba <lukasz.luba@arm.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>
Subject: [PATCH v1 13/13] ACPI: thermal: Rename structure fields holding temperature in deci-Kelvin
Date: Thu, 21 Sep 2023 20:06:58 +0200	[thread overview]
Message-ID: <1968603.yKVeVyVuyW@kreacher> (raw)
In-Reply-To: <1957441.PYKUYFuaPT@kreacher>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Subject: [PATCH v1] 

Rename structure fields holding temperature values in deci-Kelvin so as
to avoid temperature units confusion.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/thermal.c |   44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

Index: linux-pm/drivers/acpi/thermal.c
===================================================================
--- linux-pm.orig/drivers/acpi/thermal.c
+++ linux-pm/drivers/acpi/thermal.c
@@ -82,7 +82,7 @@ MODULE_PARM_DESC(psv, "Disable or overri
 static struct workqueue_struct *acpi_thermal_pm_queue;
 
 struct acpi_thermal_trip {
-	unsigned long temperature;
+	unsigned long temp_dk;
 	struct acpi_handle_list devices;
 };
 
@@ -105,8 +105,8 @@ struct acpi_thermal_trips {
 struct acpi_thermal {
 	struct acpi_device *device;
 	acpi_bus_id name;
-	unsigned long temperature;
-	unsigned long last_temperature;
+	unsigned long temp_dk;
+	unsigned long last_temp_dk;
 	unsigned long polling_frequency;
 	volatile u8 zombie;
 	struct acpi_thermal_trips trips;
@@ -131,16 +131,16 @@ static int acpi_thermal_get_temperature(
 	if (!tz)
 		return -EINVAL;
 
-	tz->last_temperature = tz->temperature;
+	tz->last_temp_dk = tz->temp_dk;
 
 	status = acpi_evaluate_integer(tz->device->handle, "_TMP", NULL, &tmp);
 	if (ACPI_FAILURE(status))
 		return -ENODEV;
 
-	tz->temperature = tmp;
+	tz->temp_dk = tmp;
 
 	acpi_handle_debug(tz->device->handle, "Temperature is %lu dK\n",
-			  tz->temperature);
+			  tz->temp_dk);
 
 	return 0;
 }
@@ -175,7 +175,7 @@ static int acpi_thermal_temp(struct acpi
 
 static bool acpi_thermal_trip_valid(struct acpi_thermal_trip *acpi_trip)
 {
-	return acpi_trip->temperature != THERMAL_TEMP_INVALID;
+	return acpi_trip->temp_dk != THERMAL_TEMP_INVALID;
 }
 
 static long get_passive_temp(struct acpi_thermal *tz)
@@ -197,7 +197,7 @@ static void acpi_thermal_update_passive_
 	if (!acpi_thermal_trip_valid(acpi_trip) || psv > 0)
 		return;
 
-	acpi_trip->temperature = get_passive_temp(tz);
+	acpi_trip->temp_dk = get_passive_temp(tz);
 	if (!acpi_thermal_trip_valid(acpi_trip))
 		ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
 }
@@ -244,7 +244,7 @@ static void acpi_thermal_update_trip_dev
 		return;
 	}
 
-	acpi_trip->temperature = THERMAL_TEMP_INVALID;
+	acpi_trip->temp_dk = THERMAL_TEMP_INVALID;
 	ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
 }
 
@@ -278,7 +278,7 @@ static void acpi_thermal_update_active_t
 	if (!acpi_thermal_trip_valid(acpi_trip))
 		return;
 
-	acpi_trip->temperature = get_active_temp(tz, index);
+	acpi_trip->temp_dk = get_active_temp(tz, index);
 	if (!acpi_thermal_trip_valid(acpi_trip))
 		ACPI_THERMAL_TRIPS_EXCEPTION(tz, "state");
 }
@@ -292,7 +292,7 @@ static int acpi_thermal_adjust_trip(stru
 		return 0;
 
 	if (acpi_thermal_trip_valid(acpi_trip))
-		trip->temperature = acpi_thermal_temp(tz, acpi_trip->temperature);
+		trip->temperature = acpi_thermal_temp(tz, acpi_trip->temp_dk);
 	else
 		trip->temperature = THERMAL_TEMP_INVALID;
 
@@ -447,11 +447,11 @@ static bool acpi_thermal_init_trip(struc
 	if (!update_trip_devices(tz, acpi_trip, index, false))
 		goto fail;
 
-	acpi_trip->temperature = temp;
+	acpi_trip->temp_dk = temp;
 	return true;
 
 fail:
-	acpi_trip->temperature = THERMAL_TEMP_INVALID;
+	acpi_trip->temp_dk = THERMAL_TEMP_INVALID;
 	return false;
 }
 
@@ -488,7 +488,7 @@ static int thermal_get_temp(struct therm
 	if (result)
 		return result;
 
-	*temp = deci_kelvin_to_millicelsius_with_offset(tz->temperature,
+	*temp = deci_kelvin_to_millicelsius_with_offset(tz->temp_dk,
 							tz->kelvin_offset);
 	return 0;
 }
@@ -510,10 +510,10 @@ static int thermal_get_trend(struct ther
 
 	switch (trip->type) {
 	case THERMAL_TRIP_PASSIVE:
-		t = tz->trips.passive.tc1 * (tz->temperature -
-						tz->last_temperature) +
-			tz->trips.passive.tc2 * (tz->temperature -
-						acpi_trip->temperature);
+		t = tz->trips.passive.tc1 * (tz->temp_dk -
+						tz->last_temp_dk) +
+			tz->trips.passive.tc2 * (tz->temp_dk -
+						acpi_trip->temp_dk);
 		if (t > 0)
 			*trend = THERMAL_TREND_RAISING;
 		else if (t < 0)
@@ -524,7 +524,7 @@ static int thermal_get_trend(struct ther
 		return 0;
 
 	case THERMAL_TRIP_ACTIVE:
-		t = acpi_thermal_temp(tz, tz->temperature);
+		t = acpi_thermal_temp(tz, tz->temp_dk);
 		if (t <= trip->temperature)
 			break;
 
@@ -894,7 +894,7 @@ static int acpi_thermal_add(struct acpi_
 		passive_delay = tz->trips.passive.tsp * 100;
 
 		trip->type = THERMAL_TRIP_PASSIVE;
-		trip->temperature = acpi_thermal_temp(tz, acpi_trip->temperature);
+		trip->temperature = acpi_thermal_temp(tz, acpi_trip->temp_dk);
 		trip->priv = acpi_trip;
 		trip++;
 	}
@@ -906,7 +906,7 @@ static int acpi_thermal_add(struct acpi_
 			break;
 
 		trip->type = THERMAL_TRIP_ACTIVE;
-		trip->temperature = acpi_thermal_temp(tz, acpi_trip->temperature);
+		trip->temperature = acpi_thermal_temp(tz, acpi_trip->temp_dk);
 		trip->priv = acpi_trip;
 		trip++;
 	}
@@ -920,7 +920,7 @@ static int acpi_thermal_add(struct acpi_
 	INIT_WORK(&tz->thermal_check_work, acpi_thermal_check_fn);
 
 	pr_info("%s [%s] (%ld C)\n", acpi_device_name(device),
-		acpi_device_bid(device), deci_kelvin_to_celsius(tz->temperature));
+		acpi_device_bid(device), deci_kelvin_to_celsius(tz->temp_dk));
 
 	result = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
 						 acpi_thermal_notify);




  parent reply	other threads:[~2023-09-21 18:10 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 17:46 [PATCH v1 00/13] thermal: ACPI: More ACPI thermal improvements and modification of thermal instances Rafael J. Wysocki
2023-09-21 17:48 ` [PATCH v1 01/13] ACPI: thermal: Add device list to struct acpi_thermal_trip Rafael J. Wysocki
2023-09-26 15:17   ` Daniel Lezcano
2023-09-21 17:49 ` [PATCH v1 02/13] ACPI: thermal: Collapse trip devices update functions Rafael J. Wysocki
2023-09-26 17:18   ` Daniel Lezcano
2023-09-26 17:56     ` Rafael J. Wysocki
2023-09-26 18:04       ` Rafael J. Wysocki
2023-09-26 21:16         ` Daniel Lezcano
2023-09-26 21:33   ` Daniel Lezcano
2023-09-21 17:50 ` [PATCH v1 03/13] ACPI: thermal: Collapse trip devices update function wrappers Rafael J. Wysocki
2023-09-27  9:15   ` Daniel Lezcano
2023-09-21 17:51 ` [PATCH v1 04/13] ACPI: thermal: Merge trip initialization functions Rafael J. Wysocki
2023-09-27 11:58   ` Daniel Lezcano
2023-09-21 17:52 ` [PATCH v1 05/13] thermal: core: Store trip pointer in struct thermal_instance Rafael J. Wysocki
2023-09-27 14:56   ` Daniel Lezcano
2023-09-21 17:54 ` [PATCH v1 06/13] thermal: gov_fair_share: Rearrange get_trip_level() Rafael J. Wysocki
2023-09-27 15:00   ` Daniel Lezcano
2023-09-27 15:06     ` Rafael J. Wysocki
2023-09-27 15:37       ` Daniel Lezcano
2023-09-27 16:09         ` Rafael J. Wysocki
2023-09-21 17:55 ` [PATCH v1 07/13] thermal: gov_power_allocator: Use trip pointers instead of trip indices Rafael J. Wysocki
2023-09-27 15:10   ` Daniel Lezcano
2023-09-27 15:27     ` Rafael J. Wysocki
2023-09-27 15:46       ` Daniel Lezcano
2023-09-27 16:14         ` Rafael J. Wysocki
2023-09-21 17:56 ` [PATCH v1 08/13] thermal: gov_step_wise: Fold update_passive_instance() into its caller Rafael J. Wysocki
2023-09-21 17:58 ` [PATCH v1 09/13] thermal: core: Rename trip point index function arguments in governors Rafael J. Wysocki
2023-09-21 18:01 ` [PATCH v1 10/13] thermal: core: Allow trip pointers to be used for cooling device binding Rafael J. Wysocki
2023-09-28  7:10   ` Daniel Lezcano
2023-09-28 10:38     ` Rafael J. Wysocki
2023-09-28 13:31       ` Daniel Lezcano
2023-09-21 18:02 ` [PATCH v1 11/13] ACPI: thermal: Do not use trip indices " Rafael J. Wysocki
2023-09-28  7:24   ` Daniel Lezcano
2023-09-21 18:04 ` [PATCH v1 12/13] ACPI: thermal: Drop critical_valid and hot_valid trip flags Rafael J. Wysocki
2023-09-28  7:25   ` Daniel Lezcano
2023-09-21 18:06 ` Rafael J. Wysocki [this message]
2023-09-28  7:28   ` [PATCH v1 13/13] ACPI: thermal: Rename structure fields holding temperature in deci-Kelvin Daniel Lezcano

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=1968603.yKVeVyVuyW@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=lukasz.luba@arm.com \
    --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