Merge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[pandora-kernel.git] / arch / x86 / kernel / msr.c
index 1f3abe0..9fd8095 100644 (file)
@@ -117,12 +117,20 @@ static int msr_open(struct inode *inode, struct file *file)
 {
        unsigned int cpu = iminor(file->f_path.dentry->d_inode);
        struct cpuinfo_x86 *c = &cpu_data(cpu);
+       int ret = 0;
 
-       if (cpu >= NR_CPUS || !cpu_online(cpu))
-               return -ENXIO;  /* No such CPU */
-       if (!cpu_has(c, X86_FEATURE_MSR))
-               return -EIO;    /* MSR not supported */
+       lock_kernel();
+       cpu = iminor(file->f_path.dentry->d_inode);
 
+       if (cpu >= NR_CPUS || !cpu_online(cpu)) {
+               ret = -ENXIO;   /* No such CPU */
+               goto out;
+       }
+       c = &cpu_data(cpu);
+       if (!cpu_has(c, X86_FEATURE_MSR))
+               ret = -EIO;     /* MSR not supported */
+out:
+       unlock_kernel();
        return 0;
 }
 
@@ -141,8 +149,8 @@ static int __cpuinit msr_device_create(int cpu)
 {
        struct device *dev;
 
-       dev = device_create(msr_class, NULL, MKDEV(MSR_MAJOR, cpu),
-                           "msr%d", cpu);
+       dev = device_create_drvdata(msr_class, NULL, MKDEV(MSR_MAJOR, cpu),
+                                   NULL, "msr%d", cpu);
        return IS_ERR(dev) ? PTR_ERR(dev) : 0;
 }