This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / scsi / libata-core.c
index 93d9874..5fdb285 100644 (file)
@@ -1919,7 +1919,24 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
        if (idx)
                ap->prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
 }
+/**
+ *     ata_check_atapi_dma - Check whether ATAPI DMA can be supported
+ *     @qc: Metadata associated with taskfile to check
+ *
+ *     LOCKING:
+ *     RETURNS: 0 when ATAPI DMA can be used
+ *               nonzero otherwise
+ */
+int ata_check_atapi_dma(struct ata_queued_cmd *qc)
+{
+       struct ata_port *ap = qc->ap;
+       int rc = 0; /* Assume ATAPI DMA is OK by default */
+
+       if (ap->ops->check_atapi_dma)
+               rc = ap->ops->check_atapi_dma(qc);
 
+       return rc;
+}
 /**
  *     ata_qc_prep - Prepare taskfile for submission
  *     @qc: Metadata associated with taskfile to be prepared
@@ -2369,6 +2386,9 @@ static void ata_pio_task(void *_data)
        unsigned long timeout = 0;
 
        switch (ap->pio_task_state) {
+       case PIO_ST_IDLE:
+               return;
+
        case PIO_ST:
                ata_pio_block(ap);
                break;
@@ -2385,18 +2405,14 @@ static void ata_pio_task(void *_data)
        case PIO_ST_TMOUT:
        case PIO_ST_ERR:
                ata_pio_error(ap);
-               break;
+               return;
        }
 
-       if ((ap->pio_task_state != PIO_ST_IDLE) &&
-           (ap->pio_task_state != PIO_ST_TMOUT) &&
-           (ap->pio_task_state != PIO_ST_ERR)) {
-               if (timeout)
-                       queue_delayed_work(ata_wq, &ap->pio_task,
-                                          timeout);
-               else
-                       queue_work(ata_wq, &ap->pio_task);
-       }
+       if (timeout)
+               queue_delayed_work(ata_wq, &ap->pio_task,
+                                  timeout);
+       else
+               queue_work(ata_wq, &ap->pio_task);
 }
 
 static void atapi_request_sense(struct ata_port *ap, struct ata_device *dev,
@@ -2405,7 +2421,6 @@ static void atapi_request_sense(struct ata_port *ap, struct ata_device *dev,
        DECLARE_COMPLETION(wait);
        struct ata_queued_cmd *qc;
        unsigned long flags;
-       int using_pio = dev->flags & ATA_DFLAG_PIO;
        int rc;
 
        DPRINTK("ATAPI request sense\n");
@@ -2426,16 +2441,10 @@ static void atapi_request_sense(struct ata_port *ap, struct ata_device *dev,
        qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
        qc->tf.command = ATA_CMD_PACKET;
 
-       if (using_pio) {
-               qc->tf.protocol = ATA_PROT_ATAPI;
-               qc->tf.lbam = (8 * 1024) & 0xff;
-               qc->tf.lbah = (8 * 1024) >> 8;
-
-               qc->nbytes = SCSI_SENSE_BUFFERSIZE;
-       } else {
-               qc->tf.protocol = ATA_PROT_ATAPI_DMA;
-               qc->tf.feature |= ATAPI_PKT_DMA;
-       }
+       qc->tf.protocol = ATA_PROT_ATAPI;
+       qc->tf.lbam = (8 * 1024) & 0xff;
+       qc->tf.lbah = (8 * 1024) >> 8;
+       qc->nbytes = SCSI_SENSE_BUFFERSIZE;
 
        qc->waiting = &wait;
        qc->complete_fn = ata_qc_complete_noop;