]> Pileus Git - ~andy/linux/blobdiff - drivers/ide/ide-atapi.c
ide: call ide_build_sglist() prior to ->dma_setup (v2)
[~andy/linux] / drivers / ide / ide-atapi.c
index f72b5a67543596ffc813de5f48542ba94238ee2a..2b9ac2106674d8827ac8b3f3c1343dd2007ab14b 100644 (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;