vserver 1.9.3
[linux-2.6.git] / drivers / ide / ide-dma.c
index 6ed4de8..cd32057 100644 (file)
@@ -208,9 +208,6 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq)
        struct scatterlist *sg = hwif->sg_table;
        int nents;
 
-       if (hwif->sg_dma_active)
-               BUG();
-
        nents = blk_rq_map_sg(drive->queue, rq, hwif->sg_table);
                
        if (rq_data_dir(rq) == READ)
@@ -366,7 +363,6 @@ use_pio_instead:
                     hwif->sg_table,
                     hwif->sg_nents,
                     hwif->sg_dma_direction);
-       hwif->sg_dma_active = 0;
        return 0; /* revert to PIO for this request */
 }
 
@@ -390,7 +386,6 @@ void ide_destroy_dmatable (ide_drive_t *drive)
        int nents = HWIF(drive)->sg_nents;
 
        pci_unmap_sg(dev, sg, nents, HWIF(drive)->sg_dma_direction);
-       HWIF(drive)->sg_dma_active = 0;
 }
 
 EXPORT_SYMBOL_GPL(ide_destroy_dmatable);
@@ -412,10 +407,6 @@ static int config_drive_for_dma (ide_drive_t *drive)
        ide_hwif_t *hwif = HWIF(drive);
 
        if ((id->capability & 1) && hwif->autodma) {
-               /* Consult the list of known "bad" drives */
-               if (__ide_dma_bad_drive(drive))
-                       return __ide_dma_off(drive);
-
                /*
                 * Enable DMA on any drive that has
                 * UltraDMA (mode 0/1/2/3/4/5/6) enabled
@@ -569,6 +560,10 @@ EXPORT_SYMBOL(__ide_dma_host_on);
  
 int __ide_dma_on (ide_drive_t *drive)
 {
+       /* consult the list of known "bad" drives */
+       if (__ide_dma_bad_drive(drive))
+               return 1;
+
        drive->using_dma = 1;
        ide_toggle_bounce(drive, 1);