aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:11 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:11 -0500
commit14b89ef9814614f18a1fcae51e601e7e16a82ef7 (patch)
tree5644683de9d1024594b22a129f368bf8c21c5e5a /drivers/ide
parent813a0eb233ee67d7166241a8b389b6a76f2247f9 (diff)
ide: switch ide_task_ioctl() to use REQ_TYPE_ATA_TASKFILE requests
Based on the earlier work by Tejun Heo. There should be no functionality changes caused by this patch. Cc: Tejun Heo <htejun@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
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