Commit e09793bb authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] msr.c: use register_hotcpu_notifier()

register_cpu_notifier() cannot do anything in a module, in a
!CONFIG_HOTPLUG_CPU kernel.

Cc: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1017f6af
...@@ -251,7 +251,9 @@ static int msr_class_device_create(int i) ...@@ -251,7 +251,9 @@ static int msr_class_device_create(int i)
return err; return err;
} }
static int msr_class_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) #ifdef CONFIG_HOTPLUG_CPU
static int msr_class_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{ {
unsigned int cpu = (unsigned long)hcpu; unsigned int cpu = (unsigned long)hcpu;
...@@ -270,6 +272,7 @@ static struct notifier_block __cpuinitdata msr_class_cpu_notifier = ...@@ -270,6 +272,7 @@ static struct notifier_block __cpuinitdata msr_class_cpu_notifier =
{ {
.notifier_call = msr_class_cpu_callback, .notifier_call = msr_class_cpu_callback,
}; };
#endif
static int __init msr_init(void) static int __init msr_init(void)
{ {
...@@ -292,7 +295,7 @@ static int __init msr_init(void) ...@@ -292,7 +295,7 @@ static int __init msr_init(void)
if (err != 0) if (err != 0)
goto out_class; goto out_class;
} }
register_cpu_notifier(&msr_class_cpu_notifier); register_hotcpu_notifier(&msr_class_cpu_notifier);
err = 0; err = 0;
goto out; goto out;
...@@ -315,7 +318,7 @@ static void __exit msr_exit(void) ...@@ -315,7 +318,7 @@ static void __exit msr_exit(void)
class_device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu)); class_device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu));
class_destroy(msr_class); class_destroy(msr_class);
unregister_chrdev(MSR_MAJOR, "cpu/msr"); unregister_chrdev(MSR_MAJOR, "cpu/msr");
unregister_cpu_notifier(&msr_class_cpu_notifier); unregister_hotcpu_notifier(&msr_class_cpu_notifier);
} }
module_init(msr_init); module_init(msr_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment