aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-07-04 03:51:21 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-07-04 03:51:21 -0400
commitbe1fd70fea1100c57f3aa1934ebb93abc474e50c (patch)
treefa187ff1f111326c599915b23c989e474694a453 /drivers/block
parent823ed72e8fe566983b121e8cc3147dd50ce63a8a (diff)
paride: push ioctl down into driver
Leaves us with lock_kernel for two methods. Also remove a bogus printk with no printk level and return -ENOTTY not -EINVAL for correctness. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> (Jens: added smp_lock.h include to pt.c, otherwise it wont compile because of missing {un}lock_kernel() definition) Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/paride/pt.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 8b9549ab4a4e..27455ee1e9da 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -146,6 +146,7 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3};
146#include <linux/mtio.h> 146#include <linux/mtio.h>
147#include <linux/device.h> 147#include <linux/device.h>
148#include <linux/sched.h> /* current, TASK_*, schedule_timeout() */ 148#include <linux/sched.h> /* current, TASK_*, schedule_timeout() */
149#include <linux/smp_lock.h>
149 150
150#include <asm/uaccess.h> 151#include <asm/uaccess.h>
151 152
@@ -189,8 +190,7 @@ module_param_array(drive3, int, NULL, 0);
189#define ATAPI_LOG_SENSE 0x4d 190#define ATAPI_LOG_SENSE 0x4d
190 191
191static int pt_open(struct inode *inode, struct file *file); 192static int pt_open(struct inode *inode, struct file *file);
192static int pt_ioctl(struct inode *inode, struct file *file, 193static long pt_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
193 unsigned int cmd, unsigned long arg);
194static int pt_release(struct inode *inode, struct file *file); 194static int pt_release(struct inode *inode, struct file *file);
195static ssize_t pt_read(struct file *filp, char __user *buf, 195static ssize_t pt_read(struct file *filp, char __user *buf,
196 size_t count, loff_t * ppos); 196 size_t count, loff_t * ppos);
@@ -236,7 +236,7 @@ static const struct file_operations pt_fops = {
236 .owner = THIS_MODULE, 236 .owner = THIS_MODULE,
237 .read = pt_read, 237 .read = pt_read,
238 .write = pt_write, 238 .write = pt_write,
239 .ioctl = pt_ioctl, 239 .unlocked_ioctl = pt_ioctl,
240 .open = pt_open, 240 .open = pt_open,
241 .release = pt_release, 241 .release = pt_release,
242}; 242};
@@ -685,8 +685,7 @@ out:
685 return err; 685 return err;
686} 686}
687 687
688static int pt_ioctl(struct inode *inode, struct file *file, 688static long pt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
689 unsigned int cmd, unsigned long arg)
690{ 689{
691 struct pt_unit *tape = file->private_data; 690 struct pt_unit *tape = file->private_data;
692 struct mtop __user *p = (void __user *)arg; 691 struct mtop __user *p = (void __user *)arg;
@@ -700,23 +699,26 @@ static int pt_ioctl(struct inode *inode, struct file *file,
700 switch (mtop.mt_op) { 699 switch (mtop.mt_op) {
701 700
702 case MTREW: 701 case MTREW:
702 lock_kernel();
703 pt_rewind(tape); 703 pt_rewind(tape);
704 unlock_kernel();
704 return 0; 705 return 0;
705 706
706 case MTWEOF: 707 case MTWEOF:
708 lock_kernel();
707 pt_write_fm(tape); 709 pt_write_fm(tape);
710 unlock_kernel();
708 return 0; 711 return 0;
709 712
710 default: 713 default:
711 printk("%s: Unimplemented mt_op %d\n", tape->name, 714 /* FIXME: rate limit ?? */
715 printk(KERN_DEBUG "%s: Unimplemented mt_op %d\n", tape->name,
712 mtop.mt_op); 716 mtop.mt_op);
713 return -EINVAL; 717 return -EINVAL;
714 } 718 }
715 719
716 default: 720 default:
717 printk("%s: Unimplemented ioctl 0x%x\n", tape->name, cmd); 721 return -ENOTTY;
718 return -EINVAL;
719
720 } 722 }
721} 723}
722 724