Commit 5b114715 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by Bartlomiej Zolnierkiewicz

ide: convert ide_do_drive_cmd path to use blk_execute_rq

This converts the ide_do_drive_cmd path using ide_[head_]wait to use
blk_execute_rq.
Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 9a2d43b7
...@@ -498,7 +498,7 @@ int set_using_dma(ide_drive_t *drive, int arg) ...@@ -498,7 +498,7 @@ int set_using_dma(ide_drive_t *drive, int arg)
int set_pio_mode(ide_drive_t *drive, int arg) int set_pio_mode(ide_drive_t *drive, int arg)
{ {
struct request rq; struct request *rq;
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
const struct ide_port_ops *port_ops = hwif->port_ops; const struct ide_port_ops *port_ops = hwif->port_ops;
...@@ -512,12 +512,15 @@ int set_pio_mode(ide_drive_t *drive, int arg) ...@@ -512,12 +512,15 @@ int set_pio_mode(ide_drive_t *drive, int arg)
if (drive->special.b.set_tune) if (drive->special.b.set_tune)
return -EBUSY; return -EBUSY;
ide_init_drive_cmd(&rq); rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
rq.cmd_type = REQ_TYPE_ATA_TASKFILE; rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
drive->tune_req = (u8) arg; drive->tune_req = (u8) arg;
drive->special.b.set_tune = 1; drive->special.b.set_tune = 1;
(void) ide_do_drive_cmd(drive, &rq, ide_wait);
blk_execute_rq(drive->queue, NULL, rq, 0);
blk_put_request(rq);
return 0; return 0;
} }
...@@ -555,7 +558,7 @@ static int generic_ide_suspend(struct device *dev, pm_message_t mesg) ...@@ -555,7 +558,7 @@ static int generic_ide_suspend(struct device *dev, pm_message_t mesg)
{ {
ide_drive_t *drive = dev->driver_data; ide_drive_t *drive = dev->driver_data;
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
struct request rq; struct request *rq;
struct request_pm_state rqpm; struct request_pm_state rqpm;
ide_task_t args; ide_task_t args;
int ret; int ret;
...@@ -564,18 +567,19 @@ static int generic_ide_suspend(struct device *dev, pm_message_t mesg) ...@@ -564,18 +567,19 @@ static int generic_ide_suspend(struct device *dev, pm_message_t mesg)
if (!(drive->dn % 2)) if (!(drive->dn % 2))
ide_acpi_get_timing(hwif); ide_acpi_get_timing(hwif);
blk_rq_init(NULL, &rq);
memset(&rqpm, 0, sizeof(rqpm)); memset(&rqpm, 0, sizeof(rqpm));
memset(&args, 0, sizeof(args)); memset(&args, 0, sizeof(args));
rq.cmd_type = REQ_TYPE_PM_SUSPEND; rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
rq.special = &args; rq->cmd_type = REQ_TYPE_PM_SUSPEND;
rq.data = &rqpm; rq->special = &args;
rq->data = &rqpm;
rqpm.pm_step = ide_pm_state_start_suspend; rqpm.pm_step = ide_pm_state_start_suspend;
if (mesg.event == PM_EVENT_PRETHAW) if (mesg.event == PM_EVENT_PRETHAW)
mesg.event = PM_EVENT_FREEZE; mesg.event = PM_EVENT_FREEZE;
rqpm.pm_state = mesg.event; rqpm.pm_state = mesg.event;
ret = ide_do_drive_cmd(drive, &rq, ide_wait); ret = blk_execute_rq(drive->queue, NULL, rq, 0);
blk_put_request(rq);
/* only call ACPI _PS3 after both drivers are suspended */ /* only call ACPI _PS3 after both drivers are suspended */
if (!ret && (((drive->dn % 2) && hwif->drives[0].present if (!ret && (((drive->dn % 2) && hwif->drives[0].present
&& hwif->drives[1].present) && hwif->drives[1].present)
...@@ -589,7 +593,7 @@ static int generic_ide_resume(struct device *dev) ...@@ -589,7 +593,7 @@ static int generic_ide_resume(struct device *dev)
{ {
ide_drive_t *drive = dev->driver_data; ide_drive_t *drive = dev->driver_data;
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
struct request rq; struct request *rq;
struct request_pm_state rqpm; struct request_pm_state rqpm;
ide_task_t args; ide_task_t args;
int err; int err;
...@@ -602,17 +606,18 @@ static int generic_ide_resume(struct device *dev) ...@@ -602,17 +606,18 @@ static int generic_ide_resume(struct device *dev)
ide_acpi_exec_tfs(drive); ide_acpi_exec_tfs(drive);
blk_rq_init(NULL, &rq);
memset(&rqpm, 0, sizeof(rqpm)); memset(&rqpm, 0, sizeof(rqpm));
memset(&args, 0, sizeof(args)); memset(&args, 0, sizeof(args));
rq.cmd_type = REQ_TYPE_PM_RESUME; rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
rq.cmd_flags |= REQ_PREEMPT; rq->cmd_type = REQ_TYPE_PM_RESUME;
rq.special = &args; rq->cmd_flags |= REQ_PREEMPT;
rq.data = &rqpm; rq->special = &args;
rq->data = &rqpm;
rqpm.pm_step = ide_pm_state_start_resume; rqpm.pm_step = ide_pm_state_start_resume;
rqpm.pm_state = PM_EVENT_ON; rqpm.pm_state = PM_EVENT_ON;
err = ide_do_drive_cmd(drive, &rq, ide_head_wait); err = blk_execute_rq(drive->queue, NULL, rq, 1);
blk_put_request(rq);
if (err == 0 && dev->driver) { if (err == 0 && dev->driver) {
ide_driver_t *drv = to_ide_driver(dev->driver); ide_driver_t *drv = to_ide_driver(dev->driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment