[CPUFREQ] [2/2] demand load governor modules.
authorJeremy Fitzhardinge <jeremy@goop.org>
Thu, 6 Jul 2006 19:32:01 +0000 (12:32 -0700)
committerDave Jones <davej@redhat.com>
Mon, 31 Jul 2006 22:37:06 +0000 (18:37 -0400)
Demand-load cpufreq governor modules if needed.

Signed-off-by: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Dave Jones <davej@redhat.com>
drivers/cpufreq/cpufreq.c

index 9b41637..b3df613 100644 (file)
@@ -321,6 +321,23 @@ static int cpufreq_parse_governor (char *str_governor, unsigned int *policy,
 
                t = __find_governor(str_governor);
 
+               if (t == NULL) {
+                       char *name = kasprintf(GFP_KERNEL, "cpufreq_%s", str_governor);
+
+                       if (name) {
+                               int ret;
+
+                               mutex_unlock(&cpufreq_governor_mutex);
+                               ret = request_module(name);
+                               mutex_lock(&cpufreq_governor_mutex);
+
+                               if (ret == 0)
+                                       t = __find_governor(str_governor);
+                       }
+
+                       kfree(name);
+               }
+
                if (t != NULL) {
                        *governor = t;
                        err = 0;