public inbox for linux-kernel@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>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Lukasz Luba <lukasz.luba@arm.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>
Subject: [PATCH v3 6/6] thermal: core: Relocate critical and hot trip handling
Date: Tue, 02 Apr 2024 21:04:28 +0200	[thread overview]
Message-ID: <3556878.iIbC2pHGDl@kreacher> (raw)
In-Reply-To: <4558251.LvFx2qVVIh@kreacher>

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Modify handle_thermal_trip() to call handle_critical_trips() only after
finding that the trip temperature has been crossed on the way up and
remove the redundant temperature check from the latter.

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

Index: linux-pm/drivers/thermal/thermal_core.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_core.c
+++ linux-pm/drivers/thermal/thermal_core.c
@@ -349,10 +349,6 @@ void thermal_zone_device_critical_reboot
 static void handle_critical_trips(struct thermal_zone_device *tz,
 				  const struct thermal_trip *trip)
 {
-	/* If we have not crossed the trip_temp, we do not care. */
-	if (trip->temperature <= 0 || tz->temperature < trip->temperature)
-		return;
-
 	trace_thermal_zone_trip(tz, thermal_zone_trip_id(tz, trip), trip->type);
 
 	if (trip->type == THERMAL_TRIP_CRITICAL)
@@ -404,12 +400,15 @@ static void handle_thermal_trip(struct t
 		list_add_tail(&td->notify_list_node, way_up_list);
 		td->notify_temp = trip->temperature;
 		td->threshold -= trip->hysteresis;
+
+		if (trip->type == THERMAL_TRIP_CRITICAL ||
+		    trip->type == THERMAL_TRIP_HOT) {
+			handle_critical_trips(tz, trip);
+			return;
+		}
 	}
 
-	if (trip->type == THERMAL_TRIP_CRITICAL || trip->type == THERMAL_TRIP_HOT)
-		handle_critical_trips(tz, trip);
-	else
-		handle_non_critical_trips(tz, trip);
+	handle_non_critical_trips(tz, trip);
 }
 
 static void update_temperature(struct thermal_zone_device *tz)




  parent reply	other threads:[~2024-04-02 19:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02 18:54 [PATCH v3 0/6] thermal: More separation between the core and drivers Rafael J. Wysocki
2024-04-02 18:56 ` [PATCH v3 1/6] thermal: core: Move threshold out of struct thermal_trip Rafael J. Wysocki
2024-04-04 22:08   ` Lukasz Luba
2024-04-02 18:57 ` [PATCH v3 2/6] thermal: core: Make struct thermal_zone_device definition internal Rafael J. Wysocki
2024-04-04 22:13   ` Lukasz Luba
2024-04-05  8:26   ` Daniel Lezcano
2024-04-02 18:59 ` [PATCH v3 3/6] thermal: core: Rewrite comments in handle_thermal_trip() Rafael J. Wysocki
2024-04-04 22:14   ` Lukasz Luba
2024-04-05  8:30   ` Daniel Lezcano
2024-04-02 19:02 ` [PATCH v3 4/6] thermal: core: Send trip crossing notifications at init time if needed Rafael J. Wysocki
2024-04-04 22:55   ` Lukasz Luba
2024-04-02 19:03 ` [PATCH v3 5/6] thermal: core: Sort trip point crossing notifications by temperature Rafael J. Wysocki
2024-04-04 22:53   ` Lukasz Luba
2024-04-02 19:04 ` Rafael J. Wysocki [this message]
2024-04-04  9:03   ` [PATCH v3 6/6] thermal: core: Relocate critical and hot trip handling Rafael J. Wysocki
2024-04-05  7:35     ` Lukasz Luba
2024-04-10 15:56       ` Rafael J. Wysocki
2024-04-11  6:35         ` Lukasz Luba
2024-04-02 19:42 ` [PATCH v3 0/6] thermal: More separation between the core and drivers Rafael J. Wysocki
2024-04-04 11:30   ` Lukasz Luba

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=3556878.iIbC2pHGDl@kreacher \
    --to=rjw@rjwysocki.net \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.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