aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char/vmur.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/char/vmur.c')
-rw-r--r--drivers/s390/char/vmur.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 83ae9a852f00..b0ac44b27127 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -9,6 +9,7 @@
9 */ 9 */
10 10
11#include <linux/cdev.h> 11#include <linux/cdev.h>
12#include <linux/smp_lock.h>
12 13
13#include <asm/uaccess.h> 14#include <asm/uaccess.h>
14#include <asm/cio.h> 15#include <asm/cio.h>
@@ -277,7 +278,8 @@ static void ur_int_handler(struct ccw_device *cdev, unsigned long intparm,
277 struct urdev *urd; 278 struct urdev *urd;
278 279
279 TRACE("ur_int_handler: intparm=0x%lx cstat=%02x dstat=%02x res=%u\n", 280 TRACE("ur_int_handler: intparm=0x%lx cstat=%02x dstat=%02x res=%u\n",
280 intparm, irb->scsw.cstat, irb->scsw.dstat, irb->scsw.count); 281 intparm, irb->scsw.cmd.cstat, irb->scsw.cmd.dstat,
282 irb->scsw.cmd.count);
281 283
282 if (!intparm) { 284 if (!intparm) {
283 TRACE("ur_int_handler: unsolicited interrupt\n"); 285 TRACE("ur_int_handler: unsolicited interrupt\n");
@@ -288,7 +290,7 @@ static void ur_int_handler(struct ccw_device *cdev, unsigned long intparm,
288 /* On special conditions irb is an error pointer */ 290 /* On special conditions irb is an error pointer */
289 if (IS_ERR(irb)) 291 if (IS_ERR(irb))
290 urd->io_request_rc = PTR_ERR(irb); 292 urd->io_request_rc = PTR_ERR(irb);
291 else if (irb->scsw.dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END)) 293 else if (irb->scsw.cmd.dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END))
292 urd->io_request_rc = 0; 294 urd->io_request_rc = 0;
293 else 295 else
294 urd->io_request_rc = -EIO; 296 urd->io_request_rc = -EIO;
@@ -343,7 +345,7 @@ static int get_urd_class(struct urdev *urd)
343 cc = diag210(&ur_diag210); 345 cc = diag210(&ur_diag210);
344 switch (cc) { 346 switch (cc) {
345 case 0: 347 case 0:
346 return -ENOTSUPP; 348 return -EOPNOTSUPP;
347 case 2: 349 case 2:
348 return ur_diag210.vrdcvcla; /* virtual device class */ 350 return ur_diag210.vrdcvcla; /* virtual device class */
349 case 3: 351 case 3:
@@ -619,7 +621,7 @@ static int verify_device(struct urdev *urd)
619 case DEV_CLASS_UR_I: 621 case DEV_CLASS_UR_I:
620 return verify_uri_device(urd); 622 return verify_uri_device(urd);
621 default: 623 default:
622 return -ENOTSUPP; 624 return -EOPNOTSUPP;
623 } 625 }
624} 626}
625 627
@@ -652,7 +654,7 @@ static int get_file_reclen(struct urdev *urd)
652 case DEV_CLASS_UR_I: 654 case DEV_CLASS_UR_I:
653 return get_uri_file_reclen(urd); 655 return get_uri_file_reclen(urd);
654 default: 656 default:
655 return -ENOTSUPP; 657 return -EOPNOTSUPP;
656 } 658 }
657} 659}
658 660
@@ -668,7 +670,7 @@ static int ur_open(struct inode *inode, struct file *file)
668 670
669 if (accmode == O_RDWR) 671 if (accmode == O_RDWR)
670 return -EACCES; 672 return -EACCES;
671 673 lock_kernel();
672 /* 674 /*
673 * We treat the minor number as the devno of the ur device 675 * We treat the minor number as the devno of the ur device
674 * to find in the driver tree. 676 * to find in the driver tree.
@@ -676,8 +678,10 @@ static int ur_open(struct inode *inode, struct file *file)
676 devno = MINOR(file->f_dentry->d_inode->i_rdev); 678 devno = MINOR(file->f_dentry->d_inode->i_rdev);
677 679
678 urd = urdev_get_from_devno(devno); 680 urd = urdev_get_from_devno(devno);
679 if (!urd) 681 if (!urd) {
680 return -ENXIO; 682 rc = -ENXIO;
683 goto out;
684 }
681 685
682 spin_lock(&urd->open_lock); 686 spin_lock(&urd->open_lock);
683 while (urd->open_flag) { 687 while (urd->open_flag) {
@@ -720,6 +724,7 @@ static int ur_open(struct inode *inode, struct file *file)
720 goto fail_urfile_free; 724 goto fail_urfile_free;
721 urf->file_reclen = rc; 725 urf->file_reclen = rc;
722 file->private_data = urf; 726 file->private_data = urf;
727 unlock_kernel();
723 return 0; 728 return 0;
724 729
725fail_urfile_free: 730fail_urfile_free:
@@ -730,6 +735,8 @@ fail_unlock:
730 spin_unlock(&urd->open_lock); 735 spin_unlock(&urd->open_lock);
731fail_put: 736fail_put:
732 urdev_put(urd); 737 urdev_put(urd);
738out:
739 unlock_kernel();
733 return rc; 740 return rc;
734} 741}
735 742
@@ -820,7 +827,7 @@ static int ur_probe(struct ccw_device *cdev)
820 goto fail_remove_attr; 827 goto fail_remove_attr;
821 } 828 }
822 if ((urd->class != DEV_CLASS_UR_I) && (urd->class != DEV_CLASS_UR_O)) { 829 if ((urd->class != DEV_CLASS_UR_I) && (urd->class != DEV_CLASS_UR_O)) {
823 rc = -ENOTSUPP; 830 rc = -EOPNOTSUPP;
824 goto fail_remove_attr; 831 goto fail_remove_attr;
825 } 832 }
826 spin_lock_irq(get_ccwdev_lock(cdev)); 833 spin_lock_irq(get_ccwdev_lock(cdev));
@@ -885,7 +892,7 @@ static int ur_set_online(struct ccw_device *cdev)
885 } else if (urd->cdev->id.cu_type == PRINTER_DEVTYPE) { 892 } else if (urd->cdev->id.cu_type == PRINTER_DEVTYPE) {
886 sprintf(node_id, "vmprt-%s", cdev->dev.bus_id); 893 sprintf(node_id, "vmprt-%s", cdev->dev.bus_id);
887 } else { 894 } else {
888 rc = -ENOTSUPP; 895 rc = -EOPNOTSUPP;
889 goto fail_free_cdev; 896 goto fail_free_cdev;
890 } 897 }
891 898