NVMe: Only release requested regions
[linux-2.6-block.git] / include / linux / cpuhotplug.h
CommitLineData
cff7d378
TG
1#ifndef __CPUHOTPLUG_H
2#define __CPUHOTPLUG_H
3
4enum cpuhp_state {
5 CPUHP_OFFLINE,
6 CPUHP_CREATE_THREADS,
7 CPUHP_NOTIFY_PREPARE,
8 CPUHP_BRINGUP_CPU,
e69aab13 9 CPUHP_AP_IDLE_DEAD,
4baa0afc 10 CPUHP_AP_OFFLINE,
9cf7243d 11 CPUHP_AP_SCHED_STARTING,
4baa0afc
TG
12 CPUHP_AP_NOTIFY_STARTING,
13 CPUHP_AP_ONLINE,
14 CPUHP_TEARDOWN_CPU,
fc6d73d6 15 CPUHP_AP_ONLINE_IDLE,
1cf4f629
TG
16 CPUHP_AP_SMPBOOT_THREADS,
17 CPUHP_AP_NOTIFY_ONLINE,
18 CPUHP_AP_ONLINE_DYN,
19 CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30,
aaddd7d1 20 CPUHP_AP_ACTIVE,
cff7d378
TG
21 CPUHP_ONLINE,
22};
23
5b7aa87e
TG
24int __cpuhp_setup_state(enum cpuhp_state state, const char *name, bool invoke,
25 int (*startup)(unsigned int cpu),
26 int (*teardown)(unsigned int cpu));
27
28/**
29 * cpuhp_setup_state - Setup hotplug state callbacks with calling the callbacks
30 * @state: The state for which the calls are installed
31 * @name: Name of the callback (will be used in debug output)
32 * @startup: startup callback function
33 * @teardown: teardown callback function
34 *
35 * Installs the callback functions and invokes the startup callback on
36 * the present cpus which have already reached the @state.
37 */
38static inline int cpuhp_setup_state(enum cpuhp_state state,
39 const char *name,
40 int (*startup)(unsigned int cpu),
41 int (*teardown)(unsigned int cpu))
42{
43 return __cpuhp_setup_state(state, name, true, startup, teardown);
44}
45
46/**
47 * cpuhp_setup_state_nocalls - Setup hotplug state callbacks without calling the
48 * callbacks
49 * @state: The state for which the calls are installed
50 * @name: Name of the callback.
51 * @startup: startup callback function
52 * @teardown: teardown callback function
53 *
54 * Same as @cpuhp_setup_state except that no calls are executed are invoked
55 * during installation of this callback. NOP if SMP=n or HOTPLUG_CPU=n.
56 */
57static inline int cpuhp_setup_state_nocalls(enum cpuhp_state state,
58 const char *name,
59 int (*startup)(unsigned int cpu),
60 int (*teardown)(unsigned int cpu))
61{
62 return __cpuhp_setup_state(state, name, false, startup, teardown);
63}
64
65void __cpuhp_remove_state(enum cpuhp_state state, bool invoke);
66
67/**
68 * cpuhp_remove_state - Remove hotplug state callbacks and invoke the teardown
69 * @state: The state for which the calls are removed
70 *
71 * Removes the callback functions and invokes the teardown callback on
72 * the present cpus which have already reached the @state.
73 */
74static inline void cpuhp_remove_state(enum cpuhp_state state)
75{
76 __cpuhp_remove_state(state, true);
77}
78
79/**
80 * cpuhp_remove_state_nocalls - Remove hotplug state callbacks without invoking
81 * teardown
82 * @state: The state for which the calls are removed
83 */
84static inline void cpuhp_remove_state_nocalls(enum cpuhp_state state)
85{
86 __cpuhp_remove_state(state, false);
87}
88
8df3e07e
TG
89#ifdef CONFIG_SMP
90void cpuhp_online_idle(enum cpuhp_state state);
91#else
92static inline void cpuhp_online_idle(enum cpuhp_state state) { }
93#endif
94
cff7d378 95#endif