提交 7c7165c9 编写于 作者: C Chandra Seetharaman 提交者: Linus Torvalds

[PATCH] cpu hotplug: fix hotplug cpu documentation for proper usage

Update hotplug cpu documentation to clearly state when to use
register_cpu_notifier() and register_hotcpu_notifier.
Signed-off-by: NChandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 8c78f307
...@@ -251,16 +251,24 @@ A: This is what you would need in your kernel code to receive notifications. ...@@ -251,16 +251,24 @@ A: This is what you would need in your kernel code to receive notifications.
return NOTIFY_OK; return NOTIFY_OK;
} }
static struct notifier_block foobar_cpu_notifer = static struct notifier_block __cpuinitdata foobar_cpu_notifer =
{ {
.notifier_call = foobar_cpu_callback, .notifier_call = foobar_cpu_callback,
}; };
You need to call register_cpu_notifier() from your init function.
Init functions could be of two types:
1. early init (init function called when only the boot processor is online).
2. late init (init function called _after_ all the CPUs are online).
In your init function, For the first case, you should add the following to your init function
register_cpu_notifier(&foobar_cpu_notifier); register_cpu_notifier(&foobar_cpu_notifier);
For the second case, you should add the following to your init function
register_hotcpu_notifier(&foobar_cpu_notifier);
You can fail PREPARE notifiers if something doesn't work to prepare resources. You can fail PREPARE notifiers if something doesn't work to prepare resources.
This will stop the activity and send a following CANCELED event back. This will stop the activity and send a following CANCELED event back.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册