Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
[pandora-kernel.git] / drivers / block / paride / pt.c
index 314333d..5c74c35 100644 (file)
@@ -190,8 +190,7 @@ module_param_array(drive3, int, NULL, 0);
 #define ATAPI_LOG_SENSE                0x4d
 
 static int pt_open(struct inode *inode, struct file *file);
-static int pt_ioctl(struct inode *inode, struct file *file,
-                   unsigned int cmd, unsigned long arg);
+static long pt_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
 static int pt_release(struct inode *inode, struct file *file);
 static ssize_t pt_read(struct file *filp, char __user *buf,
                       size_t count, loff_t * ppos);
@@ -237,7 +236,7 @@ static const struct file_operations pt_fops = {
        .owner = THIS_MODULE,
        .read = pt_read,
        .write = pt_write,
-       .ioctl = pt_ioctl,
+       .unlocked_ioctl = pt_ioctl,
        .open = pt_open,
        .release = pt_release,
 };
@@ -691,8 +690,7 @@ out:
        return err;
 }
 
-static int pt_ioctl(struct inode *inode, struct file *file,
-        unsigned int cmd, unsigned long arg)
+static long pt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        struct pt_unit *tape = file->private_data;
        struct mtop __user *p = (void __user *)arg;
@@ -706,23 +704,26 @@ static int pt_ioctl(struct inode *inode, struct file *file,
                switch (mtop.mt_op) {
 
                case MTREW:
+                       lock_kernel();
                        pt_rewind(tape);
+                       unlock_kernel();
                        return 0;
 
                case MTWEOF:
+                       lock_kernel();
                        pt_write_fm(tape);
+                       unlock_kernel();
                        return 0;
 
                default:
-                       printk("%s: Unimplemented mt_op %d\n", tape->name,
+                       /* FIXME: rate limit ?? */
+                       printk(KERN_DEBUG "%s: Unimplemented mt_op %d\n", tape->name,
                               mtop.mt_op);
                        return -EINVAL;
                }
 
        default:
-               printk("%s: Unimplemented ioctl 0x%x\n", tape->name, cmd);
-               return -EINVAL;
-
+               return -ENOTTY;
        }
 }