linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] intel_pstate: Simplify conditional in intel_pstate_set_policy()
@ 2016-05-11 22:46 Rafael J. Wysocki
  2016-05-13  0:36 ` Srinivas Pandruvada
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael J. Wysocki @ 2016-05-11 22:46 UTC (permalink / raw)
  To: Linux PM list, Srinivas Pandruvada; +Cc: Linux Kernel Mailing List

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) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] intel_pstate: Simplify conditional in intel_pstate_set_policy()
  2016-05-11 22:46 [PATCH] intel_pstate: Simplify conditional in intel_pstate_set_policy() Rafael J. Wysocki
@ 2016-05-13  0:36 ` Srinivas Pandruvada
  0 siblings, 0 replies; 2+ messages in thread
From: Srinivas Pandruvada @ 2016-05-13  0:36 UTC (permalink / raw)
  To: Rafael J. Wysocki, Linux PM list; +Cc: Linux Kernel Mailing List

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-13  0:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-11 22:46 [PATCH] intel_pstate: Simplify conditional in intel_pstate_set_policy() Rafael J. Wysocki
2016-05-13  0:36 ` Srinivas Pandruvada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).