]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
drivers/s390: cdev lock_kernel() pushdown
authorJonathan Corbet <corbet@lwn.net>
Thu, 15 May 2008 16:01:17 +0000 (10:01 -0600)
committerJonathan Corbet <corbet@lwn.net>
Fri, 20 Jun 2008 20:03:43 +0000 (14:03 -0600)
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
drivers/s390/char/fs3270.c
drivers/s390/char/tape_char.c
drivers/s390/char/vmlogrdr.c
drivers/s390/char/vmur.c

index ef36f2132aa43fb994ee878a46022f5776c64ed0..b5ecd59676c4a3fce494da28c5c4197b4d4e84f3 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/interrupt.h>
 #include <linux/list.h>
 #include <linux/types.h>
+#include <linux/smp_lock.h>
 
 #include <asm/ccwdev.h>
 #include <asm/cio.h>
@@ -421,6 +422,7 @@ fs3270_open(struct inode *inode, struct file *filp)
 
        if (imajor(filp->f_path.dentry->d_inode) != IBM_FS3270_MAJOR)
                return -ENODEV;
+       lock_kernel();
        minor = iminor(filp->f_path.dentry->d_inode);
        /* Check for minor 0 multiplexer. */
        if (minor == 0) {
@@ -429,7 +431,8 @@ fs3270_open(struct inode *inode, struct file *filp)
                tty = get_current_tty();
                if (!tty || tty->driver->major != IBM_TTY3270_MAJOR) {
                        mutex_unlock(&tty_mutex);
-                       return -ENODEV;
+                       rc = -ENODEV;
+                       goto out;
                }
                minor = tty->index + RAW3270_FIRSTMINOR;
                mutex_unlock(&tty_mutex);
@@ -438,19 +441,22 @@ fs3270_open(struct inode *inode, struct file *filp)
        fp = (struct fs3270 *) raw3270_find_view(&fs3270_fn, minor);
        if (!IS_ERR(fp)) {
                raw3270_put_view(&fp->view);
-               return -EBUSY;
+               rc = -EBUSY;
+               goto out;
        }
        /* Allocate fullscreen view structure. */
        fp = fs3270_alloc_view();
-       if (IS_ERR(fp))
-               return PTR_ERR(fp);
+       if (IS_ERR(fp)) {
+               rc = PTR_ERR(fp);
+               goto out;
+       }
 
        init_waitqueue_head(&fp->wait);
        fp->fs_pid = get_pid(task_pid(current));
        rc = raw3270_add_view(&fp->view, &fs3270_fn, minor);
        if (rc) {
                fs3270_free_view(&fp->view);
-               return rc;
+               goto out;
        }
 
        /* Allocate idal-buffer. */
@@ -458,7 +464,8 @@ fs3270_open(struct inode *inode, struct file *filp)
        if (IS_ERR(ib)) {
                raw3270_put_view(&fp->view);
                raw3270_del_view(&fp->view);
-               return PTR_ERR(fp);
+               rc = PTR_ERR(fp);
+               goto out;
        }
        fp->rdbuf = ib;
 
@@ -466,9 +473,11 @@ fs3270_open(struct inode *inode, struct file *filp)
        if (rc) {
                raw3270_put_view(&fp->view);
                raw3270_del_view(&fp->view);
-               return rc;
+               goto out;
        }
        filp->private_data = fp;
+out:
+       unlock_kernel();
        return 0;
 }
 
index ebe84067bae928bddf9b9770e8eb994a9f6ceb76..687720b552d1c460019c8aa40a758294538195dd 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/types.h>
 #include <linux/proc_fs.h>
 #include <linux/mtio.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 
@@ -289,21 +290,26 @@ tapechar_open (struct inode *inode, struct file *filp)
        if (imajor(filp->f_path.dentry->d_inode) != tapechar_major)
                return -ENODEV;
 
+       lock_kernel();
        minor = iminor(filp->f_path.dentry->d_inode);
        device = tape_get_device(minor / TAPE_MINORS_PER_DEV);
        if (IS_ERR(device)) {
                DBF_EVENT(3, "TCHAR:open: tape_get_device() failed\n");
-               return PTR_ERR(device);
+               rc = PTR_ERR(device);
+               goto out;
        }
 
 
        rc = tape_open(device);
        if (rc == 0) {
                filp->private_data = device;
-               return nonseekable_open(inode, filp);
+               rc = nonseekable_open(inode, filp);
        }
-       tape_put_device(device);
+       else
+               tape_put_device(device);
 
+out:
+       unlock_kernel();
        return rc;
 }
 
index e8487347e4d4aa33eb7e844e815ad77028b50f16..d101328a29806a067da1eaef90c3a04f5ed8a651 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/kmod.h>
 #include <linux/cdev.h>
 #include <linux/device.h>
+#include <linux/smp_lock.h>
 #include <linux/string.h>
 
 
@@ -319,9 +320,11 @@ static int vmlogrdr_open (struct inode *inode, struct file *filp)
                return -ENOSYS;
 
        /* Besure this device hasn't already been opened */
+       lock_kernel();
        spin_lock_bh(&logptr->priv_lock);
        if (logptr->dev_in_use) {
                spin_unlock_bh(&logptr->priv_lock);
+               unlock_kernel();
                return -EBUSY;
        }
        logptr->dev_in_use = 1;
@@ -365,7 +368,9 @@ static int vmlogrdr_open (struct inode *inode, struct file *filp)
                   || (logptr->iucv_path_severed));
        if (logptr->iucv_path_severed)
                goto out_record;
-       return nonseekable_open(inode, filp);
+       ret = nonseekable_open(inode, filp);
+       unlock_kernel();
+       return ret;
 
 out_record:
        if (logptr->autorecording)
@@ -375,6 +380,7 @@ out_path:
        logptr->path = NULL;
 out_dev:
        logptr->dev_in_use = 0;
+       unlock_kernel();
        return -EIO;
 }
 
index 83ae9a852f00c2dc5c4e2fc9be7eb81e974770de..61549987ed70b0b6967923639b3230ee8332d465 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/cdev.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 #include <asm/cio.h>
@@ -668,7 +669,7 @@ static int ur_open(struct inode *inode, struct file *file)
 
        if (accmode == O_RDWR)
                return -EACCES;
-
+       lock_kernel();
        /*
         * We treat the minor number as the devno of the ur device
         * to find in the driver tree.
@@ -676,8 +677,10 @@ static int ur_open(struct inode *inode, struct file *file)
        devno = MINOR(file->f_dentry->d_inode->i_rdev);
 
        urd = urdev_get_from_devno(devno);
-       if (!urd)
-               return -ENXIO;
+       if (!urd) {
+               rc = -ENXIO;
+               goto out;
+       }
 
        spin_lock(&urd->open_lock);
        while (urd->open_flag) {
@@ -720,6 +723,7 @@ static int ur_open(struct inode *inode, struct file *file)
                goto fail_urfile_free;
        urf->file_reclen = rc;
        file->private_data = urf;
+       unlock_kernel();
        return 0;
 
 fail_urfile_free:
@@ -730,6 +734,8 @@ fail_unlock:
        spin_unlock(&urd->open_lock);
 fail_put:
        urdev_put(urd);
+out:
+       unlock_kernel();
        return rc;
 }