]> err.no Git - linux-2.6/blobdiff - drivers/ata/libata-scsi.c
Merge branch 'upstream-jgarzik' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6] / drivers / ata / libata-scsi.c
index c228df298bd898ae6e1379d31dc6d6c9dc41eb1a..cfde22da07ac9aa3537e22b88935c4f56bf57e70 100644 (file)
@@ -2384,11 +2384,6 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
        int using_pio = (dev->flags & ATA_DFLAG_PIO);
        int nodata = (scmd->sc_data_direction == DMA_NONE);
 
-       if (!using_pio)
-               /* Check whether ATAPI DMA is safe */
-               if (ata_check_atapi_dma(qc))
-                       using_pio = 1;
-
        memset(qc->cdb, 0, dev->cdb_len);
        memcpy(qc->cdb, scmd->cmnd, scmd->cmd_len);
 
@@ -2401,19 +2396,22 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
        }
 
        qc->tf.command = ATA_CMD_PACKET;
+       qc->nbytes = scmd->request_bufflen;
+
+       /* check whether ATAPI DMA is safe */
+       if (!using_pio && ata_check_atapi_dma(qc))
+               using_pio = 1;
 
-       /* no data, or PIO data xfer */
        if (using_pio || nodata) {
+               /* no data, or PIO data xfer */
                if (nodata)
                        qc->tf.protocol = ATA_PROT_ATAPI_NODATA;
                else
                        qc->tf.protocol = ATA_PROT_ATAPI;
                qc->tf.lbam = (8 * 1024) & 0xff;
                qc->tf.lbah = (8 * 1024) >> 8;
-       }
-
-       /* DMA data xfer */
-       else {
+       } else {
+               /* DMA data xfer */
                qc->tf.protocol = ATA_PROT_ATAPI_DMA;
                qc->tf.feature |= ATAPI_PKT_DMA;
 
@@ -2422,8 +2420,6 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
                        qc->tf.feature |= ATAPI_DMADIR;
        }
 
-       qc->nbytes = scmd->request_bufflen;
-
        return 0;
 }
 
@@ -2624,7 +2620,7 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
                        ata_dev_printk(dev, KERN_WARNING,
                                       "invalid multi_count %u ignored\n",
                                       multi_count);
-       }       
+       }
 
        /* READ/WRITE LONG use a non-standard sect_size */
        qc->sect_size = ATA_SECT_SIZE;