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.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index 553449951b84..206735ac8cbd 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -172,11 +172,10 @@ static long msr_ioctl(struct file *file, unsigned int ioc, unsigned long arg)
172 172
173static int msr_open(struct inode *inode, struct file *file) 173static int msr_open(struct inode *inode, struct file *file)
174{ 174{
175 unsigned int cpu = iminor(file->f_path.dentry->d_inode); 175 unsigned int cpu;
176 struct cpuinfo_x86 *c = &cpu_data(cpu); 176 struct cpuinfo_x86 *c;
177 177
178 cpu = iminor(file->f_path.dentry->d_inode); 178 cpu = iminor(file->f_path.dentry->d_inode);
179
180 if (cpu >= nr_cpu_ids || !cpu_online(cpu)) 179 if (cpu >= nr_cpu_ids || !cpu_online(cpu))
181 return -ENXIO; /* No such CPU */ 180 return -ENXIO; /* No such CPU */
182 181
@@ -247,7 +246,7 @@ static int __init msr_init(void)
247 int i, err = 0; 246 int i, err = 0;
248 i = 0; 247 i = 0;
249 248
250 if (register_chrdev(MSR_MAJOR, "cpu/msr", &msr_fops)) { 249 if (__register_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr", &msr_fops)) {
251 printk(KERN_ERR "msr: unable to get major %d for msr\n", 250 printk(KERN_ERR "msr: unable to get major %d for msr\n",
252 MSR_MAJOR); 251 MSR_MAJOR);
253 err = -EBUSY; 252 err = -EBUSY;
@@ -275,7 +274,7 @@ out_class:
275 msr_device_destroy(i); 274 msr_device_destroy(i);
276 class_destroy(msr_class); 275 class_destroy(msr_class);
277out_chrdev: 276out_chrdev:
278 unregister_chrdev(MSR_MAJOR, "cpu/msr"); 277 __unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr");
279out: 278out:
280 return err; 279 return err;
281} 280}
@@ -286,7 +285,7 @@ static void __exit msr_exit(void)
286 for_each_online_cpu(cpu) 285 for_each_online_cpu(cpu)
287 msr_device_destroy(cpu); 286 msr_device_destroy(cpu);
288 class_destroy(msr_class); 287 class_destroy(msr_class);
289 unregister_chrdev(MSR_MAJOR, "cpu/msr"); 288 __unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr");
290 unregister_hotcpu_notifier(&msr_class_cpu_notifier); 289 unregister_hotcpu_notifier(&msr_class_cpu_notifier);
291} 290}
292 291