summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/cpufreq/cpufreq.c27
-rw-r--r--include/linux/cpufreq.h3
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,
unsigned int event)
{
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 &&
policy->cpuinfo.transition_latency >
policy->governor->max_transition_latency) {
- printk(KERN_WARNING "%s governor failed, too long"
- " transition latency of HW, fallback"
- " to %s governor\n",
- policy->governor->name,
- gov->name);
- policy->governor = gov;
+ if (!gov)
+ return -EINVAL;
+ else {
+ printk(KERN_WARNING "%s governor failed, too long"
+ " transition latency of HW, fallback"
+ " to %s governor\n",
+ policy->governor->name,
+ gov->name);
+ policy->governor = gov;
+ }
}
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)
Performance governor is fallback governor if any other gov failed to
auto load due latency restrictions
*/
+#ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE
extern struct cpufreq_governor cpufreq_gov_performance;
-#define CPUFREQ_PERFORMANCE_GOVERNOR (&cpufreq_gov_performance)
+#endif
#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE
#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance)
#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE)