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.h30
1 files changed, 21 insertions, 9 deletions
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 08d50c53aab..3fef7d67aed 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -31,18 +31,23 @@ struct cpu {
31 struct sys_device sysdev; 31 struct sys_device sysdev;
32}; 32};
33 33
34extern int register_cpu(struct cpu *, int, struct node *); 34extern int register_cpu(struct cpu *cpu, int num);
35extern struct sys_device *get_cpu_sysdev(unsigned cpu); 35extern struct sys_device *get_cpu_sysdev(unsigned cpu);
36#ifdef CONFIG_HOTPLUG_CPU 36#ifdef CONFIG_HOTPLUG_CPU
37extern void unregister_cpu(struct cpu *, struct node *); 37extern void unregister_cpu(struct cpu *cpu);
38#endif 38#endif
39struct notifier_block; 39struct notifier_block;
40 40
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? */
43extern int register_cpu_notifier(struct notifier_block *nb); 43extern int register_cpu_notifier(struct notifier_block *nb);
44#ifdef CONFIG_HOTPLUG_CPU
44extern void unregister_cpu_notifier(struct notifier_block *nb); 45extern void unregister_cpu_notifier(struct notifier_block *nb);
45extern int current_in_cpu_hotplug(void); 46#else
47static inline void unregister_cpu_notifier(struct notifier_block *nb)
48{
49}
50#endif
46 51
47int cpu_up(unsigned int cpu); 52int cpu_up(unsigned int cpu);
48 53
@@ -55,10 +60,6 @@ static inline int register_cpu_notifier(struct notifier_block *nb)
55static inline void unregister_cpu_notifier(struct notifier_block *nb) 60static inline void unregister_cpu_notifier(struct notifier_block *nb)
56{ 61{
57} 62}
58static inline int current_in_cpu_hotplug(void)
59{
60 return 0;
61}
62 63
63#endif /* CONFIG_SMP */ 64#endif /* CONFIG_SMP */
64extern struct sysdev_class cpu_sysdev_class; 65extern struct sysdev_class cpu_sysdev_class;
@@ -67,22 +68,33 @@ extern struct sysdev_class cpu_sysdev_class;
67/* Stop CPUs going up and down. */ 68/* Stop CPUs going up and down. */
68extern void lock_cpu_hotplug(void); 69extern void lock_cpu_hotplug(void);
69extern void unlock_cpu_hotplug(void); 70extern void unlock_cpu_hotplug(void);
70extern int lock_cpu_hotplug_interruptible(void);
71#define hotcpu_notifier(fn, pri) { \ 71#define hotcpu_notifier(fn, pri) { \
72 static struct notifier_block fn##_nb = \ 72 static struct notifier_block fn##_nb = \
73 { .notifier_call = fn, .priority = pri }; \ 73 { .notifier_call = fn, .priority = pri }; \
74 register_cpu_notifier(&fn##_nb); \ 74 register_cpu_notifier(&fn##_nb); \
75} 75}
76#define register_hotcpu_notifier(nb) register_cpu_notifier(nb)
77#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
76int cpu_down(unsigned int cpu); 78int cpu_down(unsigned int cpu);
77#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) 79#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
78#else 80#else
79#define lock_cpu_hotplug() do { } while (0) 81#define lock_cpu_hotplug() do { } while (0)
80#define unlock_cpu_hotplug() do { } while (0) 82#define unlock_cpu_hotplug() do { } while (0)
81#define lock_cpu_hotplug_interruptible() 0 83#define lock_cpu_hotplug_interruptible() 0
82#define hotcpu_notifier(fn, pri) 84#define hotcpu_notifier(fn, pri) do { } while (0)
85#define register_hotcpu_notifier(nb) do { } while (0)
86#define unregister_hotcpu_notifier(nb) do { } while (0)
83 87
84/* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */ 88/* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */
85static inline int cpu_is_offline(int cpu) { return 0; } 89static inline int cpu_is_offline(int cpu) { return 0; }
86#endif 90#endif
87 91
92#ifdef CONFIG_SUSPEND_SMP
93extern int disable_nonboot_cpus(void);
94extern void enable_nonboot_cpus(void);
95#else
96static inline int disable_nonboot_cpus(void) { return 0; }
97static inline void enable_nonboot_cpus(void) {}
98#endif
99
88#endif /* _LINUX_CPU_H_ */ 100#endif /* _LINUX_CPU_H_ */