aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-taskfile.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 7ae4a42cfa5a..7c8e9802898a 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -806,28 +806,29 @@ abort:
806 return err; 806 return err;
807} 807}
808 808
809static int ide_wait_cmd_task(ide_drive_t *drive, u8 *buf)
810{
811 struct request rq;
812
813 ide_init_drive_cmd(&rq);
814 rq.cmd_type = REQ_TYPE_ATA_TASK;
815 rq.buffer = buf;
816 return ide_do_drive_cmd(drive, &rq, ide_wait);
817}
818
819int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) 809int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
820{ 810{
821 void __user *p = (void __user *)arg; 811 void __user *p = (void __user *)arg;
822 int err = 0; 812 int err = 0;
823 u8 args[7], *argbuf = args; 813 u8 args[7];
824 int argsize = 7; 814 ide_task_t task;
825 815
826 if (copy_from_user(args, p, 7)) 816 if (copy_from_user(args, p, 7))
827 return -EFAULT; 817 return -EFAULT;
828 err = ide_wait_cmd_task(drive, argbuf); 818
829 if (copy_to_user(p, argbuf, argsize)) 819 memset(&task, 0, sizeof(task));
820 memcpy(&task.tf_array[7], &args[1], 6);
821 task.tf.command = args[0];
822 task.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
823
824 err = ide_no_data_taskfile(drive, &task);
825
826 args[0] = task.tf.command;
827 memcpy(&args[1], &task.tf_array[7], 6);
828
829 if (copy_to_user(p, args, 7))
830 err = -EFAULT; 830 err = -EFAULT;
831
831 return err; 832 return err;
832} 833}
833 834