summaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-atapi.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 12:46:37 +0100
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 12:46:37 +0100
commite6830a86c260d73c6f370aa7ed17ee6c71e5ee05 (patch)
treec2c7d472184da1549852b86eef551609cddcbcbf /drivers/ide/ide-atapi.c
parentide: use blk_fs_request() check in ide-taskfile.c (diff)
downloadlinux-e6830a86c260d73c6f370aa7ed17ee6c71e5ee05.tar.xz
linux-e6830a86c260d73c6f370aa7ed17ee6c71e5ee05.zip
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>
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r--drivers/ide/ide-atapi.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index f72b5a675435..2b9ac2106674 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -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;