Commit 6afde10c authored by Thomas Renninger's avatar Thomas Renninger Committed by Dave Jones

[CPUFREQ] Only check for transition latency on problematic governors (kconfig fix)

Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent 1c256245
...@@ -1484,11 +1484,23 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, ...@@ -1484,11 +1484,23 @@ static int __cpufreq_governor(struct cpufreq_policy *policy,
unsigned int event) unsigned int event)
{ {
int ret; int ret;
struct cpufreq_governor *gov = CPUFREQ_PERFORMANCE_GOVERNOR;
/* Only must be defined when default governor is known to have latency
restrictions, like e.g. conservative or ondemand.
That this is the case is already ensured in Kconfig
*/
#ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE
struct cpufreq_governor *gov = &cpufreq_gov_performance;
#else
struct cpufreq_governor *gov = NULL;
#endif
if (policy->governor->max_transition_latency && if (policy->governor->max_transition_latency &&
policy->cpuinfo.transition_latency > policy->cpuinfo.transition_latency >
policy->governor->max_transition_latency) { policy->governor->max_transition_latency) {
if (!gov)
return -EINVAL;
else {
printk(KERN_WARNING "%s governor failed, too long" printk(KERN_WARNING "%s governor failed, too long"
" transition latency of HW, fallback" " transition latency of HW, fallback"
" to %s governor\n", " to %s governor\n",
...@@ -1496,6 +1508,7 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, ...@@ -1496,6 +1508,7 @@ static int __cpufreq_governor(struct cpufreq_policy *policy,
gov->name); gov->name);
policy->governor = gov; policy->governor = gov;
} }
}
if (!try_module_get(policy->governor->owner)) if (!try_module_get(policy->governor->owner))
return -EINVAL; return -EINVAL;
......
...@@ -286,8 +286,9 @@ static inline unsigned int cpufreq_quick_get(unsigned int cpu) ...@@ -286,8 +286,9 @@ static inline unsigned int cpufreq_quick_get(unsigned int cpu)
Performance governor is fallback governor if any other gov failed to Performance governor is fallback governor if any other gov failed to
auto load due latency restrictions auto load due latency restrictions
*/ */
#ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE
extern struct cpufreq_governor cpufreq_gov_performance; extern struct cpufreq_governor cpufreq_gov_performance;
#define CPUFREQ_PERFORMANCE_GOVERNOR (&cpufreq_gov_performance) #endif
#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE
#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance) #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance)
#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE) #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE)
......
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