NFS: Save padding bytes in struct nfs4_setclientid
[safe/jmp/linux-2.6] / fs / char_dev.c
index 2c7a8b5..3cb7cda 100644 (file)
@@ -55,7 +55,6 @@ static struct char_device_struct {
        unsigned int baseminor;
        int minorct;
        char name[64];
-       struct file_operations *fops;
        struct cdev *cdev;              /* will die */
 } *chrdevs[CHRDEV_MAJOR_HASH_SIZE];
 
@@ -357,7 +356,7 @@ void cdev_put(struct cdev *p)
 /*
  * Called every time a character special file is opened
  */
-int chrdev_open(struct inode * inode, struct file * filp)
+static int chrdev_open(struct inode *inode, struct file *filp)
 {
        struct cdev *p;
        struct cdev *new = NULL;
@@ -374,6 +373,8 @@ int chrdev_open(struct inode * inode, struct file * filp)
                        return -ENXIO;
                new = container_of(kobj, struct cdev, kobj);
                spin_lock(&cdev_lock);
+               /* Check i_cdev again in case somebody beat us to it while
+                  we dropped the lock. */
                p = inode->i_cdev;
                if (!p) {
                        inode->i_cdev = p = new;
@@ -393,11 +394,8 @@ int chrdev_open(struct inode * inode, struct file * filp)
                cdev_put(p);
                return -ENXIO;
        }
-       if (filp->f_op->open) {
-               lock_kernel();
+       if (filp->f_op->open)
                ret = filp->f_op->open(inode,filp);
-               unlock_kernel();
-       }
        if (ret)
                cdev_put(p);
        return ret;