Skip to contentSkip to conversation

intel_pstate: Simplify conditional in intel_pstate_set_policy()

PATCH In review Rafael J. Wysocki 2 participants 2 messages May 11, 2016 – May 13, 2016

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

PATCH 1/1 intel_pstate: Simplify conditional in intel_pstate_set_policy()

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

One of the if () statements in intel_pstate_set_policy() causes another if () to be evaluated if the condition is true and it doesn't do anything else, so merge the two if () statements into one.

No functional changes.

---
 drivers/cpufreq/intel_pstate.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/cpufreq/intel_pstate.c +5 -6
Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
@@ -1449,12 +1449,11 @@ static int intel_pstate_set_policy(struc
 	intel_pstate_clear_update_util_hook(policy->cpu);
 
 	cpu = all_cpu_data[0];
-	if (cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate) {
-		if (policy->max < policy->cpuinfo.max_freq &&
-		    policy->max > cpu->pstate.max_pstate * cpu->pstate.scaling) {
-			pr_debug("policy->max > max non turbo frequency\n");
-			policy->max = policy->cpuinfo.max_freq;
-		}
+	if (cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate &&
+	    policy->max < policy->cpuinfo.max_freq &&
+	    policy->max > cpu->pstate.max_pstate * cpu->pstate.scaling) {
+		pr_debug("policy->max > max non turbo frequency\n");
+		policy->max = policy->cpuinfo.max_freq;
 	}
 
 	if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) {
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Rafael J. Wysocki

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

One of the if () statements in intel_pstate_set_policy() causes another if () to be evaluated if the condition is true and it doesn't do anything else, so merge the two if () statements into one.

No functional changes.

Quoted 37 lines

---
 drivers/cpufreq/intel_pstate.c |   11 +++++------

 1 file changed, 5 insertions(+), 6 deletions(-)

Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================

drivers/cpufreq/intel_pstate.c +0 -0
@@ -1449,12 +1449,11 @@ static int intel_pstate_set_policy(struc
  	intel_pstate_clear_update_util_hook(policy->cpu);


  cpu = all_cpu_data[0];

drivers/cpufreq/intel_pstate.c +0 -1
-	if (cpu->pstate.max_pstate_physical > cpu-
Quoted 1 line

pstate.max_pstate) {

drivers/cpufreq/intel_pstate.c +0 -2
-		if (policy->max < policy->cpuinfo.max_freq &&
-		    policy->max > cpu->pstate.max_pstate * cpu-
Quoted 1 line

pstate.scaling) {

drivers/cpufreq/intel_pstate.c +0 -1
-			pr_debug("policy->max > max non turbo

frequency\n");

drivers/cpufreq/intel_pstate.c +1 -2
-			policy->max = policy->cpuinfo.max_freq;
-		}
+	if (cpu->pstate.max_pstate_physical > cpu->pstate.max_pstate 

&&

drivers/cpufreq/intel_pstate.c +2 -0
+	    policy->max < policy->cpuinfo.max_freq &&
+	    policy->max > cpu->pstate.max_pstate * cpu-
Quoted 1 line

pstate.scaling) {

drivers/cpufreq/intel_pstate.c +2 -0
+		pr_debug("policy->max > max non turbo frequency\n");
+		policy->max = policy->cpuinfo.max_freq;

  }

  if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) {

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html