Re: [PATCH 2.6.11-rc2 05/09] ide: map ide_task_ioctl() to ide_taskfile_ioctl()

From: Tejun Heo
Date: Sat Feb 05 2005 - 05:45:27 EST



05_ide_taskfile_task_ioctl.patch

ide_task_ioctl() modified to map to ide_taskfile_ioctl().
This is the last user of REQ_DRIVE_TASK.


Signed-off-by: Tejun Heo <tj@xxxxxxxxxxx>


Index: linux-ide-series2-export/drivers/ide/ide-taskfile.c
===================================================================
--- linux-ide-series2-export.orig/drivers/ide/ide-taskfile.c 2005-02-05 19:27:08.533573794 +0900
+++ linux-ide-series2-export/drivers/ide/ide-taskfile.c 2005-02-05 19:27:08.985500385 +0900
@@ -735,32 +735,45 @@ abort:
return err;
}

-static int ide_wait_cmd_task(ide_drive_t *drive, u8 *buf)
-{
- struct request rq;
-
- ide_init_drive_cmd(&rq);
- rq.flags = REQ_DRIVE_TASK;
- rq.buffer = buf;
- return ide_do_drive_cmd(drive, &rq, ide_wait);
-}
-
-/*
- * FIXME : this needs to map into at taskfile. <andre@xxxxxxxxxxxxx>
- */
-int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
+int ide_task_ioctl(ide_drive_t *drive, unsigned int cmd, unsigned long arg)
{
void __user *p = (void __user *)arg;
- int err = 0;
- u8 args[7], *argbuf = args;
- int argsize = 7;
+ u8 args[7];
+ ide_task_t task;
+ task_ioreg_t *regs = task.tfRegister;
+ int ret;

if (copy_from_user(args, p, 7))
return -EFAULT;
- err = ide_wait_cmd_task(drive, argbuf);
- if (copy_to_user(p, argbuf, argsize))
- err = -EFAULT;
- return err;
+
+ memset(&task, 0, sizeof(task));
+
+ regs[IDE_COMMAND_OFFSET] = args[0];
+ regs[IDE_FEATURE_OFFSET] = args[1];
+ regs[IDE_NSECTOR_OFFSET] = args[2];
+ regs[IDE_SECTOR_OFFSET] = args[3];
+ regs[IDE_LCYL_OFFSET] = args[4];
+ regs[IDE_HCYL_OFFSET] = args[5];
+ regs[IDE_SELECT_OFFSET] = args[6];
+
+ task.command_type = IDE_DRIVE_TASK_NO_DATA;
+ task.data_phase = TASKFILE_NO_DATA;
+ task.handler = &task_no_data_intr;
+
+ ret = ide_diag_taskfile(drive, &task, 0, NULL);
+
+ args[0] = regs[IDE_COMMAND_OFFSET];
+ args[1] = regs[IDE_FEATURE_OFFSET];
+ args[2] = regs[IDE_NSECTOR_OFFSET];
+ args[3] = regs[IDE_SECTOR_OFFSET];
+ args[4] = regs[IDE_LCYL_OFFSET];
+ args[5] = regs[IDE_HCYL_OFFSET];
+ args[6] = regs[IDE_SELECT_OFFSET];
+
+ if (copy_to_user(p, args, 7))
+ ret = -EFAULT;
+
+ return ret;
}

/*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/