Commit 281df9b3 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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.
parent ec2ecf30
...@@ -209,6 +209,9 @@ static int __init cpufreq_proc_init (void) ...@@ -209,6 +209,9 @@ static int __init cpufreq_proc_init (void)
{ {
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry = NULL;
if (!cpufreq_driver)
return -ENODEV;
/* are these acceptable values? */ /* are these acceptable values? */
entry = create_proc_entry("cpufreq", S_IFREG|S_IRUGO|S_IWUSR, entry = create_proc_entry("cpufreq", S_IFREG|S_IRUGO|S_IWUSR,
&proc_root); &proc_root);
......
...@@ -311,4 +311,7 @@ void cpufreq_frequency_table_put_attr(unsigned int cpu); ...@@ -311,4 +311,7 @@ void cpufreq_frequency_table_put_attr(unsigned int cpu);
#endif /* CONFIG_CPU_FREQ_TABLE */ #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 */ #endif /* _LINUX_CPUFREQ_H */
...@@ -29,9 +29,11 @@ ...@@ -29,9 +29,11 @@
* level driver of CPUFreq support, and its locking mutex. * level driver of CPUFreq support, and its locking mutex.
* cpu_max_freq is in kHz. * cpu_max_freq is in kHz.
*/ */
static struct cpufreq_driver *cpufreq_driver; struct cpufreq_driver *cpufreq_driver;
static DECLARE_MUTEX (cpufreq_driver_sem); 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 * Two notifier lists: the "policy" list is involved in the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment