diff options
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 8 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_stats.c | 4 | ||||
-rw-r--r-- | include/linux/cpu.h | 6 | ||||
-rw-r--r-- | kernel/cpu.c | 8 |
4 files changed, 18 insertions, 8 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 486ef6664708..3533e26f837d 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1497,7 +1497,8 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1497 | } | 1497 | } |
1498 | EXPORT_SYMBOL(cpufreq_update_policy); | 1498 | EXPORT_SYMBOL(cpufreq_update_policy); |
1499 | 1499 | ||
1500 | static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb, | 1500 | #ifdef CONFIG_HOTPLUG_CPU |
1501 | static int cpufreq_cpu_callback(struct notifier_block *nfb, | ||
1501 | unsigned long action, void *hcpu) | 1502 | unsigned long action, void *hcpu) |
1502 | { | 1503 | { |
1503 | unsigned int cpu = (unsigned long)hcpu; | 1504 | unsigned int cpu = (unsigned long)hcpu; |
@@ -1536,6 +1537,7 @@ static struct notifier_block cpufreq_cpu_notifier = | |||
1536 | { | 1537 | { |
1537 | .notifier_call = cpufreq_cpu_callback, | 1538 | .notifier_call = cpufreq_cpu_callback, |
1538 | }; | 1539 | }; |
1540 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
1539 | 1541 | ||
1540 | /********************************************************************* | 1542 | /********************************************************************* |
1541 | * REGISTER / UNREGISTER CPUFREQ DRIVER * | 1543 | * REGISTER / UNREGISTER CPUFREQ DRIVER * |
@@ -1596,7 +1598,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
1596 | } | 1598 | } |
1597 | 1599 | ||
1598 | if (!ret) { | 1600 | if (!ret) { |
1599 | register_cpu_notifier(&cpufreq_cpu_notifier); | 1601 | register_hotcpu_notifier(&cpufreq_cpu_notifier); |
1600 | dprintk("driver %s up and running\n", driver_data->name); | 1602 | dprintk("driver %s up and running\n", driver_data->name); |
1601 | cpufreq_debug_enable_ratelimit(); | 1603 | cpufreq_debug_enable_ratelimit(); |
1602 | } | 1604 | } |
@@ -1628,7 +1630,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) | |||
1628 | dprintk("unregistering driver %s\n", driver->name); | 1630 | dprintk("unregistering driver %s\n", driver->name); |
1629 | 1631 | ||
1630 | sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); | 1632 | sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); |
1631 | unregister_cpu_notifier(&cpufreq_cpu_notifier); | 1633 | unregister_hotcpu_notifier(&cpufreq_cpu_notifier); |
1632 | 1634 | ||
1633 | spin_lock_irqsave(&cpufreq_driver_lock, flags); | 1635 | spin_lock_irqsave(&cpufreq_driver_lock, flags); |
1634 | cpufreq_driver = NULL; | 1636 | cpufreq_driver = NULL; |
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index c576c0b3f452..145061b8472a 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -350,7 +350,7 @@ __init cpufreq_stats_init(void) | |||
350 | return ret; | 350 | return ret; |
351 | } | 351 | } |
352 | 352 | ||
353 | register_cpu_notifier(&cpufreq_stat_cpu_notifier); | 353 | register_hotcpu_notifier(&cpufreq_stat_cpu_notifier); |
354 | lock_cpu_hotplug(); | 354 | lock_cpu_hotplug(); |
355 | for_each_online_cpu(cpu) { | 355 | for_each_online_cpu(cpu) { |
356 | cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, CPU_ONLINE, | 356 | cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, CPU_ONLINE, |
@@ -368,7 +368,7 @@ __exit cpufreq_stats_exit(void) | |||
368 | CPUFREQ_POLICY_NOTIFIER); | 368 | CPUFREQ_POLICY_NOTIFIER); |
369 | cpufreq_unregister_notifier(¬ifier_trans_block, | 369 | cpufreq_unregister_notifier(¬ifier_trans_block, |
370 | CPUFREQ_TRANSITION_NOTIFIER); | 370 | CPUFREQ_TRANSITION_NOTIFIER); |
371 | unregister_cpu_notifier(&cpufreq_stat_cpu_notifier); | 371 | unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); |
372 | lock_cpu_hotplug(); | 372 | lock_cpu_hotplug(); |
373 | for_each_online_cpu(cpu) { | 373 | for_each_online_cpu(cpu) { |
374 | cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, CPU_DEAD, | 374 | cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, CPU_DEAD, |
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index b23bf1c8addc..cdfe471a70a1 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -41,7 +41,13 @@ struct notifier_block; | |||
41 | #ifdef CONFIG_SMP | 41 | #ifdef CONFIG_SMP |
42 | /* Need to know about CPUs going up/down? */ | 42 | /* Need to know about CPUs going up/down? */ |
43 | extern int register_cpu_notifier(struct notifier_block *nb); | 43 | extern int register_cpu_notifier(struct notifier_block *nb); |
44 | #ifdef CONFIG_HOTPLUG_CPU | ||
44 | extern void unregister_cpu_notifier(struct notifier_block *nb); | 45 | extern void unregister_cpu_notifier(struct notifier_block *nb); |
46 | #else | ||
47 | static inline void unregister_cpu_notifier(struct notifier_block *nb) | ||
48 | { | ||
49 | } | ||
50 | #endif | ||
45 | extern int current_in_cpu_hotplug(void); | 51 | extern int current_in_cpu_hotplug(void); |
46 | 52 | ||
47 | int cpu_up(unsigned int cpu); | 53 | int cpu_up(unsigned int cpu); |
diff --git a/kernel/cpu.c b/kernel/cpu.c index 03dcd981846a..70fbf2e83766 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -18,7 +18,7 @@ | |||
18 | /* This protects CPUs going up and down... */ | 18 | /* This protects CPUs going up and down... */ |
19 | static DEFINE_MUTEX(cpucontrol); | 19 | static DEFINE_MUTEX(cpucontrol); |
20 | 20 | ||
21 | static BLOCKING_NOTIFIER_HEAD(cpu_chain); | 21 | static __cpuinitdata BLOCKING_NOTIFIER_HEAD(cpu_chain); |
22 | 22 | ||
23 | #ifdef CONFIG_HOTPLUG_CPU | 23 | #ifdef CONFIG_HOTPLUG_CPU |
24 | static struct task_struct *lock_cpu_hotplug_owner; | 24 | static struct task_struct *lock_cpu_hotplug_owner; |
@@ -69,10 +69,13 @@ EXPORT_SYMBOL_GPL(lock_cpu_hotplug_interruptible); | |||
69 | #endif /* CONFIG_HOTPLUG_CPU */ | 69 | #endif /* CONFIG_HOTPLUG_CPU */ |
70 | 70 | ||
71 | /* Need to know about CPUs going up/down? */ | 71 | /* Need to know about CPUs going up/down? */ |
72 | int register_cpu_notifier(struct notifier_block *nb) | 72 | int __cpuinit register_cpu_notifier(struct notifier_block *nb) |
73 | { | 73 | { |
74 | return blocking_notifier_chain_register(&cpu_chain, nb); | 74 | return blocking_notifier_chain_register(&cpu_chain, nb); |
75 | } | 75 | } |
76 | |||
77 | #ifdef CONFIG_HOTPLUG_CPU | ||
78 | |||
76 | EXPORT_SYMBOL(register_cpu_notifier); | 79 | EXPORT_SYMBOL(register_cpu_notifier); |
77 | 80 | ||
78 | void unregister_cpu_notifier(struct notifier_block *nb) | 81 | void unregister_cpu_notifier(struct notifier_block *nb) |
@@ -81,7 +84,6 @@ void unregister_cpu_notifier(struct notifier_block *nb) | |||
81 | } | 84 | } |
82 | EXPORT_SYMBOL(unregister_cpu_notifier); | 85 | EXPORT_SYMBOL(unregister_cpu_notifier); |
83 | 86 | ||
84 | #ifdef CONFIG_HOTPLUG_CPU | ||
85 | static inline void check_for_tasks(int cpu) | 87 | static inline void check_for_tasks(int cpu) |
86 | { | 88 | { |
87 | struct task_struct *p; | 89 | struct task_struct *p; |