]> err.no Git - linux-2.6/blobdiff - drivers/block/paride/pt.c
[WATCHDOG] Merge code clean-up's from Alan Cox.
[linux-2.6] / drivers / block / paride / pt.c
index 27455ee1e9da555f680c7a694cf5874e9198a31b..673b8b2fd337a1e22b442eba939aa4c90a407b86 100644 (file)
@@ -650,8 +650,11 @@ static int pt_open(struct inode *inode, struct file *file)
        struct pt_unit *tape = pt + unit;
        int err;
 
-       if (unit >= PT_UNITS || (!tape->present))
+       lock_kernel();
+       if (unit >= PT_UNITS || (!tape->present)) {
+               unlock_kernel();
                return -ENODEV;
+       }
 
        err = -EBUSY;
        if (!atomic_dec_and_test(&tape->available))
@@ -678,10 +681,12 @@ static int pt_open(struct inode *inode, struct file *file)
        }
 
        file->private_data = tape;
+       unlock_kernel();
        return 0;
 
 out:
        atomic_inc(&tape->available);
+       unlock_kernel();
        return err;
 }
 
@@ -974,10 +979,12 @@ static int __init pt_init(void)
 
        for (unit = 0; unit < PT_UNITS; unit++)
                if (pt[unit].present) {
-                       device_create(pt_class, NULL, MKDEV(major, unit),
-                                     "pt%d", unit);
-                       device_create(pt_class, NULL, MKDEV(major, unit + 128),
-                                     "pt%dn", unit);
+                       device_create_drvdata(pt_class, NULL,
+                                             MKDEV(major, unit), NULL,
+                                             "pt%d", unit);
+                       device_create_drvdata(pt_class, NULL,
+                                             MKDEV(major, unit + 128), NULL,
+                                             "pt%dn", unit);
                }
        goto out;