ide-taskfile: convert ide_do_drive_cmd path to use blk_execute_rq
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tue, 15 Jul 2008 19:21:43 +0000 (21:21 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Tue, 15 Jul 2008 19:21:43 +0000 (21:21 +0200)
This converts the ide_do_drive_cmd path using ide_wait to use
blk_execute_rq.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-taskfile.c

index ab545ffa15490367ed013bd9e04a674a1f2df76f..b6a1c4b511299a1380de86a70430c679507dbf8e 100644 (file)
@@ -492,11 +492,12 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq)
 
 int ide_raw_taskfile(ide_drive_t *drive, ide_task_t *task, u8 *buf, u16 nsect)
 {
-       struct request rq;
+       struct request *rq;
+       int error;
 
-       blk_rq_init(NULL, &rq);
-       rq.cmd_type = REQ_TYPE_ATA_TASKFILE;
-       rq.buffer = buf;
+       rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
+       rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
+       rq->buffer = buf;
 
        /*
         * (ks) We transfer currently only whole sectors.
@@ -504,16 +505,19 @@ int ide_raw_taskfile(ide_drive_t *drive, ide_task_t *task, u8 *buf, u16 nsect)
         * if we would find a solution to transfer any size.
         * To support special commands like READ LONG.
         */
-       rq.hard_nr_sectors = rq.nr_sectors = nsect;
-       rq.hard_cur_sectors = rq.current_nr_sectors = nsect;
+       rq->hard_nr_sectors = rq->nr_sectors = nsect;
+       rq->hard_cur_sectors = rq->current_nr_sectors = nsect;
 
        if (task->tf_flags & IDE_TFLAG_WRITE)
-               rq.cmd_flags |= REQ_RW;
+               rq->cmd_flags |= REQ_RW;
 
-       rq.special = task;
-       task->rq = &rq;
+       rq->special = task;
+       task->rq = rq;
 
-       return ide_do_drive_cmd(drive, &rq, ide_wait);
+       error = blk_execute_rq(drive->queue, NULL, rq, 0);
+       blk_put_request(rq);
+
+       return error;
 }
 
 EXPORT_SYMBOL(ide_raw_taskfile);
@@ -739,12 +743,14 @@ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
        struct hd_driveid *id = drive->id;
 
        if (NULL == (void *) arg) {
-               struct request rq;
+               struct request *rq;
 
-               ide_init_drive_cmd(&rq);
-               rq.cmd_type = REQ_TYPE_ATA_TASKFILE;
+               rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
+               rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
+               err = blk_execute_rq(drive->queue, NULL, rq, 0);
+               blk_put_request(rq);
 
-               return ide_do_drive_cmd(drive, &rq, ide_wait);
+               return err;
        }
 
        if (copy_from_user(args, (void __user *)arg, 4))