diff mbox series

[1/5] thermal/core: Rearm the monitoring only one time

Message ID 20220805153834.2510142-1-daniel.lezcano@linaro.org
State New
Headers show
Series [1/5] thermal/core: Rearm the monitoring only one time | expand

Commit Message

Daniel Lezcano Aug. 5, 2022, 3:38 p.m. UTC
The current code calls monitor_thermal_zone() inside the
handle_thermal_trip() function. But this one is called in a loop for
each trip point which means the monitoring is rearmed several times
for nothing (assuming there could be several passive and active trip
points).

Move the monitor_thermal_zone() function out of the
handle_thermal_trip() function and after the thermal trip loop, so the
timer will be disabled or rearmed one time.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/thermal_core.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Rafael J. Wysocki Aug. 5, 2022, 4:29 p.m. UTC | #1
On Fri, Aug 5, 2022 at 5:38 PM Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>
> The current code calls monitor_thermal_zone() inside the
> handle_thermal_trip() function. But this one is called in a loop for
> each trip point which means the monitoring is rearmed several times
> for nothing (assuming there could be several passive and active trip
> points).
>
> Move the monitor_thermal_zone() function out of the
> handle_thermal_trip() function and after the thermal trip loop, so the
> timer will be disabled or rearmed one time.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Does this series depend on any other?

You've been sending quite a lot of material lately and it is not
always easy to tell what the dependencies between the different patch
series are.

> ---
>  drivers/thermal/thermal_core.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index b4c68410c158..4e1a83987b99 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -383,11 +383,6 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip)
>                 handle_critical_trips(tz, trip, trip_temp, type);
>         else
>                 handle_non_critical_trips(tz, trip);
> -       /*
> -        * Alright, we handled this trip successfully.
> -        * So, start monitoring again.
> -        */
> -       monitor_thermal_zone(tz);
>  }
>
>  static void update_temperature(struct thermal_zone_device *tz)
> @@ -503,6 +498,8 @@ void thermal_zone_device_update(struct thermal_zone_device *tz,
>
>         for (count = 0; count < tz->num_trips; count++)
>                 handle_thermal_trip(tz, count);
> +
> +       monitor_thermal_zone(tz);
>  }
>  EXPORT_SYMBOL_GPL(thermal_zone_device_update);
>
> --
> 2.25.1
>
Daniel Lezcano Aug. 5, 2022, 4:37 p.m. UTC | #2
Hi Rafael,

On 05/08/2022 18:29, Rafael J. Wysocki wrote:
> On Fri, Aug 5, 2022 at 5:38 PM Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>>
>> The current code calls monitor_thermal_zone() inside the
>> handle_thermal_trip() function. But this one is called in a loop for
>> each trip point which means the monitoring is rearmed several times
>> for nothing (assuming there could be several passive and active trip
>> points).
>>
>> Move the monitor_thermal_zone() function out of the
>> handle_thermal_trip() function and after the thermal trip loop, so the
>> timer will be disabled or rearmed one time.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> 
> Does this series depend on any other? >
> You've been sending quite a lot of material lately and it is not
> always easy to tell what the dependencies between the different patch
> series are.

Yes I understand.

This series does not depend on any other. It is not related to any 
pending changes.

It may have trivial conflicts with the other 26 patches series but it 
would be the case for any submissions posted by someone else anyway.
diff mbox series

Patch

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index b4c68410c158..4e1a83987b99 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -383,11 +383,6 @@  static void handle_thermal_trip(struct thermal_zone_device *tz, int trip)
 		handle_critical_trips(tz, trip, trip_temp, type);
 	else
 		handle_non_critical_trips(tz, trip);
-	/*
-	 * Alright, we handled this trip successfully.
-	 * So, start monitoring again.
-	 */
-	monitor_thermal_zone(tz);
 }
 
 static void update_temperature(struct thermal_zone_device *tz)
@@ -503,6 +498,8 @@  void thermal_zone_device_update(struct thermal_zone_device *tz,
 
 	for (count = 0; count < tz->num_trips; count++)
 		handle_thermal_trip(tz, count);
+
+	monitor_thermal_zone(tz);
 }
 EXPORT_SYMBOL_GPL(thermal_zone_device_update);