]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/osst.c
[SPARC64]: Implement atomic backoff.
[linux-2.6-omap-h63xx.git] / drivers / scsi / osst.c
index 9668b73872c785e419e656919abc5bdc5424a2a3..331b789937c4e0a700e4d1406f8e6a708e9a3e03 100644 (file)
@@ -87,6 +87,7 @@ MODULE_AUTHOR("Willem Riede");
 MODULE_DESCRIPTION("OnStream {DI-|FW-|SC-|USB}{30|50} Tape Driver");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_CHARDEV_MAJOR(OSST_MAJOR);
+MODULE_ALIAS_SCSI_DEVICE(TYPE_TAPE);
 
 module_param(max_dev, int, 0444);
 MODULE_PARM_DESC(max_dev, "Maximum number of OnStream Tape Drives to attach (4)");
@@ -3297,7 +3298,7 @@ static ssize_t osst_write(struct file * filp, const char __user * buf, size_t co
        char                * name = tape_name(STp);
 
 
-       if (down_interruptible(&STp->lock))
+       if (mutex_lock_interruptible(&STp->lock))
                return (-ERESTARTSYS);
 
        /*
@@ -3599,7 +3600,7 @@ if (SRpnt) printk(KERN_ERR "%s:A: Not supposed to have SRpnt at line %d\n", name
 out:
        if (SRpnt != NULL) osst_release_request(SRpnt);
 
-       up(&STp->lock);
+       mutex_unlock(&STp->lock);
 
        return retval;
 }
@@ -3618,7 +3619,7 @@ static ssize_t osst_read(struct file * filp, char __user * buf, size_t count, lo
        char                * name  = tape_name(STp);
 
 
-       if (down_interruptible(&STp->lock))
+       if (mutex_lock_interruptible(&STp->lock))
                return (-ERESTARTSYS);
 
        /*
@@ -3784,7 +3785,7 @@ static ssize_t osst_read(struct file * filp, char __user * buf, size_t count, lo
 out:
        if (SRpnt != NULL) osst_release_request(SRpnt);
 
-       up(&STp->lock);
+       mutex_unlock(&STp->lock);
 
        return retval;
 }
@@ -4851,7 +4852,7 @@ static int osst_ioctl(struct inode * inode,struct file * file,
        char                * name  = tape_name(STp);
        void        __user  * p     = (void __user *)arg;
 
-       if (down_interruptible(&STp->lock))
+       if (mutex_lock_interruptible(&STp->lock))
                return -ERESTARTSYS;
 
 #if DEBUG
@@ -5162,14 +5163,14 @@ static int osst_ioctl(struct inode * inode,struct file * file,
        }
        if (SRpnt) osst_release_request(SRpnt);
 
-       up(&STp->lock);
+       mutex_unlock(&STp->lock);
 
        return scsi_ioctl(STp->device, cmd_in, p);
 
 out:
        if (SRpnt) osst_release_request(SRpnt);
 
-       up(&STp->lock);
+       mutex_unlock(&STp->lock);
 
        return retval;
 }
@@ -5574,14 +5575,14 @@ static ssize_t osst_version_show(struct device_driver *ddd, char *buf)
 
 static DRIVER_ATTR(version, S_IRUGO, osst_version_show, NULL);
 
-static int osst_create_driverfs_files(struct device_driver *driverfs)
+static int osst_create_sysfs_files(struct device_driver *sysfs)
 {
-       return driver_create_file(driverfs, &driver_attr_version);
+       return driver_create_file(sysfs, &driver_attr_version);
 }
 
-static void osst_remove_driverfs_files(struct device_driver *driverfs)
+static void osst_remove_sysfs_files(struct device_driver *sysfs)
 {
-       driver_remove_file(driverfs, &driver_attr_version);
+       driver_remove_file(sysfs, &driver_attr_version);
 }
 
 /*
@@ -5777,13 +5778,12 @@ static int osst_probe(struct device *dev)
        dev_num = i;
 
        /* allocate a struct osst_tape for this device */
-       tpnt = kmalloc(sizeof(struct osst_tape), GFP_ATOMIC);
-       if (tpnt == NULL) {
+       tpnt = kzalloc(sizeof(struct osst_tape), GFP_ATOMIC);
+       if (!tpnt) {
                write_unlock(&os_scsi_tapes_lock);
                printk(KERN_ERR "osst :E: Can't allocate device descriptor, device not attached.\n");
                goto out_put_disk;
        }
-       memset(tpnt, 0, sizeof(struct osst_tape));
 
        /* allocate a buffer for this device */
        i = SDp->host->sg_tablesize;
@@ -5865,7 +5865,7 @@ static int osst_probe(struct device *dev)
        tpnt->modes[2].defined = 1;
        tpnt->density_changed = tpnt->compression_changed = tpnt->blksize_changed = 0;
 
-       init_MUTEX(&tpnt->lock);
+       mutex_init(&tpnt->lock);
        osst_nr_dev++;
        write_unlock(&os_scsi_tapes_lock);
 
@@ -5953,7 +5953,7 @@ static int __init init_osst(void)
        if (err)
                goto err_out_chrdev;
 
-       err = osst_create_driverfs_files(&osst_template.gendrv);
+       err = osst_create_sysfs_files(&osst_template.gendrv);
        if (err)
                goto err_out_scsidrv;
 
@@ -5973,7 +5973,7 @@ static void __exit exit_osst (void)
        int i;
        struct osst_tape * STp;
 
-       osst_remove_driverfs_files(&osst_template.gendrv);
+       osst_remove_sysfs_files(&osst_template.gendrv);
        scsi_unregister_driver(&osst_template.gendrv);
        unregister_chrdev(OSST_MAJOR, "osst");
        osst_sysfs_cleanup();