aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpuid.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/cpuid.c')
-rw-r--r--arch/x86/kernel/cpuid.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 7d9481c743f8..3225ae6c5180 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -198,14 +198,15 @@ static int __init cpuid_init(void)
198 goto out_chrdev; 198 goto out_chrdev;
199 } 199 }
200 cpuid_class->devnode = cpuid_devnode; 200 cpuid_class->devnode = cpuid_devnode;
201 get_online_cpus(); 201
202 cpu_notifier_register_begin();
202 for_each_online_cpu(i) { 203 for_each_online_cpu(i) {
203 err = cpuid_device_create(i); 204 err = cpuid_device_create(i);
204 if (err != 0) 205 if (err != 0)
205 goto out_class; 206 goto out_class;
206 } 207 }
207 register_hotcpu_notifier(&cpuid_class_cpu_notifier); 208 __register_hotcpu_notifier(&cpuid_class_cpu_notifier);
208 put_online_cpus(); 209 cpu_notifier_register_done();
209 210
210 err = 0; 211 err = 0;
211 goto out; 212 goto out;
@@ -215,7 +216,7 @@ out_class:
215 for_each_online_cpu(i) { 216 for_each_online_cpu(i) {
216 cpuid_device_destroy(i); 217 cpuid_device_destroy(i);
217 } 218 }
218 put_online_cpus(); 219 cpu_notifier_register_done();
219 class_destroy(cpuid_class); 220 class_destroy(cpuid_class);
220out_chrdev: 221out_chrdev:
221 __unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid"); 222 __unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid");
@@ -227,13 +228,13 @@ static void __exit cpuid_exit(void)
227{ 228{
228 int cpu = 0; 229 int cpu = 0;
229 230
230 get_online_cpus(); 231 cpu_notifier_register_begin();
231 for_each_online_cpu(cpu) 232 for_each_online_cpu(cpu)
232 cpuid_device_destroy(cpu); 233 cpuid_device_destroy(cpu);
233 class_destroy(cpuid_class); 234 class_destroy(cpuid_class);
234 __unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid"); 235 __unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid");
235 unregister_hotcpu_notifier(&cpuid_class_cpu_notifier); 236 __unregister_hotcpu_notifier(&cpuid_class_cpu_notifier);
236 put_online_cpus(); 237 cpu_notifier_register_done();
237} 238}
238 239
239module_init(cpuid_init); 240module_init(cpuid_init);