diff options
Diffstat (limited to 'drivers/cpufreq/intel_pstate.c')
-rw-r--r-- | drivers/cpufreq/intel_pstate.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index d4ed0022b0dd..7bfb98380db9 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -670,21 +670,18 @@ static ssize_t store_energy_performance_preference( | |||
670 | { | 670 | { |
671 | struct cpudata *cpu_data = all_cpu_data[policy->cpu]; | 671 | struct cpudata *cpu_data = all_cpu_data[policy->cpu]; |
672 | char str_preference[21]; | 672 | char str_preference[21]; |
673 | int ret, i = 0; | 673 | int ret; |
674 | 674 | ||
675 | ret = sscanf(buf, "%20s", str_preference); | 675 | ret = sscanf(buf, "%20s", str_preference); |
676 | if (ret != 1) | 676 | if (ret != 1) |
677 | return -EINVAL; | 677 | return -EINVAL; |
678 | 678 | ||
679 | while (energy_perf_strings[i] != NULL) { | 679 | ret = match_string(energy_perf_strings, -1, str_preference); |
680 | if (!strcmp(str_preference, energy_perf_strings[i])) { | 680 | if (ret < 0) |
681 | intel_pstate_set_energy_pref_index(cpu_data, i); | 681 | return ret; |
682 | return count; | ||
683 | } | ||
684 | ++i; | ||
685 | } | ||
686 | 682 | ||
687 | return -EINVAL; | 683 | intel_pstate_set_energy_pref_index(cpu_data, ret); |
684 | return count; | ||
688 | } | 685 | } |
689 | 686 | ||
690 | static ssize_t show_energy_performance_preference( | 687 | static ssize_t show_energy_performance_preference( |
@@ -2085,6 +2082,15 @@ static int __intel_pstate_cpu_init(struct cpufreq_policy *policy) | |||
2085 | cpu->pstate.max_pstate : cpu->pstate.turbo_pstate; | 2082 | cpu->pstate.max_pstate : cpu->pstate.turbo_pstate; |
2086 | policy->cpuinfo.max_freq *= cpu->pstate.scaling; | 2083 | policy->cpuinfo.max_freq *= cpu->pstate.scaling; |
2087 | 2084 | ||
2085 | if (hwp_active) { | ||
2086 | unsigned int max_freq; | ||
2087 | |||
2088 | max_freq = global.turbo_disabled ? | ||
2089 | cpu->pstate.max_freq : cpu->pstate.turbo_freq; | ||
2090 | if (max_freq < policy->cpuinfo.max_freq) | ||
2091 | policy->cpuinfo.max_freq = max_freq; | ||
2092 | } | ||
2093 | |||
2088 | intel_pstate_init_acpi_perf_limits(policy); | 2094 | intel_pstate_init_acpi_perf_limits(policy); |
2089 | 2095 | ||
2090 | policy->fast_switch_possible = true; | 2096 | policy->fast_switch_possible = true; |