
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.



 drivers/cpufreq/proc_intf.c |    3 +++
 include/linux/cpufreq.h     |    3 +++
 kernel/cpufreq.c            |    4 +++-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff -puN drivers/cpufreq/proc_intf.c~cpufreq-oops-fix drivers/cpufreq/proc_intf.c
--- 25/drivers/cpufreq/proc_intf.c~cpufreq-oops-fix	2003-05-12 21:23:15.000000000 -0700
+++ 25-akpm/drivers/cpufreq/proc_intf.c	2003-05-12 21:23:15.000000000 -0700
@@ -209,6 +209,9 @@ static int __init cpufreq_proc_init (voi
 {
 	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 -puN include/linux/cpufreq.h~cpufreq-oops-fix include/linux/cpufreq.h
--- 25/include/linux/cpufreq.h~cpufreq-oops-fix	2003-05-12 21:23:15.000000000 -0700
+++ 25-akpm/include/linux/cpufreq.h	2003-05-12 21:23:15.000000000 -0700
@@ -311,4 +311,7 @@ void cpufreq_frequency_table_put_attr(un
 
 #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 -puN kernel/cpufreq.c~cpufreq-oops-fix kernel/cpufreq.c
--- 25/kernel/cpufreq.c~cpufreq-oops-fix	2003-05-12 21:23:15.000000000 -0700
+++ 25-akpm/kernel/cpufreq.c	2003-05-12 21:23:15.000000000 -0700
@@ -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 

_
