]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] Export cpu notifiers and do locking.
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 18 Mar 2004 05:30:19 +0000 (21:30 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 18 Mar 2004 05:30:19 +0000 (21:30 -0800)
The registration and unregistration of CPU notifiers should be done
under the cpucontrol sem.  They should also be exported.

kernel/cpu.c

index 027e1997f81c8fda8fd9a46dbdb12daf6f3a9bef..06adc11d9f90e2ee2286b4c1a3156c0d07925590 100644 (file)
@@ -19,13 +19,23 @@ static struct notifier_block *cpu_chain;
 /* Need to know about CPUs going up/down? */
 int register_cpu_notifier(struct notifier_block *nb)
 {
-       return notifier_chain_register(&cpu_chain, nb);
+       int ret;
+
+       if ((ret = down_interruptible(&cpucontrol)) != 0)
+               return ret;
+       ret = notifier_chain_register(&cpu_chain, nb);
+       up(&cpucontrol);
+       return ret;
 }
+EXPORT_SYMBOL(register_cpu_notifier);
 
 void unregister_cpu_notifier(struct notifier_block *nb)
 {
-       notifier_chain_unregister(&cpu_chain,nb);
+       down(&cpucontrol);
+       notifier_chain_unregister(&cpu_chain, nb);
+       up(&cpucontrol);
 }
+EXPORT_SYMBOL(unregister_cpu_notifier);
 
 int __devinit cpu_up(unsigned int cpu)
 {