summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-03-27 18:20:13 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-03-28 17:12:16 -0400
commit8ca6ce37014e5a9b127fc076448eb95e2b366d05 (patch)
tree5e4c5992213ef14d8c1178ac17a095be1b08bbdf /drivers/cpufreq
parent2f49afc2a6f6ec4bacb2e50d5482ecc111b41ab5 (diff)
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.c16
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[] = {
1893 {} 1893 {}
1894}; 1894};
1895 1895
1896static bool pid_in_use(void);
1897
1896static int intel_pstate_init_cpu(unsigned int cpunum) 1898static int intel_pstate_init_cpu(unsigned int cpunum)
1897{ 1899{
1898 struct cpudata *cpu; 1900 struct cpudata *cpu;
@@ -1923,7 +1925,7 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
1923 intel_pstate_disable_ee(cpunum); 1925 intel_pstate_disable_ee(cpunum);
1924 1926
1925 intel_pstate_hwp_enable(cpu); 1927 intel_pstate_hwp_enable(cpu);
1926 } else if (pstate_funcs.update_util == intel_pstate_update_util_pid) { 1928 } else if (pid_in_use()) {
1927 intel_pstate_pid_reset(cpu); 1929 intel_pstate_pid_reset(cpu);
1928 } 1930 }
1929 1931
@@ -2269,6 +2271,12 @@ static struct cpufreq_driver intel_cpufreq = {
2269 2271
2270static struct cpufreq_driver *default_driver = &intel_pstate; 2272static struct cpufreq_driver *default_driver = &intel_pstate;
2271 2273
2274static bool pid_in_use(void)
2275{
2276 return intel_pstate_driver == &intel_pstate &&
2277 pstate_funcs.update_util == intel_pstate_update_util_pid;
2278}
2279
2272static void intel_pstate_driver_cleanup(void) 2280static void intel_pstate_driver_cleanup(void)
2273{ 2281{
2274 unsigned int cpu; 2282 unsigned int cpu;
@@ -2303,8 +2311,7 @@ static int intel_pstate_register_driver(struct cpufreq_driver *driver)
2303 2311
2304 global.min_perf_pct = min_perf_pct_min(); 2312 global.min_perf_pct = min_perf_pct_min();
2305 2313
2306 if (intel_pstate_driver == &intel_pstate && !hwp_active && 2314 if (pid_in_use())
2307 pstate_funcs.update_util == intel_pstate_update_util_pid)
2308 intel_pstate_debug_expose_params(); 2315 intel_pstate_debug_expose_params();
2309 2316
2310 return 0; 2317 return 0;
@@ -2315,8 +2322,7 @@ static int intel_pstate_unregister_driver(void)
2315 if (hwp_active) 2322 if (hwp_active)
2316 return -EBUSY; 2323 return -EBUSY;
2317 2324
2318 if (intel_pstate_driver == &intel_pstate && 2325 if (pid_in_use())
2319 pstate_funcs.update_util == intel_pstate_update_util_pid)
2320 intel_pstate_debug_hide_params(); 2326 intel_pstate_debug_hide_params();
2321 2327
2322 cpufreq_unregister_driver(intel_pstate_driver); 2328 cpufreq_unregister_driver(intel_pstate_driver);