diff options
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 27 | ||||
-rw-r--r-- | include/linux/cpufreq.h | 3 |
2 files changed, 22 insertions, 8 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 418522f88f73..65ac58511228 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1484,17 +1484,30 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, | |||
1484 | unsigned int event) | 1484 | unsigned int event) |
1485 | { | 1485 | { |
1486 | int ret; | 1486 | int ret; |
1487 | struct cpufreq_governor *gov = CPUFREQ_PERFORMANCE_GOVERNOR; | 1487 | |
1488 | /* Only must be defined when default governor is known to have latency | ||
1489 | restrictions, like e.g. conservative or ondemand. | ||
1490 | That this is the case is already ensured in Kconfig | ||
1491 | */ | ||
1492 | #ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE | ||
1493 | struct cpufreq_governor *gov = &cpufreq_gov_performance; | ||
1494 | #else | ||
1495 | struct cpufreq_governor *gov = NULL; | ||
1496 | #endif | ||
1488 | 1497 | ||
1489 | if (policy->governor->max_transition_latency && | 1498 | if (policy->governor->max_transition_latency && |
1490 | policy->cpuinfo.transition_latency > | 1499 | policy->cpuinfo.transition_latency > |
1491 | policy->governor->max_transition_latency) { | 1500 | policy->governor->max_transition_latency) { |
1492 | printk(KERN_WARNING "%s governor failed, too long" | 1501 | if (!gov) |
1493 | " transition latency of HW, fallback" | 1502 | return -EINVAL; |
1494 | " to %s governor\n", | 1503 | else { |
1495 | policy->governor->name, | 1504 | printk(KERN_WARNING "%s governor failed, too long" |
1496 | gov->name); | 1505 | " transition latency of HW, fallback" |
1497 | policy->governor = gov; | 1506 | " to %s governor\n", |
1507 | policy->governor->name, | ||
1508 | gov->name); | ||
1509 | policy->governor = gov; | ||
1510 | } | ||
1498 | } | 1511 | } |
1499 | 1512 | ||
1500 | if (!try_module_get(policy->governor->owner)) | 1513 | if (!try_module_get(policy->governor->owner)) |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 9e5f5d0c87f3..450a841b5892 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -286,8 +286,9 @@ static inline unsigned int cpufreq_quick_get(unsigned int cpu) | |||
286 | Performance governor is fallback governor if any other gov failed to | 286 | Performance governor is fallback governor if any other gov failed to |
287 | auto load due latency restrictions | 287 | auto load due latency restrictions |
288 | */ | 288 | */ |
289 | #ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE | ||
289 | extern struct cpufreq_governor cpufreq_gov_performance; | 290 | extern struct cpufreq_governor cpufreq_gov_performance; |
290 | #define CPUFREQ_PERFORMANCE_GOVERNOR (&cpufreq_gov_performance) | 291 | #endif |
291 | #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE | 292 | #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE |
292 | #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance) | 293 | #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance) |
293 | #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE) | 294 | #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE) |