Linux 4.6-rc6
[cris-mirror.git] / include / linux / cpuhotplug.h
blob5d68e15e46b779d4cb0ff4613fd77d28403c72b5
1 #ifndef __CPUHOTPLUG_H
2 #define __CPUHOTPLUG_H
4 enum cpuhp_state {
5 CPUHP_OFFLINE,
6 CPUHP_CREATE_THREADS,
7 CPUHP_NOTIFY_PREPARE,
8 CPUHP_BRINGUP_CPU,
9 CPUHP_AP_IDLE_DEAD,
10 CPUHP_AP_OFFLINE,
11 CPUHP_AP_NOTIFY_STARTING,
12 CPUHP_AP_ONLINE,
13 CPUHP_TEARDOWN_CPU,
14 CPUHP_AP_ONLINE_IDLE,
15 CPUHP_AP_SMPBOOT_THREADS,
16 CPUHP_AP_NOTIFY_ONLINE,
17 CPUHP_AP_ONLINE_DYN,
18 CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30,
19 CPUHP_ONLINE,
22 int __cpuhp_setup_state(enum cpuhp_state state, const char *name, bool invoke,
23 int (*startup)(unsigned int cpu),
24 int (*teardown)(unsigned int cpu));
26 /**
27 * cpuhp_setup_state - Setup hotplug state callbacks with calling the callbacks
28 * @state: The state for which the calls are installed
29 * @name: Name of the callback (will be used in debug output)
30 * @startup: startup callback function
31 * @teardown: teardown callback function
33 * Installs the callback functions and invokes the startup callback on
34 * the present cpus which have already reached the @state.
36 static inline int cpuhp_setup_state(enum cpuhp_state state,
37 const char *name,
38 int (*startup)(unsigned int cpu),
39 int (*teardown)(unsigned int cpu))
41 return __cpuhp_setup_state(state, name, true, startup, teardown);
44 /**
45 * cpuhp_setup_state_nocalls - Setup hotplug state callbacks without calling the
46 * callbacks
47 * @state: The state for which the calls are installed
48 * @name: Name of the callback.
49 * @startup: startup callback function
50 * @teardown: teardown callback function
52 * Same as @cpuhp_setup_state except that no calls are executed are invoked
53 * during installation of this callback. NOP if SMP=n or HOTPLUG_CPU=n.
55 static inline int cpuhp_setup_state_nocalls(enum cpuhp_state state,
56 const char *name,
57 int (*startup)(unsigned int cpu),
58 int (*teardown)(unsigned int cpu))
60 return __cpuhp_setup_state(state, name, false, startup, teardown);
63 void __cpuhp_remove_state(enum cpuhp_state state, bool invoke);
65 /**
66 * cpuhp_remove_state - Remove hotplug state callbacks and invoke the teardown
67 * @state: The state for which the calls are removed
69 * Removes the callback functions and invokes the teardown callback on
70 * the present cpus which have already reached the @state.
72 static inline void cpuhp_remove_state(enum cpuhp_state state)
74 __cpuhp_remove_state(state, true);
77 /**
78 * cpuhp_remove_state_nocalls - Remove hotplug state callbacks without invoking
79 * teardown
80 * @state: The state for which the calls are removed
82 static inline void cpuhp_remove_state_nocalls(enum cpuhp_state state)
84 __cpuhp_remove_state(state, false);
87 #ifdef CONFIG_SMP
88 void cpuhp_online_idle(enum cpuhp_state state);
89 #else
90 static inline void cpuhp_online_idle(enum cpuhp_state state) { }
91 #endif
93 #endif