ide: pass command to ide_map_sg()
[deliverable/linux.git] / drivers / ide / ide-atapi.c
index c3fd528a1b4d3c42e66f15f4292831ee7c668376..b56af49f876bfdc24d216f9fabc46c409b6a2e2b 100644 (file)
@@ -638,12 +638,20 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive)
 {
        struct ide_atapi_pc *pc;
        ide_hwif_t *hwif = drive->hwif;
+       const struct ide_dma_ops *dma_ops = hwif->dma_ops;
+       struct ide_cmd *cmd = &hwif->cmd;
        ide_expiry_t *expiry = NULL;
        struct request *rq = hwif->rq;
        unsigned int timeout;
        u32 tf_flags;
        u16 bcount;
 
+       if (drive->media != ide_floppy) {
+               if (rq_data_dir(rq))
+                       cmd->tf_flags |= IDE_TFLAG_WRITE;
+               cmd->rq = rq;
+       }
+
        if (dev_is_idecd(drive)) {
                tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL;
                bcount = ide_cd_get_xferlen(rq);
@@ -651,8 +659,8 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive)
                timeout = ATAPI_WAIT_PC;
 
                if (drive->dma) {
-                       if (ide_build_sglist(drive, rq))
-                               drive->dma = !hwif->dma_ops->dma_setup(drive);
+                       if (ide_build_sglist(drive, cmd))
+                               drive->dma = !dma_ops->dma_setup(drive, cmd);
                        else
                                drive->dma = 0;
                }
@@ -675,8 +683,8 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive)
 
                if ((pc->flags & PC_FLAG_DMA_OK) &&
                     (drive->dev_flags & IDE_DFLAG_USING_DMA)) {
-                       if (ide_build_sglist(drive, rq))
-                               drive->dma = !hwif->dma_ops->dma_setup(drive);
+                       if (ide_build_sglist(drive, cmd))
+                               drive->dma = !dma_ops->dma_setup(drive, cmd);
                        else
                                drive->dma = 0;
                }
This page took 0.036871 seconds and 5 git commands to generate.