]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/char_dev.c
[SCSI] refactor sdev/starget/shost busy checking
[linux-2.6-omap-h63xx.git] / fs / char_dev.c
index 68e510b88457e85d8831aa0b48a0479c137d3cb3..262fa10e213d571c4d14e1c6b08a3c5861e55e03 100644 (file)
@@ -22,9 +22,6 @@
 #include <linux/mutex.h>
 #include <linux/backing-dev.h>
 
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
 #include "internal.h"
 
 /*
@@ -373,6 +370,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;
@@ -392,11 +391,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;