thermal: gov_step_wise: Simplify checks related to passive trips
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 3 Apr 2024 18:12:02 +0000 (20:12 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 8 Apr 2024 13:57:50 +0000 (15:57 +0200)
Make it more clear from the code flow that the passive polling status
updates only take place for passive trip points.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
drivers/thermal/gov_step_wise.c

index aad98e06d66b9d42a6420fc67f24ec4415273c51..ee2fb4e63d1478a696dfcbadd66ab28367a2f388 100644 (file)
@@ -92,15 +92,13 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz,
                if (instance->initialized && old_target == instance->target)
                        continue;
 
-               if (old_target == THERMAL_NO_TARGET &&
-                   instance->target != THERMAL_NO_TARGET) {
-                       /* Activate a passive thermal instance */
-                       if (trip->type == THERMAL_TRIP_PASSIVE)
+               if (trip->type == THERMAL_TRIP_PASSIVE) {
+                       /* If needed, update the status of passive polling. */
+                       if (old_target == THERMAL_NO_TARGET &&
+                           instance->target != THERMAL_NO_TARGET)
                                tz->passive++;
-               } else if (old_target != THERMAL_NO_TARGET &&
-                          instance->target == THERMAL_NO_TARGET) {
-                       /* Deactivate a passive thermal instance */
-                       if (trip->type == THERMAL_TRIP_PASSIVE)
+                       else if (old_target != THERMAL_NO_TARGET &&
+                                instance->target == THERMAL_NO_TARGET)
                                tz->passive--;
                }