diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-03-28 00:20:13 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-03-28 23:12:16 +0200 |
commit | 8ca6ce37014e5a9b127fc076448eb95e2b366d05 (patch) | |
tree | 5e4c5992213ef14d8c1178ac17a095be1b08bbdf /drivers/cpufreq | |
parent | 2f49afc2a6f6ec4bacb2e50d5482ecc111b41ab5 (diff) | |
download | linux-8ca6ce37014e5a9b127fc076448eb95e2b366d05.tar.bz2 |
cpufreq: intel_pstate: Introduce pid_in_use()
Add a new function pid_in_use() to return the information on whether
or not the PID-based P-state selection algorithm is in use.
That allows a couple of complicated conditions in the code to be
reduced to simple checks against the new function's return value.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/intel_pstate.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index f8496faa1085..6384557cea69 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -1893,6 +1893,8 @@ static const struct x86_cpu_id intel_pstate_cpu_ee_disable_ids[] = { {} }; +static bool pid_in_use(void); + static int intel_pstate_init_cpu(unsigned int cpunum) { struct cpudata *cpu; @@ -1923,7 +1925,7 @@ static int intel_pstate_init_cpu(unsigned int cpunum) intel_pstate_disable_ee(cpunum); intel_pstate_hwp_enable(cpu); - } else if (pstate_funcs.update_util == intel_pstate_update_util_pid) { + } else if (pid_in_use()) { intel_pstate_pid_reset(cpu); } @@ -2269,6 +2271,12 @@ static struct cpufreq_driver intel_cpufreq = { static struct cpufreq_driver *default_driver = &intel_pstate; +static bool pid_in_use(void) +{ + return intel_pstate_driver == &intel_pstate && + pstate_funcs.update_util == intel_pstate_update_util_pid; +} + static void intel_pstate_driver_cleanup(void) { unsigned int cpu; @@ -2303,8 +2311,7 @@ static int intel_pstate_register_driver(struct cpufreq_driver *driver) global.min_perf_pct = min_perf_pct_min(); - if (intel_pstate_driver == &intel_pstate && !hwp_active && - pstate_funcs.update_util == intel_pstate_update_util_pid) + if (pid_in_use()) intel_pstate_debug_expose_params(); return 0; @@ -2315,8 +2322,7 @@ static int intel_pstate_unregister_driver(void) if (hwp_active) return -EBUSY; - if (intel_pstate_driver == &intel_pstate && - pstate_funcs.update_util == intel_pstate_update_util_pid) + if (pid_in_use()) intel_pstate_debug_hide_params(); cpufreq_unregister_driver(intel_pstate_driver); |