aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide.c
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2008-07-15 15:21:44 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-15 15:21:44 -0400
commit5b114715ed63f3a4fdf790f5df61364fc4adadf1 (patch)
tree18000974a6ab0450b74417853b01fe7452d6637e /drivers/ide/ide.c
parent9a2d43b7566caeeeb414aa628bc2759028897dbb (diff)
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: 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>
Diffstat (limited to 'drivers/ide/ide.c')
-rw-r--r--drivers/ide/ide.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index c9a05721360e..8823df1b8716 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -498,7 +498,7 @@ out:
498 498
499int set_pio_mode(ide_drive_t *drive, int arg) 499int set_pio_mode(ide_drive_t *drive, int arg)
500{ 500{
501 struct request rq; 501 struct request *rq;
502 ide_hwif_t *hwif = drive->hwif; 502 ide_hwif_t *hwif = drive->hwif;
503 const struct ide_port_ops *port_ops = hwif->port_ops; 503 const struct ide_port_ops *port_ops = hwif->port_ops;
504 504
@@ -512,12 +512,15 @@ int set_pio_mode(ide_drive_t *drive, int arg)
512 if (drive->special.b.set_tune) 512 if (drive->special.b.set_tune)
513 return -EBUSY; 513 return -EBUSY;
514 514
515 ide_init_drive_cmd(&rq); 515 rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
516 rq.cmd_type = REQ_TYPE_ATA_TASKFILE; 516 rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
517 517
518 drive->tune_req = (u8) arg; 518 drive->tune_req = (u8) arg;
519 drive->special.b.set_tune = 1; 519 drive->special.b.set_tune = 1;
520 (void) ide_do_drive_cmd(drive, &rq, ide_wait); 520
521 blk_execute_rq(drive->queue, NULL, rq, 0);
522 blk_put_request(rq);
523
521 return 0; 524 return 0;
522} 525}
523 526
@@ -555,7 +558,7 @@ static int generic_ide_suspend(struct device *dev, pm_message_t mesg)
555{ 558{
556 ide_drive_t *drive = dev->driver_data; 559 ide_drive_t *drive = dev->driver_data;
557 ide_hwif_t *hwif = HWIF(drive); 560 ide_hwif_t *hwif = HWIF(drive);
558 struct request rq; 561 struct request *rq;
559 struct request_pm_state rqpm; 562 struct request_pm_state rqpm;
560 ide_task_t args; 563 ide_task_t args;
561 int ret; 564 int ret;
@@ -564,18 +567,19 @@ static int generic_ide_suspend(struct device *dev, pm_message_t mesg)
564 if (!(drive->dn % 2)) 567 if (!(drive->dn % 2))
565 ide_acpi_get_timing(hwif); 568 ide_acpi_get_timing(hwif);
566 569
567 blk_rq_init(NULL, &rq);
568 memset(&rqpm, 0, sizeof(rqpm)); 570 memset(&rqpm, 0, sizeof(rqpm));
569 memset(&args, 0, sizeof(args)); 571 memset(&args, 0, sizeof(args));
570 rq.cmd_type = REQ_TYPE_PM_SUSPEND; 572 rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
571 rq.special = &args; 573 rq->cmd_type = REQ_TYPE_PM_SUSPEND;
572 rq.data = &rqpm; 574 rq->special = &args;
575 rq->data = &rqpm;
573 rqpm.pm_step = ide_pm_state_start_suspend; 576 rqpm.pm_step = ide_pm_state_start_suspend;
574 if (mesg.event == PM_EVENT_PRETHAW) 577 if (mesg.event == PM_EVENT_PRETHAW)
575 mesg.event = PM_EVENT_FREEZE; 578 mesg.event = PM_EVENT_FREEZE;
576 rqpm.pm_state = mesg.event; 579 rqpm.pm_state = mesg.event;
577 580
578 ret = ide_do_drive_cmd(drive, &rq, ide_wait); 581 ret = blk_execute_rq(drive->queue, NULL, rq, 0);
582 blk_put_request(rq);
579 /* only call ACPI _PS3 after both drivers are suspended */ 583 /* only call ACPI _PS3 after both drivers are suspended */
580 if (!ret && (((drive->dn % 2) && hwif->drives[0].present 584 if (!ret && (((drive->dn % 2) && hwif->drives[0].present
581 && hwif->drives[1].present) 585 && hwif->drives[1].present)
@@ -589,7 +593,7 @@ static int generic_ide_resume(struct device *dev)
589{ 593{
590 ide_drive_t *drive = dev->driver_data; 594 ide_drive_t *drive = dev->driver_data;
591 ide_hwif_t *hwif = HWIF(drive); 595 ide_hwif_t *hwif = HWIF(drive);
592 struct request rq; 596 struct request *rq;
593 struct request_pm_state rqpm; 597 struct request_pm_state rqpm;
594 ide_task_t args; 598 ide_task_t args;
595 int err; 599 int err;
@@ -602,17 +606,18 @@ static int generic_ide_resume(struct device *dev)
602 606
603 ide_acpi_exec_tfs(drive); 607 ide_acpi_exec_tfs(drive);
604 608
605 blk_rq_init(NULL, &rq);
606 memset(&rqpm, 0, sizeof(rqpm)); 609 memset(&rqpm, 0, sizeof(rqpm));
607 memset(&args, 0, sizeof(args)); 610 memset(&args, 0, sizeof(args));
608 rq.cmd_type = REQ_TYPE_PM_RESUME; 611 rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
609 rq.cmd_flags |= REQ_PREEMPT; 612 rq->cmd_type = REQ_TYPE_PM_RESUME;
610 rq.special = &args; 613 rq->cmd_flags |= REQ_PREEMPT;
611 rq.data = &rqpm; 614 rq->special = &args;
615 rq->data = &rqpm;
612 rqpm.pm_step = ide_pm_state_start_resume; 616 rqpm.pm_step = ide_pm_state_start_resume;
613 rqpm.pm_state = PM_EVENT_ON; 617 rqpm.pm_state = PM_EVENT_ON;
614 618
615 err = ide_do_drive_cmd(drive, &rq, ide_head_wait); 619 err = blk_execute_rq(drive->queue, NULL, rq, 1);
620 blk_put_request(rq);
616 621
617 if (err == 0 && dev->driver) { 622 if (err == 0 && dev->driver) {
618 ide_driver_t *drv = to_ide_driver(dev->driver); 623 ide_driver_t *drv = to_ide_driver(dev->driver);