X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=fs%2Fchar_dev.c;h=3cb7cda3d780e95026142398f4c52cdf565d93b6;hb=6eaaaac97433575894570a990aa27310040a8177;hp=038674aa88a72c09a88388ee7cf1b54839675052;hpb=4f02f8220562591322c118d07a32bebf705318b7;p=karo-tx-linux.git diff --git a/fs/char_dev.c b/fs/char_dev.c index 038674aa88a7..3cb7cda3d780 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c @@ -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]; @@ -374,6 +373,8 @@ static 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 @@ static 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;