Skip to contentSkip to conversation

thermal: intel: powerclamp: Simplify idle_inject_update()

PATCH Superseded Thorsten Blum 1 participant 1 message Aug 28 Thermal

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: intel: powerclamp: Simplify idle_inject_update()

Drop the local update variable and call idle_inject_set_duration() directly instead. Also return !should_skip directly.

---
 drivers/thermal/intel/intel_powerclamp.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/thermal/intel/intel_powerclamp.c +2 -12
index bd7fd98dc310..c693cea4c526 100644
@@ -536,23 +536,16 @@ static struct idle_inject_device *ii_dev;
  */
 static bool idle_inject_update(void)
 {
-	bool update = false;
-
 	/* We can't sleep in this callback */
 	if (!mutex_trylock(&powerclamp_lock))
 		return true;
 
 	if (!(powerclamp_data.count % powerclamp_data.window_size_now)) {
+		unsigned int runtime = get_run_time();
 
 		should_skip = powerclamp_adjust_controls(powerclamp_data.target_ratio,
 							 powerclamp_data.guard,
 							 powerclamp_data.window_size_now);
-		update = true;
-	}
-
-	if (update) {
-		unsigned int runtime = get_run_time();
-
 		idle_inject_set_duration(ii_dev, runtime, duration);
 	}
 
@@ -560,10 +553,7 @@ static bool idle_inject_update(void)
 
 	mutex_unlock(&powerclamp_lock);
 
-	if (should_skip)
-		return false;
-
-	return true;
+	return !should_skip;
 }
 
 /* This function starts idle injection by calling idle_inject_start() */