ide: call ide_build_sglist() prior to ->dma_setup (v2)

* Re-map sg table if needed in ide_build_sglist().

* Move ide_build_sglist() call from ->dma_setup to its users.

* Un-export ide_build_sglist().

v2:
* Build fix for CONFIG_BLK_DEV_IDEDMA=n (noticed by Randy Dunlap).

There should be no functional changes caused by this patch.

Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
Bartlomiej Zolnierkiewicz
2009-03-27 12:46:37 +01:00
parent b109f526ca
commit e6830a86c2
10 changed files with 24 additions and 41 deletions

View File

@ -631,18 +631,23 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive)
struct ide_atapi_pc *pc;
ide_hwif_t *hwif = drive->hwif;
ide_expiry_t *expiry = NULL;
struct request *rq = hwif->rq;
unsigned int timeout;
u32 tf_flags;
u16 bcount;
if (dev_is_idecd(drive)) {
tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL;
bcount = ide_cd_get_xferlen(hwif->rq);
bcount = ide_cd_get_xferlen(rq);
expiry = ide_cd_expiry;
timeout = ATAPI_WAIT_PC;
if (drive->dma)
drive->dma = !hwif->dma_ops->dma_setup(drive);
if (drive->dma) {
if (ide_build_sglist(drive, rq))
drive->dma = !hwif->dma_ops->dma_setup(drive);
else
drive->dma = 0;
}
} else {
pc = drive->pc;
@ -661,8 +666,12 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive)
}
if ((pc->flags & PC_FLAG_DMA_OK) &&
(drive->dev_flags & IDE_DFLAG_USING_DMA))
drive->dma = !hwif->dma_ops->dma_setup(drive);
(drive->dev_flags & IDE_DFLAG_USING_DMA)) {
if (ide_build_sglist(drive, rq))
drive->dma = !hwif->dma_ops->dma_setup(drive);
else
drive->dma = 0;
}
if (!drive->dma)
pc->flags &= ~PC_FLAG_DMA_OK;