diff options
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 109d62ccf651..346906a96e8b 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -36,13 +36,6 @@ static struct cpufreq_policy *cpufreq_cpu_data[NR_CPUS]; | |||
36 | static DEFINE_SPINLOCK(cpufreq_driver_lock); | 36 | static DEFINE_SPINLOCK(cpufreq_driver_lock); |
37 | 37 | ||
38 | 38 | ||
39 | /* we keep a copy of all ->add'ed CPU's struct sys_device here; | ||
40 | * as it is only accessed in ->add and ->remove, no lock or reference | ||
41 | * count is necessary. | ||
42 | */ | ||
43 | static struct sys_device *cpu_sys_devices[NR_CPUS]; | ||
44 | |||
45 | |||
46 | /* internal prototypes */ | 39 | /* internal prototypes */ |
47 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event); | 40 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event); |
48 | static void handle_update(void *data); | 41 | static void handle_update(void *data); |
@@ -582,7 +575,6 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
582 | * CPU because it is in the same boat. */ | 575 | * CPU because it is in the same boat. */ |
583 | policy = cpufreq_cpu_get(cpu); | 576 | policy = cpufreq_cpu_get(cpu); |
584 | if (unlikely(policy)) { | 577 | if (unlikely(policy)) { |
585 | cpu_sys_devices[cpu] = sys_dev; | ||
586 | dprintk("CPU already managed, adding link\n"); | 578 | dprintk("CPU already managed, adding link\n"); |
587 | sysfs_create_link(&sys_dev->kobj, &policy->kobj, "cpufreq"); | 579 | sysfs_create_link(&sys_dev->kobj, &policy->kobj, "cpufreq"); |
588 | cpufreq_debug_enable_ratelimit(); | 580 | cpufreq_debug_enable_ratelimit(); |
@@ -657,7 +649,6 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
657 | } | 649 | } |
658 | 650 | ||
659 | module_put(cpufreq_driver->owner); | 651 | module_put(cpufreq_driver->owner); |
660 | cpu_sys_devices[cpu] = sys_dev; | ||
661 | dprintk("initialization complete\n"); | 652 | dprintk("initialization complete\n"); |
662 | cpufreq_debug_enable_ratelimit(); | 653 | cpufreq_debug_enable_ratelimit(); |
663 | 654 | ||
@@ -698,6 +689,7 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) | |||
698 | unsigned int cpu = sys_dev->id; | 689 | unsigned int cpu = sys_dev->id; |
699 | unsigned long flags; | 690 | unsigned long flags; |
700 | struct cpufreq_policy *data; | 691 | struct cpufreq_policy *data; |
692 | struct sys_device *cpu_sys_dev; | ||
701 | #ifdef CONFIG_SMP | 693 | #ifdef CONFIG_SMP |
702 | unsigned int j; | 694 | unsigned int j; |
703 | #endif | 695 | #endif |
@@ -710,7 +702,6 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) | |||
710 | 702 | ||
711 | if (!data) { | 703 | if (!data) { |
712 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 704 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
713 | cpu_sys_devices[cpu] = NULL; | ||
714 | cpufreq_debug_enable_ratelimit(); | 705 | cpufreq_debug_enable_ratelimit(); |
715 | return -EINVAL; | 706 | return -EINVAL; |
716 | } | 707 | } |
@@ -725,14 +716,12 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) | |||
725 | dprintk("removing link\n"); | 716 | dprintk("removing link\n"); |
726 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 717 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
727 | sysfs_remove_link(&sys_dev->kobj, "cpufreq"); | 718 | sysfs_remove_link(&sys_dev->kobj, "cpufreq"); |
728 | cpu_sys_devices[cpu] = NULL; | ||
729 | cpufreq_cpu_put(data); | 719 | cpufreq_cpu_put(data); |
730 | cpufreq_debug_enable_ratelimit(); | 720 | cpufreq_debug_enable_ratelimit(); |
731 | return 0; | 721 | return 0; |
732 | } | 722 | } |
733 | #endif | 723 | #endif |
734 | 724 | ||
735 | cpu_sys_devices[cpu] = NULL; | ||
736 | 725 | ||
737 | if (!kobject_get(&data->kobj)) { | 726 | if (!kobject_get(&data->kobj)) { |
738 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 727 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
@@ -761,7 +750,8 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) | |||
761 | if (j == cpu) | 750 | if (j == cpu) |
762 | continue; | 751 | continue; |
763 | dprintk("removing link for cpu %u\n", j); | 752 | dprintk("removing link for cpu %u\n", j); |
764 | sysfs_remove_link(&cpu_sys_devices[j]->kobj, "cpufreq"); | 753 | cpu_sys_dev = get_cpu_sysdev(j); |
754 | sysfs_remove_link(&cpu_sys_dev->kobj, "cpufreq"); | ||
765 | cpufreq_cpu_put(data); | 755 | cpufreq_cpu_put(data); |
766 | } | 756 | } |
767 | } | 757 | } |