Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1399562 > unrolled thread

[PATCH] intel_pstate: Simplify conditional in intel_pstate_set_policy()

Started by"Rafael J. Wysocki" <rjw@rjwysocki.net>
First post2016-05-12 00:50 +0200
Last post2016-05-13 02:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] intel_pstate: Simplify conditional in intel_pstate_set_policy() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-05-12 00:50 +0200
    Re: [PATCH] intel_pstate: Simplify conditional in  intel_pstate_set_policy() Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2016-05-13 02:40 +0200

#1399562 — [PATCH] intel_pstate: Simplify conditional in intel_pstate_set_policy()

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2016-05-12 00:50 +0200
Subject[PATCH] intel_pstate: Simplify conditional in intel_pstate_set_policy()
Message-ID<rxL74-U4-25@gated-at.bofh.it>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

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.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpufreq/intel_pstate.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ 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) {

[toc] | [next] | [standalone]


#1400434 — Re: [PATCH] intel_pstate: Simplify conditional in intel_pstate_set_policy()

FromSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date2016-05-13 02:40 +0200
SubjectRe: [PATCH] intel_pstate: Simplify conditional in intel_pstate_set_policy()
Message-ID<ry9j4-pu-7@gated-at.bofh.it>
In reply to#1399562
On Thu, 2016-05-12 at 00:46 +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> 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.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

> ---
>  drivers/cpufreq/intel_pstate.c |   11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> Index: linux-pm/drivers/cpufreq/intel_pstate.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/intel_pstate.c
> +++ 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) {
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web