diff options
Diffstat (limited to 'include/linux/cpu.h')
| -rw-r--r-- | include/linux/cpu.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 4d668e05d458..47536197ffdd 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
| @@ -48,6 +48,15 @@ struct notifier_block; | |||
| 48 | 48 | ||
| 49 | #ifdef CONFIG_SMP | 49 | #ifdef CONFIG_SMP |
| 50 | /* Need to know about CPUs going up/down? */ | 50 | /* Need to know about CPUs going up/down? */ |
| 51 | #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) | ||
| 52 | #define cpu_notifier(fn, pri) { \ | ||
| 53 | static struct notifier_block fn##_nb __cpuinitdata = \ | ||
| 54 | { .notifier_call = fn, .priority = pri }; \ | ||
| 55 | register_cpu_notifier(&fn##_nb); \ | ||
| 56 | } | ||
| 57 | #else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */ | ||
| 58 | #define cpu_notifier(fn, pri) do { (void)(fn); } while (0) | ||
| 59 | #endif /* #else #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */ | ||
| 51 | #ifdef CONFIG_HOTPLUG_CPU | 60 | #ifdef CONFIG_HOTPLUG_CPU |
| 52 | extern int register_cpu_notifier(struct notifier_block *nb); | 61 | extern int register_cpu_notifier(struct notifier_block *nb); |
| 53 | extern void unregister_cpu_notifier(struct notifier_block *nb); | 62 | extern void unregister_cpu_notifier(struct notifier_block *nb); |
| @@ -74,6 +83,8 @@ extern void cpu_maps_update_done(void); | |||
| 74 | 83 | ||
| 75 | #else /* CONFIG_SMP */ | 84 | #else /* CONFIG_SMP */ |
| 76 | 85 | ||
| 86 | #define cpu_notifier(fn, pri) do { (void)(fn); } while (0) | ||
| 87 | |||
| 77 | static inline int register_cpu_notifier(struct notifier_block *nb) | 88 | static inline int register_cpu_notifier(struct notifier_block *nb) |
| 78 | { | 89 | { |
| 79 | return 0; | 90 | return 0; |
| @@ -99,11 +110,7 @@ extern struct sysdev_class cpu_sysdev_class; | |||
| 99 | 110 | ||
| 100 | extern void get_online_cpus(void); | 111 | extern void get_online_cpus(void); |
| 101 | extern void put_online_cpus(void); | 112 | extern void put_online_cpus(void); |
| 102 | #define hotcpu_notifier(fn, pri) { \ | 113 | #define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri) |
| 103 | static struct notifier_block fn##_nb __cpuinitdata = \ | ||
| 104 | { .notifier_call = fn, .priority = pri }; \ | ||
| 105 | register_cpu_notifier(&fn##_nb); \ | ||
| 106 | } | ||
| 107 | #define register_hotcpu_notifier(nb) register_cpu_notifier(nb) | 114 | #define register_hotcpu_notifier(nb) register_cpu_notifier(nb) |
| 108 | #define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) | 115 | #define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) |
| 109 | int cpu_down(unsigned int cpu); | 116 | int cpu_down(unsigned int cpu); |
