Skip to contentSkip to conversation

hpt34x: fix CONFIG_HPT34X_AUTODMA=n handling

PATCH In review Bartlomiej Zolnierkiewicz 1 participant 1 message Aug 4, 2007 libata

lore
Share & tools
lore
#0 lore raw

PATCH 4/11 hpt34x: fix CONFIG_HPT34X_AUTODMA=n handling

Programming DMA mode may destroy current PIO mode setting so if CONFIG_HPT34X_AUTODMA=n (the default case) make ide_tune_dma() fail early by disabling all host DMA masks and re-tune PIO mode.

This fix doesn't help with the driver being broken but is needed for some other changes.

---
 drivers/ide/pci/hpt34x.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/ide/pci/hpt34x.c +2 -4
Index: b/drivers/ide/pci/hpt34x.c
===================================================================
@@ -85,11 +85,7 @@ static int hpt34x_config_drive_xfer_rate
 	drive->init_speed = 0;
 
 	if (ide_tune_dma(drive))
-#ifndef CONFIG_HPT34X_AUTODMA
 		return -1;
-#else
-		return 0;
-#endif
 
 	if (ide_use_fast_pio(drive))
 		ide_set_max_pio(drive);
@@ -157,9 +153,11 @@ static void __devinit init_hwif_hpt34x(i
 	if (!hwif->dma_base)
 		return;
 
+#ifdef CONFIG_HPT34X_AUTODMA
 	hwif->ultra_mask = 0x07;
 	hwif->mwdma_mask = 0x07;
 	hwif->swdma_mask = 0x07;
+#endif
 
 	hwif->ide_dma_check = &hpt34x_config_drive_xfer_rate;
 	if (!noautodma)