[PATCH v1 5/6] thermal: gov_step_wise: Fold update_passive_instance() into its caller

Rafael J. Wysocki posted 6 patches 2 years, 3 months ago
There is a newer version of this series
[PATCH v1 5/6] thermal: gov_step_wise: Fold update_passive_instance() into its caller
Posted by Rafael J. Wysocki 2 years, 3 months ago
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Fold update_passive_instance() into thermal_zone_trip_update() that is
its only caller so as to make the code in question easeir to follow.

No intentional functional impact.

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

Index: linux-pm/drivers/thermal/gov_step_wise.c
===================================================================
--- linux-pm.orig/drivers/thermal/gov_step_wise.c
+++ linux-pm/drivers/thermal/gov_step_wise.c
@@ -68,17 +68,6 @@ static unsigned long get_target_state(st
 	return next_target;
 }
 
-static void update_passive_instance(struct thermal_zone_device *tz,
-				enum thermal_trip_type type, int value)
-{
-	/*
-	 * If value is +1, activate a passive instance.
-	 * If value is -1, deactivate a passive instance.
-	 */
-	if (type == THERMAL_TRIP_PASSIVE)
-		tz->passive += value;
-}
-
 static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id)
 {
 	const struct thermal_trip *trip = &tz->trips[trip_id];
@@ -109,14 +98,17 @@ static void thermal_zone_trip_update(str
 		if (instance->initialized && old_target == instance->target)
 			continue;
 
-		/* Activate a passive thermal instance */
 		if (old_target == THERMAL_NO_TARGET &&
-			instance->target != THERMAL_NO_TARGET)
-			update_passive_instance(tz, trip->type, 1);
-		/* Deactivate a passive thermal instance */
-		else if (old_target != THERMAL_NO_TARGET &&
-			instance->target == THERMAL_NO_TARGET)
-			update_passive_instance(tz, trip->type, -1);
+		    instance->target != THERMAL_NO_TARGET) {
+			/* Activate a passive thermal instance */
+			if (trip->type == THERMAL_TRIP_PASSIVE)
+				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)
+				tz->passive--;
+		}
 
 		instance->initialized = true;
 		mutex_lock(&instance->cdev->lock);
Re: [PATCH v1 5/6] thermal: gov_step_wise: Fold update_passive_instance() into its caller
Posted by Lukasz Luba 2 years, 2 months ago

On 10/6/23 18:49, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Fold update_passive_instance() into thermal_zone_trip_update() that is
> its only caller so as to make the code in question easeir to follow.

s/easeir/easier/

> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>   drivers/thermal/gov_step_wise.c |   28 ++++++++++------------------
>   1 file changed, 10 insertions(+), 18 deletions(-)
> 

other than that LGTM:

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Re: [PATCH v1 5/6] thermal: gov_step_wise: Fold update_passive_instance() into its caller
Posted by Rafael J. Wysocki 2 years, 2 months ago
On Fri, Oct 20, 2023 at 6:16 PM Lukasz Luba <lukasz.luba@arm.com> wrote:
>
>
>
> On 10/6/23 18:49, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > Fold update_passive_instance() into thermal_zone_trip_update() that is
> > its only caller so as to make the code in question easeir to follow.
>
> s/easeir/easier/

I'll fix this in the tree.

> >
> > No intentional functional impact.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> >   drivers/thermal/gov_step_wise.c |   28 ++++++++++------------------
> >   1 file changed, 10 insertions(+), 18 deletions(-)
> >
>
> other than that LGTM:
>
> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

Thank you!
Re: [PATCH v1 5/6] thermal: gov_step_wise: Fold update_passive_instance() into its caller
Posted by Daniel Lezcano 2 years, 2 months ago
On 06/10/2023 19:49, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Fold update_passive_instance() into thermal_zone_trip_update() that is
> its only caller so as to make the code in question easeir to follow.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---

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


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog