Skip to contentSkip to conversation

cpufreq: schedutil: Simplify sugov_update_next_freq()

PATCH In review Rafael J. Wysocki 2 participants 2 messages Nov 12, 2020 – Nov 17, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: schedutil: Simplify sugov_update_next_freq()

From: Rafael J. Wysocki <[email protected]>

Rearrange a conditional to make it more straightforward.

---
 kernel/sched/cpufreq_schedutil.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
kernel/sched/cpufreq_schedutil.c +3 -5
Index: linux-pm/kernel/sched/cpufreq_schedutil.c
===================================================================
@@ -102,12 +102,10 @@ static bool sugov_should_update_freq(str
 static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time,
 				   unsigned int next_freq)
 {
-	if (!sg_policy->need_freq_update) {
-		if (sg_policy->next_freq == next_freq)
-			return false;
-	} else {
+	if (sg_policy->need_freq_update)
 		sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS);
-	}
+	else if (sg_policy->next_freq == next_freq)
+		return false;
 
 	sg_policy->next_freq = next_freq;
 	sg_policy->last_freq_update_time = time;
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 20 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Rearrange a conditional to make it more straightforward.

---
 kernel/sched/cpufreq_schedutil.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Index: linux-pm/kernel/sched/cpufreq_schedutil.c
===================================================================

kernel/sched/cpufreq_schedutil.c +0 -2
@@ -102,12 +102,10 @@ static bool sugov_should_update_freq(str
 static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time,
 				   unsigned int next_freq)
 {
-	if (!sg_policy->need_freq_update) {
-		if (sg_policy->next_freq == next_freq)

kernel/sched/cpufreq_schedutil.c static bool sugov_should_update_freq(str · line 111

Quoted 10 lines
kernel/sched/cpufreq_schedutil.c +3 -3
-			return false;
-	} else {
+	if (sg_policy->need_freq_update)
 		sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS);
-	}
+	else if (sg_policy->next_freq == next_freq)
+		return false;
 
 	sg_policy->next_freq = next_freq;
 	sg_policy->last_freq_update_time = time;
Signature · 1 line
viresh