ide: add ide_use_fast_pio() helper (v3)
[linux-2.6.git] / drivers / ide / pci / cs5535.c
index 5c5aec2..e47653f 100644 (file)
@@ -196,21 +196,14 @@ static int cs5535_config_drive_for_dma(ide_drive_t *drive)
 static int cs5535_dma_check(ide_drive_t *drive)
 {
        ide_hwif_t *hwif        = drive->hwif;
-       struct hd_driveid *id   = drive->id;
        u8 speed;
 
        drive->init_speed = 0;
 
-       if ((id->capability & 1) && drive->autodma) {
-               if (ide_use_dma(drive)) {
-                       if (cs5535_config_drive_for_dma(drive))
-                               return hwif->ide_dma_on(drive);
-               }
-
-               goto fast_ata_pio;
+       if (ide_use_dma(drive) && cs5535_config_drive_for_dma(drive))
+               return hwif->ide_dma_on(drive);
 
-       } else if ((id->capability & 8) || (id->field_valid & 2)) {
-fast_ata_pio:
+       if (ide_use_fast_pio(drive)) {
                speed = ide_get_best_pio_mode(drive, 255, 4, NULL);
                cs5535_set_drive(drive, speed);
                return hwif->ide_dma_off_quietly(drive);