Commit d5a2a6bb authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

cpufreq: intel_pstate: Consolidate policy verification

There is still some code duplication between intel_pstate_verify_policy()
and intel_cpufreq_verify_policy(), so avoid it by moving the common
code into a separate function and calling it from both these places.

No intentional functional impact.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 2c523b34
...@@ -2155,15 +2155,19 @@ static void intel_pstate_adjust_policy_max(struct cpudata *cpu, ...@@ -2155,15 +2155,19 @@ static void intel_pstate_adjust_policy_max(struct cpudata *cpu,
} }
} }
static int intel_pstate_verify_policy(struct cpufreq_policy_data *policy) static void intel_pstate_verify_cpu_policy(struct cpudata *cpu,
struct cpufreq_policy_data *policy)
{ {
struct cpudata *cpu = all_cpu_data[policy->cpu];
update_turbo_state(); update_turbo_state();
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
intel_pstate_get_max_freq(cpu)); intel_pstate_get_max_freq(cpu));
intel_pstate_adjust_policy_max(cpu, policy); intel_pstate_adjust_policy_max(cpu, policy);
}
static int intel_pstate_verify_policy(struct cpufreq_policy_data *policy)
{
intel_pstate_verify_cpu_policy(all_cpu_data[policy->cpu], policy);
return 0; return 0;
} }
...@@ -2268,12 +2272,7 @@ static int intel_cpufreq_verify_policy(struct cpufreq_policy_data *policy) ...@@ -2268,12 +2272,7 @@ static int intel_cpufreq_verify_policy(struct cpufreq_policy_data *policy)
{ {
struct cpudata *cpu = all_cpu_data[policy->cpu]; struct cpudata *cpu = all_cpu_data[policy->cpu];
update_turbo_state(); intel_pstate_verify_cpu_policy(cpu, policy);
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
intel_pstate_get_max_freq(cpu));
intel_pstate_adjust_policy_max(cpu, policy);
intel_pstate_update_perf_limits(cpu, policy->min, policy->max); intel_pstate_update_perf_limits(cpu, policy->min, policy->max);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment