]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/s390/char/vmur.c
device create: s390: convert device_create_drvdata to device_create
[linux-2.6-omap-h63xx.git] / drivers / s390 / char / vmur.c
index 83ae9a852f00c2dc5c4e2fc9be7eb81e974770de..9020eba620eee22fe8ae36bd0716596c38ae9a7f 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/cdev.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 #include <asm/cio.h>
@@ -277,7 +278,8 @@ static void ur_int_handler(struct ccw_device *cdev, unsigned long intparm,
        struct urdev *urd;
 
        TRACE("ur_int_handler: intparm=0x%lx cstat=%02x dstat=%02x res=%u\n",
-             intparm, irb->scsw.cstat, irb->scsw.dstat, irb->scsw.count);
+             intparm, irb->scsw.cmd.cstat, irb->scsw.cmd.dstat,
+             irb->scsw.cmd.count);
 
        if (!intparm) {
                TRACE("ur_int_handler: unsolicited interrupt\n");
@@ -288,7 +290,7 @@ static void ur_int_handler(struct ccw_device *cdev, unsigned long intparm,
        /* On special conditions irb is an error pointer */
        if (IS_ERR(irb))
                urd->io_request_rc = PTR_ERR(irb);
-       else if (irb->scsw.dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END))
+       else if (irb->scsw.cmd.dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END))
                urd->io_request_rc = 0;
        else
                urd->io_request_rc = -EIO;
@@ -343,7 +345,7 @@ static int get_urd_class(struct urdev *urd)
        cc = diag210(&ur_diag210);
        switch (cc) {
        case 0:
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
        case 2:
                return ur_diag210.vrdcvcla; /* virtual device class */
        case 3:
@@ -619,7 +621,7 @@ static int verify_device(struct urdev *urd)
        case DEV_CLASS_UR_I:
                return verify_uri_device(urd);
        default:
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
        }
 }
 
@@ -652,7 +654,7 @@ static int get_file_reclen(struct urdev *urd)
        case DEV_CLASS_UR_I:
                return get_uri_file_reclen(urd);
        default:
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
        }
 }
 
@@ -668,7 +670,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 +678,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 +724,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 +735,8 @@ fail_unlock:
        spin_unlock(&urd->open_lock);
 fail_put:
        urdev_put(urd);
+out:
+       unlock_kernel();
        return rc;
 }
 
@@ -820,7 +827,7 @@ static int ur_probe(struct ccw_device *cdev)
                goto fail_remove_attr;
        }
        if ((urd->class != DEV_CLASS_UR_I) && (urd->class != DEV_CLASS_UR_O)) {
-               rc = -ENOTSUPP;
+               rc = -EOPNOTSUPP;
                goto fail_remove_attr;
        }
        spin_lock_irq(get_ccwdev_lock(cdev));
@@ -879,18 +886,18 @@ static int ur_set_online(struct ccw_device *cdev)
                goto fail_free_cdev;
        if (urd->cdev->id.cu_type == READER_PUNCH_DEVTYPE) {
                if (urd->class == DEV_CLASS_UR_I)
-                       sprintf(node_id, "vmrdr-%s", cdev->dev.bus_id);
+                       sprintf(node_id, "vmrdr-%s", dev_name(&cdev->dev));
                if (urd->class == DEV_CLASS_UR_O)
-                       sprintf(node_id, "vmpun-%s", cdev->dev.bus_id);
+                       sprintf(node_id, "vmpun-%s", dev_name(&cdev->dev));
        } else if (urd->cdev->id.cu_type == PRINTER_DEVTYPE) {
-               sprintf(node_id, "vmprt-%s", cdev->dev.bus_id);
+               sprintf(node_id, "vmprt-%s", dev_name(&cdev->dev));
        } else {
-               rc = -ENOTSUPP;
+               rc = -EOPNOTSUPP;
                goto fail_free_cdev;
        }
 
        urd->device = device_create(vmur_class, NULL, urd->char_device->dev,
-                                       "%s", node_id);
+                                   NULL, "%s", node_id);
        if (IS_ERR(urd->device)) {
                rc = PTR_ERR(urd->device);
                TRACE("ur_set_online: device_create rc=%d\n", rc);