cpufreq "cpu group" awareness: save sysdev for all CPUs
PATCH 2/4 cpufreq "cpu group" awareness: save sysdev for all CPUs
Save a copy of each CPU's struct sys_device in drivers/cpufreq/cpufreq.c so that symlinks can be removed even outside the specific sys_device's ->remove() function.
Signed-off-by Dominik Brodowski <[email protected]>
drivers/cpufreq/cpufreq.c | 11 +++++++++++ 1 files changed, 11 insertions(+)
drivers/cpufreq/cpufreq.c +11 -0
@@ -33,6 +33,14 @@static struct cpufreq_policy *cpufreq_cpu_data[NR_CPUS ];static spinlock_t cpufreq_driver_lock =SPIN_LOCK_UNLOCKED ; + +/* we keep a copy of all ->add'ed CPU's struct sys_device here; +* as it is only accessed in ->add and ->remove, no lock or reference +* count is necessary. +*/ +static struct sys_device *cpu_sys_devices[NR_CPUS ]; + +/* internal prototypes */ static int __cpufreq_governor (struct cpufreq_policy *policy,unsigned int event);static void handle_update (void *data);
@@ -517,6 +525,7 @@ goto err_out_unregister;module_put (cpufreq_driver->owner); + cpu_sys_devices[cpu] = sys_dev;return 0 ;
@@ -548,6 +557,8 @@unsigned long flags;struct cpufreq_policy *data; + cpu_sys_devices[cpu] =NULL ; +spin_lock_irqsave (&cpufreq_driver_lock, flags); data = cpufreq_cpu_data[cpu];