diff mbox series

[v1,1/6] cpufreq: intel_pstate: Fold intel_pstate_max_within_limits() into caller

Message ID 3297274.aeNJFYEL58@kreacher (mailing list archive)
State In Next
Delegated to: Rafael Wysocki
Headers show
Series intel_pstate: Turbo disabled handling rework | expand

Commit Message

Rafael J. Wysocki March 25, 2024, 5:01 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Fold intel_pstate_max_within_limits() into its only caller.

No functional impact.

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

Comments

srinivas pandruvada April 1, 2024, 8:06 p.m. UTC | #1
On Mon, 2024-03-25 at 18:01 +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Fold intel_pstate_max_within_limits() into its only caller.
> 
> No functional impact.
> 
> 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 |   13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> Index: linux-pm/drivers/cpufreq/intel_pstate.c
> ===================================================================
> --- linux-pm.orig/drivers/cpufreq/intel_pstate.c
> +++ linux-pm/drivers/cpufreq/intel_pstate.c
> @@ -2012,14 +2012,6 @@ static void intel_pstate_set_min_pstate(
>         intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate);
>  }
>  
> -static void intel_pstate_max_within_limits(struct cpudata *cpu)
> -{
> -       int pstate = max(cpu->pstate.min_pstate, cpu-
> >max_perf_ratio);
> -
> -       update_turbo_state();
> -       intel_pstate_set_pstate(cpu, pstate);
> -}
> -
>  static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
>  {
>         int perf_ctl_max_phys = pstate_funcs.get_max_physical(cpu-
> >cpu);
> @@ -2594,12 +2586,15 @@ static int intel_pstate_set_policy(struc
>         intel_pstate_update_perf_limits(cpu, policy->min, policy-
> >max);
>  
>         if (cpu->policy == CPUFREQ_POLICY_PERFORMANCE) {
> +               int pstate = max(cpu->pstate.min_pstate, cpu-
> >max_perf_ratio);
> +
>                 /*
>                  * NOHZ_FULL CPUs need this as the governor callback
> may not
>                  * be invoked on them.
>                  */
>                 intel_pstate_clear_update_util_hook(policy->cpu);
> -               intel_pstate_max_within_limits(cpu);
> +               update_turbo_state();
> +               intel_pstate_set_pstate(cpu, pstate);
>         } else {
>                 intel_pstate_set_update_util_hook(policy->cpu);
>         }
> 
> 
>
diff mbox series

Patch

Index: linux-pm/drivers/cpufreq/intel_pstate.c
===================================================================
--- linux-pm.orig/drivers/cpufreq/intel_pstate.c
+++ linux-pm/drivers/cpufreq/intel_pstate.c
@@ -2012,14 +2012,6 @@  static void intel_pstate_set_min_pstate(
 	intel_pstate_set_pstate(cpu, cpu->pstate.min_pstate);
 }
 
-static void intel_pstate_max_within_limits(struct cpudata *cpu)
-{
-	int pstate = max(cpu->pstate.min_pstate, cpu->max_perf_ratio);
-
-	update_turbo_state();
-	intel_pstate_set_pstate(cpu, pstate);
-}
-
 static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
 {
 	int perf_ctl_max_phys = pstate_funcs.get_max_physical(cpu->cpu);
@@ -2594,12 +2586,15 @@  static int intel_pstate_set_policy(struc
 	intel_pstate_update_perf_limits(cpu, policy->min, policy->max);
 
 	if (cpu->policy == CPUFREQ_POLICY_PERFORMANCE) {
+		int pstate = max(cpu->pstate.min_pstate, cpu->max_perf_ratio);
+
 		/*
 		 * NOHZ_FULL CPUs need this as the governor callback may not
 		 * be invoked on them.
 		 */
 		intel_pstate_clear_update_util_hook(policy->cpu);
-		intel_pstate_max_within_limits(cpu);
+		update_turbo_state();
+		intel_pstate_set_pstate(cpu, pstate);
 	} else {
 		intel_pstate_set_update_util_hook(policy->cpu);
 	}