summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2003-05-12 09:11:06 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2003-05-12 09:11:06 -0700
commit281df9b372d682a93f1fb4bdd9756d7601d50e0e (patch)
tree7ecb46fa05b72ca53b52ff4e32ffbd520a1fb330
parentec2ecf307ab06d4182d571e335eafb25bf080d4b (diff)
[PATCH] export cpufreq_driver to fix oops in proc interface
From: Zwane Mwaikambo <zwane@linuxpower.ca> The proc interface has no way of telling wether there is an active cpufreq driver or not. This means that if you don't have a cpufreq supported processor, this will oops in various possible places.
-rw-r--r--drivers/cpufreq/proc_intf.c3
-rw-r--r--include/linux/cpufreq.h3
-rw-r--r--kernel/cpufreq.c4
3 files changed, 9 insertions, 1 deletions
diff --git a/drivers/cpufreq/proc_intf.c b/drivers/cpufreq/proc_intf.c
index 5845e3404085..253dab930b06 100644
--- a/drivers/cpufreq/proc_intf.c
+++ b/drivers/cpufreq/proc_intf.c
@@ -209,6 +209,9 @@ static int __init cpufreq_proc_init (void)
{
struct proc_dir_entry *entry = NULL;
+ if (!cpufreq_driver)
+ return -ENODEV;
+
/* are these acceptable values? */
entry = create_proc_entry("cpufreq", S_IFREG|S_IRUGO|S_IWUSR,
&proc_root);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index e99b9c3c1d01..3dc9062bd414 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -311,4 +311,7 @@ void cpufreq_frequency_table_put_attr(unsigned int cpu);
#endif /* CONFIG_CPU_FREQ_TABLE */
+/* Currently exported only for the proc interface, remove when that goes */
+extern struct cpufreq_driver *cpufreq_driver;
+
#endif /* _LINUX_CPUFREQ_H */
diff --git a/kernel/cpufreq.c b/kernel/cpufreq.c
index 913e6b0f56fb..589bf0bf2093 100644
--- a/kernel/cpufreq.c
+++ b/kernel/cpufreq.c
@@ -29,9 +29,11 @@
* level driver of CPUFreq support, and its locking mutex.
* cpu_max_freq is in kHz.
*/
-static struct cpufreq_driver *cpufreq_driver;
+struct cpufreq_driver *cpufreq_driver;
static DECLARE_MUTEX (cpufreq_driver_sem);
+/* required for the proc interface, remove when that goes away */
+EXPORT_SYMBOL_GPL(cpufreq_driver);
/**
* Two notifier lists: the "policy" list is involved in the