aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/cpu.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/cpu.h')
-rw-r--r--include/linux/cpu.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 03e962e23eaf..81887120395c 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -115,26 +115,46 @@ enum {
115 { .notifier_call = fn, .priority = pri }; \ 115 { .notifier_call = fn, .priority = pri }; \
116 register_cpu_notifier(&fn##_nb); \ 116 register_cpu_notifier(&fn##_nb); \
117} 117}
118
119#define __cpu_notifier(fn, pri) { \
120 static struct notifier_block fn##_nb = \
121 { .notifier_call = fn, .priority = pri }; \
122 __register_cpu_notifier(&fn##_nb); \
123}
118#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */ 124#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */
119#define cpu_notifier(fn, pri) do { (void)(fn); } while (0) 125#define cpu_notifier(fn, pri) do { (void)(fn); } while (0)
126#define __cpu_notifier(fn, pri) do { (void)(fn); } while (0)
120#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */ 127#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */
128
121#ifdef CONFIG_HOTPLUG_CPU 129#ifdef CONFIG_HOTPLUG_CPU
122extern int register_cpu_notifier(struct notifier_block *nb); 130extern int register_cpu_notifier(struct notifier_block *nb);
131extern int __register_cpu_notifier(struct notifier_block *nb);
123extern void unregister_cpu_notifier(struct notifier_block *nb); 132extern void unregister_cpu_notifier(struct notifier_block *nb);
133extern void __unregister_cpu_notifier(struct notifier_block *nb);
124#else 134#else
125 135
126#ifndef MODULE 136#ifndef MODULE
127extern int register_cpu_notifier(struct notifier_block *nb); 137extern int register_cpu_notifier(struct notifier_block *nb);
138extern int __register_cpu_notifier(struct notifier_block *nb);
128#else 139#else
129static inline int register_cpu_notifier(struct notifier_block *nb) 140static inline int register_cpu_notifier(struct notifier_block *nb)
130{ 141{
131 return 0; 142 return 0;
132} 143}
144
145static inline int __register_cpu_notifier(struct notifier_block *nb)
146{
147 return 0;
148}
133#endif 149#endif
134 150
135static inline void unregister_cpu_notifier(struct notifier_block *nb) 151static inline void unregister_cpu_notifier(struct notifier_block *nb)
136{ 152{
137} 153}
154
155static inline void __unregister_cpu_notifier(struct notifier_block *nb)
156{
157}
138#endif 158#endif
139 159
140int cpu_up(unsigned int cpu); 160int cpu_up(unsigned int cpu);
@@ -142,19 +162,32 @@ void notify_cpu_starting(unsigned int cpu);
142extern void cpu_maps_update_begin(void); 162extern void cpu_maps_update_begin(void);
143extern void cpu_maps_update_done(void); 163extern void cpu_maps_update_done(void);
144 164
165#define cpu_notifier_register_begin cpu_maps_update_begin
166#define cpu_notifier_register_done cpu_maps_update_done
167
145#else /* CONFIG_SMP */ 168#else /* CONFIG_SMP */
146 169
147#define cpu_notifier(fn, pri) do { (void)(fn); } while (0) 170#define cpu_notifier(fn, pri) do { (void)(fn); } while (0)
171#define __cpu_notifier(fn, pri) do { (void)(fn); } while (0)
148 172
149static inline int register_cpu_notifier(struct notifier_block *nb) 173static inline int register_cpu_notifier(struct notifier_block *nb)
150{ 174{
151 return 0; 175 return 0;
152} 176}
153 177
178static inline int __register_cpu_notifier(struct notifier_block *nb)
179{
180 return 0;
181}
182
154static inline void unregister_cpu_notifier(struct notifier_block *nb) 183static inline void unregister_cpu_notifier(struct notifier_block *nb)
155{ 184{
156} 185}
157 186
187static inline void __unregister_cpu_notifier(struct notifier_block *nb)
188{
189}
190
158static inline void cpu_maps_update_begin(void) 191static inline void cpu_maps_update_begin(void)
159{ 192{
160} 193}
@@ -163,6 +196,14 @@ static inline void cpu_maps_update_done(void)
163{ 196{
164} 197}
165 198
199static inline void cpu_notifier_register_begin(void)
200{
201}
202
203static inline void cpu_notifier_register_done(void)
204{
205}
206
166#endif /* CONFIG_SMP */ 207#endif /* CONFIG_SMP */
167extern struct bus_type cpu_subsys; 208extern struct bus_type cpu_subsys;
168 209
@@ -176,8 +217,11 @@ extern void put_online_cpus(void);
176extern void cpu_hotplug_disable(void); 217extern void cpu_hotplug_disable(void);
177extern void cpu_hotplug_enable(void); 218extern void cpu_hotplug_enable(void);
178#define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri) 219#define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri)
220#define __hotcpu_notifier(fn, pri) __cpu_notifier(fn, pri)
179#define register_hotcpu_notifier(nb) register_cpu_notifier(nb) 221#define register_hotcpu_notifier(nb) register_cpu_notifier(nb)
222#define __register_hotcpu_notifier(nb) __register_cpu_notifier(nb)
180#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) 223#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
224#define __unregister_hotcpu_notifier(nb) __unregister_cpu_notifier(nb)
181void clear_tasks_mm_cpumask(int cpu); 225void clear_tasks_mm_cpumask(int cpu);
182int cpu_down(unsigned int cpu); 226int cpu_down(unsigned int cpu);
183 227
@@ -190,9 +234,12 @@ static inline void cpu_hotplug_done(void) {}
190#define cpu_hotplug_disable() do { } while (0) 234#define cpu_hotplug_disable() do { } while (0)
191#define cpu_hotplug_enable() do { } while (0) 235#define cpu_hotplug_enable() do { } while (0)
192#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0) 236#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
237#define __hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
193/* These aren't inline functions due to a GCC bug. */ 238/* These aren't inline functions due to a GCC bug. */
194#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; }) 239#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; })
240#define __register_hotcpu_notifier(nb) ({ (void)(nb); 0; })
195#define unregister_hotcpu_notifier(nb) ({ (void)(nb); }) 241#define unregister_hotcpu_notifier(nb) ({ (void)(nb); })
242#define __unregister_hotcpu_notifier(nb) ({ (void)(nb); })
196#endif /* CONFIG_HOTPLUG_CPU */ 243#endif /* CONFIG_HOTPLUG_CPU */
197 244
198#ifdef CONFIG_PM_SLEEP_SMP 245#ifdef CONFIG_PM_SLEEP_SMP