diff options
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-atapi.c | 18 | ||||
-rw-r--r-- | drivers/ide/ide-dma.c | 11 | ||||
-rw-r--r-- | drivers/ide/ide-taskfile.c | 4 |
3 files changed, 15 insertions, 18 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 1481f71f8173..89d2339bdef3 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -638,7 +638,6 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) | |||
638 | { | 638 | { |
639 | struct ide_atapi_pc *pc; | 639 | struct ide_atapi_pc *pc; |
640 | ide_hwif_t *hwif = drive->hwif; | 640 | ide_hwif_t *hwif = drive->hwif; |
641 | const struct ide_dma_ops *dma_ops = hwif->dma_ops; | ||
642 | ide_expiry_t *expiry = NULL; | 641 | ide_expiry_t *expiry = NULL; |
643 | struct request *rq = hwif->rq; | 642 | struct request *rq = hwif->rq; |
644 | unsigned int timeout; | 643 | unsigned int timeout; |
@@ -652,12 +651,8 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) | |||
652 | expiry = ide_cd_expiry; | 651 | expiry = ide_cd_expiry; |
653 | timeout = ATAPI_WAIT_PC; | 652 | timeout = ATAPI_WAIT_PC; |
654 | 653 | ||
655 | if (drive->dma) { | 654 | if (drive->dma) |
656 | if (ide_build_sglist(drive, cmd)) | 655 | drive->dma = !ide_dma_prepare(drive, cmd); |
657 | drive->dma = !dma_ops->dma_setup(drive, cmd); | ||
658 | else | ||
659 | drive->dma = 0; | ||
660 | } | ||
661 | } else { | 656 | } else { |
662 | pc = drive->pc; | 657 | pc = drive->pc; |
663 | 658 | ||
@@ -675,13 +670,8 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) | |||
675 | ide_dma_off(drive); | 670 | ide_dma_off(drive); |
676 | } | 671 | } |
677 | 672 | ||
678 | if ((pc->flags & PC_FLAG_DMA_OK) && | 673 | if (pc->flags & PC_FLAG_DMA_OK) |
679 | (drive->dev_flags & IDE_DFLAG_USING_DMA)) { | 674 | drive->dma = !ide_dma_prepare(drive, cmd); |
680 | if (ide_build_sglist(drive, cmd)) | ||
681 | drive->dma = !dma_ops->dma_setup(drive, cmd); | ||
682 | else | ||
683 | drive->dma = 0; | ||
684 | } | ||
685 | 675 | ||
686 | if (!drive->dma) | 676 | if (!drive->dma) |
687 | pc->flags &= ~PC_FLAG_DMA_OK; | 677 | pc->flags &= ~PC_FLAG_DMA_OK; |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index b430898bbcd6..cf5897f5533f 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -128,7 +128,7 @@ int ide_dma_good_drive(ide_drive_t *drive) | |||
128 | * operate in a portable fashion. | 128 | * operate in a portable fashion. |
129 | */ | 129 | */ |
130 | 130 | ||
131 | int ide_build_sglist(ide_drive_t *drive, struct ide_cmd *cmd) | 131 | static int ide_build_sglist(ide_drive_t *drive, struct ide_cmd *cmd) |
132 | { | 132 | { |
133 | ide_hwif_t *hwif = drive->hwif; | 133 | ide_hwif_t *hwif = drive->hwif; |
134 | struct scatterlist *sg = hwif->sg_table; | 134 | struct scatterlist *sg = hwif->sg_table; |
@@ -563,3 +563,12 @@ int ide_allocate_dma_engine(ide_hwif_t *hwif) | |||
563 | return 0; | 563 | return 0; |
564 | } | 564 | } |
565 | EXPORT_SYMBOL_GPL(ide_allocate_dma_engine); | 565 | EXPORT_SYMBOL_GPL(ide_allocate_dma_engine); |
566 | |||
567 | int ide_dma_prepare(ide_drive_t *drive, struct ide_cmd *cmd) | ||
568 | { | ||
569 | if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 || | ||
570 | ide_build_sglist(drive, cmd) == 0 || | ||
571 | drive->hwif->dma_ops->dma_setup(drive, cmd)) | ||
572 | return 1; | ||
573 | return 0; | ||
574 | } | ||
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index a3b7a50562b2..dba68db629bf 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -100,9 +100,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) | |||
100 | ide_execute_command(drive, cmd, handler, WAIT_WORSTCASE); | 100 | ide_execute_command(drive, cmd, handler, WAIT_WORSTCASE); |
101 | return ide_started; | 101 | return ide_started; |
102 | case ATA_PROT_DMA: | 102 | case ATA_PROT_DMA: |
103 | if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 || | 103 | if (ide_dma_prepare(drive, cmd)) |
104 | ide_build_sglist(drive, cmd) == 0 || | ||
105 | dma_ops->dma_setup(drive, cmd)) | ||
106 | return ide_stopped; | 104 | return ide_stopped; |
107 | hwif->expiry = dma_ops->dma_timer_expiry; | 105 | hwif->expiry = dma_ops->dma_timer_expiry; |
108 | ide_execute_command(drive, cmd, ide_dma_intr, 2 * WAIT_CMD); | 106 | ide_execute_command(drive, cmd, ide_dma_intr, 2 * WAIT_CMD); |