ide-cd: unify handling of fs and pc requests in cdrom_decode_status()
[pandora-kernel.git] / drivers / ide / ide-dma-sff.c
index f8adbb5..e4cdf78 100644 (file)
@@ -38,10 +38,9 @@ int config_drive_for_dma(ide_drive_t *drive)
         * Enable DMA on any drive that has mode2 DMA
         * (multi or single) enabled
         */
-       if (id[ATA_ID_FIELD_VALID] & 2) /* regular DMA */
-               if ((id[ATA_ID_MWDMA_MODES] & 0x404) == 0x404 ||
-                   (id[ATA_ID_SWDMA_MODES] & 0x404) == 0x404)
-                       return 1;
+       if ((id[ATA_ID_MWDMA_MODES] & 0x404) == 0x404 ||
+           (id[ATA_ID_SWDMA_MODES] & 0x404) == 0x404)
+               return 1;
 
        /* Consult the list of known "good" drives */
        if (ide_dma_good_drive(drive))
@@ -166,8 +165,6 @@ use_pio_instead:
        printk(KERN_ERR "%s: %s\n", drive->name,
                count ? "DMA table too small" : "empty DMA table?");
 
-       ide_destroy_dmatable(drive);
-
        return 0; /* revert to PIO for this request */
 }
 EXPORT_SYMBOL_GPL(ide_build_dmatable);
@@ -218,7 +215,6 @@ int ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
        /* clear INTR & ERROR flags */
        ide_dma_sff_write_status(hwif, dma_stat | ATA_DMA_ERR | ATA_DMA_INTR);
 
-       drive->waiting_for_dma = 1;
        return 0;
 }
 EXPORT_SYMBOL_GPL(ide_dma_setup);
@@ -281,8 +277,6 @@ void ide_dma_start(ide_drive_t *drive)
                dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
                outb(dma_cmd | ATA_DMA_START, hwif->dma_base + ATA_DMA_CMD);
        }
-
-       wmb();
 }
 EXPORT_SYMBOL_GPL(ide_dma_start);
 
@@ -290,9 +284,7 @@ EXPORT_SYMBOL_GPL(ide_dma_start);
 int ide_dma_end(ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
-       u8 dma_stat = 0, dma_cmd = 0, mask;
-
-       drive->waiting_for_dma = 0;
+       u8 dma_stat = 0, dma_cmd = 0;
 
        /* stop DMA */
        if (hwif->host_flags & IDE_HFLAG_MMIO) {
@@ -310,11 +302,10 @@ int ide_dma_end(ide_drive_t *drive)
        /* clear INTR & ERROR bits */
        ide_dma_sff_write_status(hwif, dma_stat | ATA_DMA_ERR | ATA_DMA_INTR);
 
-       wmb();
+#define CHECK_DMA_MASK (ATA_DMA_ACTIVE | ATA_DMA_ERR | ATA_DMA_INTR)
 
        /* verify good DMA status */
-       mask = ATA_DMA_ACTIVE | ATA_DMA_ERR | ATA_DMA_INTR;
-       if ((dma_stat & mask) != ATA_DMA_INTR)
+       if ((dma_stat & CHECK_DMA_MASK) != ATA_DMA_INTR)
                return 0x10 | dma_stat;
        return 0;
 }