Commit 0c2e5915 authored by Dave Jones's avatar Dave Jones Committed by Dave Jones

[CPUFREQ][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: default avatarDominik Brodowski <linux@brodo.de>
Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent 1a8a3fc2
...@@ -33,6 +33,14 @@ static struct cpufreq_driver *cpufreq_driver; ...@@ -33,6 +33,14 @@ static struct cpufreq_driver *cpufreq_driver;
static struct cpufreq_policy *cpufreq_cpu_data[NR_CPUS]; static struct cpufreq_policy *cpufreq_cpu_data[NR_CPUS];
static spinlock_t cpufreq_driver_lock = SPIN_LOCK_UNLOCKED; 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 */ /* internal prototypes */
static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event); static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event);
static void handle_update(void *data); static void handle_update(void *data);
...@@ -517,6 +525,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) ...@@ -517,6 +525,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
goto err_out_unregister; goto err_out_unregister;
module_put(cpufreq_driver->owner); module_put(cpufreq_driver->owner);
cpu_sys_devices[cpu] = sys_dev;
return 0; return 0;
...@@ -548,6 +557,8 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) ...@@ -548,6 +557,8 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev)
unsigned long flags; unsigned long flags;
struct cpufreq_policy *data; struct cpufreq_policy *data;
cpu_sys_devices[cpu] = NULL;
spin_lock_irqsave(&cpufreq_driver_lock, flags); spin_lock_irqsave(&cpufreq_driver_lock, flags);
data = cpufreq_cpu_data[cpu]; data = cpufreq_cpu_data[cpu];
......
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