diff mbox series

[v1,16/16] thermal: core: Relocate critical and hot trip handling

Message ID 9337957.rMLUfLXkoz@kreacher
State New
Headers show
Series thermal: core: Redesign the governor interface | expand

Commit Message

Rafael J. Wysocki April 10, 2024, 5:44 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Subject: [PATCH v1] 

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.

No intentional functional impact.

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

Comments

Lukasz Luba April 19, 2024, 6:52 p.m. UTC | #1
On 4/10/24 18:44, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Subject: [PATCH v1]
> 
> 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.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>   drivers/thermal/thermal_core.c |   11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
> 
> Index: linux-pm/drivers/thermal/thermal_core.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_core.c
> +++ linux-pm/drivers/thermal/thermal_core.c
> @@ -350,10 +350,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)
> @@ -405,10 +401,11 @@ 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);
> +		if (trip->type == THERMAL_TRIP_CRITICAL ||
> +		    trip->type == THERMAL_TRIP_HOT)
> +			handle_critical_trips(tz, trip);
> +	}
>   }
>   
>   static void update_temperature(struct thermal_zone_device *tz)
> 
> 
> 

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Daniel Lezcano April 24, 2024, 9:17 a.m. UTC | #2
On Wed, Apr 10, 2024 at 07:44:34PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Subject: [PATCH v1] 
> 
> 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.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---

Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
diff mbox series

Patch

Index: linux-pm/drivers/thermal/thermal_core.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_core.c
+++ linux-pm/drivers/thermal/thermal_core.c
@@ -350,10 +350,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)
@@ -405,10 +401,11 @@  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);
+		if (trip->type == THERMAL_TRIP_CRITICAL ||
+		    trip->type == THERMAL_TRIP_HOT)
+			handle_critical_trips(tz, trip);
+	}
 }
 
 static void update_temperature(struct thermal_zone_device *tz)