aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/msr.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/msr.c')
-rw-r--r--arch/x86/kernel/msr.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index 05266b5aae22..c9603ac80de5 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -259,14 +259,15 @@ static int __init msr_init(void)
259 goto out_chrdev; 259 goto out_chrdev;
260 } 260 }
261 msr_class->devnode = msr_devnode; 261 msr_class->devnode = msr_devnode;
262 get_online_cpus(); 262
263 cpu_notifier_register_begin();
263 for_each_online_cpu(i) { 264 for_each_online_cpu(i) {
264 err = msr_device_create(i); 265 err = msr_device_create(i);
265 if (err != 0) 266 if (err != 0)
266 goto out_class; 267 goto out_class;
267 } 268 }
268 register_hotcpu_notifier(&msr_class_cpu_notifier); 269 __register_hotcpu_notifier(&msr_class_cpu_notifier);
269 put_online_cpus(); 270 cpu_notifier_register_done();
270 271
271 err = 0; 272 err = 0;
272 goto out; 273 goto out;
@@ -275,7 +276,7 @@ out_class:
275 i = 0; 276 i = 0;
276 for_each_online_cpu(i) 277 for_each_online_cpu(i)
277 msr_device_destroy(i); 278 msr_device_destroy(i);
278 put_online_cpus(); 279 cpu_notifier_register_done();
279 class_destroy(msr_class); 280 class_destroy(msr_class);
280out_chrdev: 281out_chrdev:
281 __unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr"); 282 __unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr");
@@ -286,13 +287,14 @@ out:
286static void __exit msr_exit(void) 287static void __exit msr_exit(void)
287{ 288{
288 int cpu = 0; 289 int cpu = 0;
289 get_online_cpus(); 290
291 cpu_notifier_register_begin();
290 for_each_online_cpu(cpu) 292 for_each_online_cpu(cpu)
291 msr_device_destroy(cpu); 293 msr_device_destroy(cpu);
292 class_destroy(msr_class); 294 class_destroy(msr_class);
293 __unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr"); 295 __unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr");
294 unregister_hotcpu_notifier(&msr_class_cpu_notifier); 296 __unregister_hotcpu_notifier(&msr_class_cpu_notifier);
295 put_online_cpus(); 297 cpu_notifier_register_done();
296} 298}
297 299
298module_init(msr_init); 300module_init(msr_init);