aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-02-16 20:40:26 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-02-16 20:40:26 -0500
commit3608b5d71a52c053787dbad6af20c25f7e0b75a9 (patch)
tree5bd6ac777d32d8426e65e3c31cc1587674771e8c /drivers/ide/pci
parent9ef5791e1be91007951477b8ed1530ac1166a8e7 (diff)
ide: add ide_set_dma() helper (v2)
* add ide_set_dma() helper and make ide_hwif_t.ide_dma_check return -1 when DMA needs to be disabled (== need to call ->ide_dma_off_quietly) 0 when DMA needs to be enabled (== need to call ->ide_dma_on) 1 when DMA setting shouldn't be changed * fix IDE code to use ide_set_dma() instead if using ->ide_dma_check directly v2: * updated for scc_pata Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r--drivers/ide/pci/aec62xx.c6
-rw-r--r--drivers/ide/pci/alim15x3.c11
-rw-r--r--drivers/ide/pci/amd74xx.c5
-rw-r--r--drivers/ide/pci/atiixp.c7
-rw-r--r--drivers/ide/pci/cmd64x.c6
-rw-r--r--drivers/ide/pci/cs5520.c5
-rw-r--r--drivers/ide/pci/cs5530.c5
-rw-r--r--drivers/ide/pci/cs5535.c5
-rw-r--r--drivers/ide/pci/hpt34x.c8
-rw-r--r--drivers/ide/pci/hpt366.c6
-rw-r--r--drivers/ide/pci/it8213.c14
-rw-r--r--drivers/ide/pci/it821x.c12
-rw-r--r--drivers/ide/pci/jmicron.c10
-rw-r--r--drivers/ide/pci/ns87415.c3
-rw-r--r--drivers/ide/pci/pdc202xx_new.c8
-rw-r--r--drivers/ide/pci/pdc202xx_old.c6
-rw-r--r--drivers/ide/pci/piix.c10
-rw-r--r--drivers/ide/pci/sc1200.c5
-rw-r--r--drivers/ide/pci/serverworks.c6
-rw-r--r--drivers/ide/pci/sgiioc4.c4
-rw-r--r--drivers/ide/pci/siimage.c6
-rw-r--r--drivers/ide/pci/sis5513.c6
-rw-r--r--drivers/ide/pci/sl82c105.c6
-rw-r--r--drivers/ide/pci/slc90e66.c10
-rw-r--r--drivers/ide/pci/tc86c001.c6
-rw-r--r--drivers/ide/pci/triflex.c9
-rw-r--r--drivers/ide/pci/via82cxxx.c5
27 files changed, 76 insertions, 114 deletions
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index 25892814b314..990eafe5ea11 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -209,15 +209,13 @@ static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio)
209 209
210static int aec62xx_config_drive_xfer_rate (ide_drive_t *drive) 210static int aec62xx_config_drive_xfer_rate (ide_drive_t *drive)
211{ 211{
212 ide_hwif_t *hwif = HWIF(drive);
213
214 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 212 if (ide_use_dma(drive) && config_chipset_for_dma(drive))
215 return hwif->ide_dma_on(drive); 213 return 0;
216 214
217 if (ide_use_fast_pio(drive)) 215 if (ide_use_fast_pio(drive))
218 aec62xx_tune_drive(drive, 5); 216 aec62xx_tune_drive(drive, 5);
219 217
220 return hwif->ide_dma_off_quietly(drive); 218 return -1;
221} 219}
222 220
223static int aec62xx_irq_timeout (ide_drive_t *drive) 221static int aec62xx_irq_timeout (ide_drive_t *drive)
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 2baed4e04beb..4debd18d52f8 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -507,17 +507,15 @@ static int config_chipset_for_dma (ide_drive_t *drive)
507 * 507 *
508 * Configure a drive for DMA operation. If DMA is not possible we 508 * Configure a drive for DMA operation. If DMA is not possible we
509 * drop the drive into PIO mode instead. 509 * drop the drive into PIO mode instead.
510 *
511 * FIXME: exactly what are we trying to return here
512 */ 510 */
513 511
514static int ali15x3_config_drive_for_dma(ide_drive_t *drive) 512static int ali15x3_config_drive_for_dma(ide_drive_t *drive)
515{ 513{
516 ide_hwif_t *hwif = HWIF(drive); 514 ide_hwif_t *hwif = HWIF(drive);
517 struct hd_driveid *id = drive->id; 515 struct hd_driveid *id = drive->id;
518 516
519 if ((m5229_revision<=0x20) && (drive->media!=ide_disk)) 517 if ((m5229_revision<=0x20) && (drive->media!=ide_disk))
520 return hwif->ide_dma_off_quietly(drive); 518 goto no_dma_set;
521 519
522 drive->init_speed = 0; 520 drive->init_speed = 0;
523 521
@@ -552,9 +550,10 @@ try_dma_modes:
552ata_pio: 550ata_pio:
553 hwif->tuneproc(drive, 255); 551 hwif->tuneproc(drive, 255);
554no_dma_set: 552no_dma_set:
555 return hwif->ide_dma_off_quietly(drive); 553 return -1;
556 } 554 }
557 return hwif->ide_dma_on(drive); 555
556 return 0;
558} 557}
559 558
560/** 559/**
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index a4336995a410..7989bdd842a2 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -304,8 +304,9 @@ static int amd74xx_ide_dma_check(ide_drive_t *drive)
304 amd_set_drive(drive, speed); 304 amd_set_drive(drive, speed);
305 305
306 if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) 306 if (drive->autodma && (speed & XFER_MODE) != XFER_PIO)
307 return HWIF(drive)->ide_dma_on(drive); 307 return 0;
308 return HWIF(drive)->ide_dma_off_quietly(drive); 308
309 return -1;
309} 310}
310 311
311/* 312/*
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
index 6d372c4e1d81..e7b4415adc83 100644
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -252,21 +252,20 @@ static int atiixp_config_drive_for_dma(ide_drive_t *drive)
252 252
253static int atiixp_dma_check(ide_drive_t *drive) 253static int atiixp_dma_check(ide_drive_t *drive)
254{ 254{
255 ide_hwif_t *hwif = HWIF(drive);
256 u8 tspeed, speed; 255 u8 tspeed, speed;
257 256
258 drive->init_speed = 0; 257 drive->init_speed = 0;
259 258
260 if (ide_use_dma(drive) && atiixp_config_drive_for_dma(drive)) 259 if (ide_use_dma(drive) && atiixp_config_drive_for_dma(drive))
261 return hwif->ide_dma_on(drive); 260 return 0;
262 261
263 if (ide_use_fast_pio(drive)) { 262 if (ide_use_fast_pio(drive)) {
264 tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL); 263 tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL);
265 speed = atiixp_dma_2_pio(XFER_PIO_0 + tspeed) + XFER_PIO_0; 264 speed = atiixp_dma_2_pio(XFER_PIO_0 + tspeed) + XFER_PIO_0;
266 hwif->speedproc(drive, speed); 265 atiixp_speedproc(drive, speed);
267 } 266 }
268 267
269 return hwif->ide_dma_off_quietly(drive); 268 return -1;
270} 269}
271 270
272/** 271/**
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 28f580886693..49df27513da7 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -474,15 +474,13 @@ static int config_chipset_for_dma (ide_drive_t *drive)
474 474
475static int cmd64x_config_drive_for_dma (ide_drive_t *drive) 475static int cmd64x_config_drive_for_dma (ide_drive_t *drive)
476{ 476{
477 ide_hwif_t *hwif = HWIF(drive);
478
479 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 477 if (ide_use_dma(drive) && config_chipset_for_dma(drive))
480 return hwif->ide_dma_on(drive); 478 return 0;
481 479
482 if (ide_use_fast_pio(drive)) 480 if (ide_use_fast_pio(drive))
483 config_chipset_for_pio(drive, 1); 481 config_chipset_for_pio(drive, 1);
484 482
485 return hwif->ide_dma_off_quietly(drive); 483 return -1;
486} 484}
487 485
488static int cmd64x_alt_dma_status (struct pci_dev *dev) 486static int cmd64x_alt_dma_status (struct pci_dev *dev)
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
index ba6786aabf3b..400859a839f7 100644
--- a/drivers/ide/pci/cs5520.c
+++ b/drivers/ide/pci/cs5520.c
@@ -132,12 +132,11 @@ static void cs5520_tune_drive(ide_drive_t *drive, u8 pio)
132 132
133static int cs5520_config_drive_xfer_rate(ide_drive_t *drive) 133static int cs5520_config_drive_xfer_rate(ide_drive_t *drive)
134{ 134{
135 ide_hwif_t *hwif = HWIF(drive);
136
137 /* Tune the drive for PIO modes up to PIO 4 */ 135 /* Tune the drive for PIO modes up to PIO 4 */
138 cs5520_tune_drive(drive, 4); 136 cs5520_tune_drive(drive, 4);
137
139 /* Then tell the core to use DMA operations */ 138 /* Then tell the core to use DMA operations */
140 return hwif->ide_dma_on(drive); 139 return 0;
141} 140}
142 141
143/* 142/*
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index 68b5d278ca01..ff909cfb96b6 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -196,10 +196,7 @@ static int cs5530_config_dma (ide_drive_t *drive)
196 outl(timings, basereg + 12); /* write drive1 config register */ 196 outl(timings, basereg + 12); /* write drive1 config register */
197 } 197 }
198 198
199 /* 199 return 0; /* success */
200 * Finally, turn DMA on in software, and exit.
201 */
202 return hwif->ide_dma_on(drive); /* success */
203} 200}
204 201
205/** 202/**
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index cd7c4190ad6e..45f43efbf92c 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -195,20 +195,19 @@ static int cs5535_config_drive_for_dma(ide_drive_t *drive)
195 195
196static int cs5535_dma_check(ide_drive_t *drive) 196static int cs5535_dma_check(ide_drive_t *drive)
197{ 197{
198 ide_hwif_t *hwif = drive->hwif;
199 u8 speed; 198 u8 speed;
200 199
201 drive->init_speed = 0; 200 drive->init_speed = 0;
202 201
203 if (ide_use_dma(drive) && cs5535_config_drive_for_dma(drive)) 202 if (ide_use_dma(drive) && cs5535_config_drive_for_dma(drive))
204 return hwif->ide_dma_on(drive); 203 return 0;
205 204
206 if (ide_use_fast_pio(drive)) { 205 if (ide_use_fast_pio(drive)) {
207 speed = ide_get_best_pio_mode(drive, 255, 4, NULL); 206 speed = ide_get_best_pio_mode(drive, 255, 4, NULL);
208 cs5535_set_drive(drive, speed); 207 cs5535_set_drive(drive, speed);
209 } 208 }
210 209
211 return hwif->ide_dma_off_quietly(drive); 210 return -1;
212} 211}
213 212
214static u8 __devinit cs5535_cable_detect(struct pci_dev *dev) 213static u8 __devinit cs5535_cable_detect(struct pci_dev *dev)
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
index c65971d8d6ad..924eaa3a5708 100644
--- a/drivers/ide/pci/hpt34x.c
+++ b/drivers/ide/pci/hpt34x.c
@@ -109,21 +109,19 @@ static int config_chipset_for_dma (ide_drive_t *drive)
109 109
110static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive) 110static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive)
111{ 111{
112 ide_hwif_t *hwif = HWIF(drive);
113
114 drive->init_speed = 0; 112 drive->init_speed = 0;
115 113
116 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 114 if (ide_use_dma(drive) && config_chipset_for_dma(drive))
117#ifndef CONFIG_HPT34X_AUTODMA 115#ifndef CONFIG_HPT34X_AUTODMA
118 return hwif->ide_dma_off_quietly(drive); 116 return -1;
119#else 117#else
120 return hwif->ide_dma_on(drive); 118 return 0;
121#endif 119#endif
122 120
123 if (ide_use_fast_pio(drive)) 121 if (ide_use_fast_pio(drive))
124 hpt34x_tune_drive(drive, 255); 122 hpt34x_tune_drive(drive, 255);
125 123
126 return hwif->ide_dma_off_quietly(drive); 124 return -1;
127} 125}
128 126
129/* 127/*
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 752b6d6dde04..60ecdc258c7c 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -736,17 +736,15 @@ static void hpt3xx_maskproc(ide_drive_t *drive, int mask)
736 736
737static int hpt366_config_drive_xfer_rate(ide_drive_t *drive) 737static int hpt366_config_drive_xfer_rate(ide_drive_t *drive)
738{ 738{
739 ide_hwif_t *hwif = HWIF(drive);
740
741 drive->init_speed = 0; 739 drive->init_speed = 0;
742 740
743 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 741 if (ide_use_dma(drive) && config_chipset_for_dma(drive))
744 return hwif->ide_dma_on(drive); 742 return 0;
745 743
746 if (ide_use_fast_pio(drive)) 744 if (ide_use_fast_pio(drive))
747 hpt3xx_tune_drive(drive, 255); 745 hpt3xx_tune_drive(drive, 255);
748 746
749 return hwif->ide_dma_off_quietly(drive); 747 return -1;
750} 748}
751 749
752/* 750/*
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c
index 63248b6909fa..424f00bb160d 100644
--- a/drivers/ide/pci/it8213.c
+++ b/drivers/ide/pci/it8213.c
@@ -244,17 +244,15 @@ static int config_chipset_for_dma (ide_drive_t *drive)
244 244
245static int it8213_config_drive_for_dma (ide_drive_t *drive) 245static int it8213_config_drive_for_dma (ide_drive_t *drive)
246{ 246{
247 ide_hwif_t *hwif = drive->hwif; 247 u8 pio;
248 248
249 if (ide_use_dma(drive)) { 249 if (ide_use_dma(drive) && config_chipset_for_dma(drive))
250 if (config_chipset_for_dma(drive)) 250 return 0;
251 return hwif->ide_dma_on(drive);
252 }
253 251
254 hwif->speedproc(drive, XFER_PIO_0 252 pio = ide_get_best_pio_mode(drive, 255, 4, NULL);
255 + ide_get_best_pio_mode(drive, 255, 4, NULL)); 253 it8213_tune_chipset(drive, XFER_PIO_0 + pio);
256 254
257 return hwif->ide_dma_off_quietly(drive); 255 return -1;
258} 256}
259 257
260/** 258/**
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index e9bad185968a..35ee17df3f8d 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -520,14 +520,12 @@ static int config_chipset_for_dma (ide_drive_t *drive)
520 520
521static int it821x_config_drive_for_dma (ide_drive_t *drive) 521static int it821x_config_drive_for_dma (ide_drive_t *drive)
522{ 522{
523 ide_hwif_t *hwif = drive->hwif; 523 if (ide_use_dma(drive) && config_chipset_for_dma(drive))
524 return 0;
524 525
525 if (ide_use_dma(drive)) {
526 if (config_chipset_for_dma(drive))
527 return hwif->ide_dma_on(drive);
528 }
529 config_it821x_chipset_for_pio(drive, 1); 526 config_it821x_chipset_for_pio(drive, 1);
530 return hwif->ide_dma_off_quietly(drive); 527
528 return -1;
531} 529}
532 530
533/** 531/**
@@ -612,7 +610,7 @@ static void __devinit it821x_fixups(ide_hwif_t *hwif)
612#ifdef CONFIG_IDEDMA_ONLYDISK 610#ifdef CONFIG_IDEDMA_ONLYDISK
613 if (drive->media == ide_disk) 611 if (drive->media == ide_disk)
614#endif 612#endif
615 hwif->ide_dma_check(drive); 613 ide_set_dma(drive);
616 } else { 614 } else {
617 /* Non RAID volume. Fixups to stop the core code 615 /* Non RAID volume. Fixups to stop the core code
618 doing unsupported things */ 616 doing unsupported things */
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c
index 75c2b409908c..53f25500c22b 100644
--- a/drivers/ide/pci/jmicron.c
+++ b/drivers/ide/pci/jmicron.c
@@ -164,14 +164,12 @@ static int config_chipset_for_dma (ide_drive_t *drive)
164 164
165static int jmicron_config_drive_for_dma (ide_drive_t *drive) 165static int jmicron_config_drive_for_dma (ide_drive_t *drive)
166{ 166{
167 ide_hwif_t *hwif = drive->hwif; 167 if (ide_use_dma(drive) && config_chipset_for_dma(drive))
168 return 0;
168 169
169 if (ide_use_dma(drive)) {
170 if (config_chipset_for_dma(drive))
171 return hwif->ide_dma_on(drive);
172 }
173 config_jmicron_chipset_for_pio(drive, 1); 170 config_jmicron_chipset_for_pio(drive, 1);
174 return hwif->ide_dma_off_quietly(drive); 171
172 return -1;
175} 173}
176 174
177/** 175/**
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index 7f2090fac6cb..b310c4f51077 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -190,7 +190,8 @@ static int ns87415_ide_dma_setup(ide_drive_t *drive)
190static int ns87415_ide_dma_check (ide_drive_t *drive) 190static int ns87415_ide_dma_check (ide_drive_t *drive)
191{ 191{
192 if (drive->media != ide_disk) 192 if (drive->media != ide_disk)
193 return HWIF(drive)->ide_dma_off_quietly(drive); 193 return -1;
194
194 return __ide_dma_check(drive); 195 return __ide_dma_check(drive);
195} 196}
196 197
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index b780e15e9f32..6ceb25bc5a7b 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -281,17 +281,15 @@ static int config_chipset_for_dma(ide_drive_t *drive)
281 281
282static int pdcnew_config_drive_xfer_rate(ide_drive_t *drive) 282static int pdcnew_config_drive_xfer_rate(ide_drive_t *drive)
283{ 283{
284 ide_hwif_t *hwif = HWIF(drive);
285
286 drive->init_speed = 0; 284 drive->init_speed = 0;
287 285
288 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 286 if (ide_use_dma(drive) && config_chipset_for_dma(drive))
289 return hwif->ide_dma_on(drive); 287 return 0;
290 288
291 if (ide_use_fast_pio(drive)) 289 if (ide_use_fast_pio(drive))
292 hwif->tuneproc(drive, 255); 290 pdcnew_tune_drive(drive, 255);
293 291
294 return hwif->ide_dma_off_quietly(drive); 292 return -1;
295} 293}
296 294
297static int pdcnew_quirkproc(ide_drive_t *drive) 295static int pdcnew_quirkproc(ide_drive_t *drive)
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index b2b8e6ea7e90..a7a639fe1eaf 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -322,17 +322,15 @@ chipset_is_set:
322 322
323static int pdc202xx_config_drive_xfer_rate (ide_drive_t *drive) 323static int pdc202xx_config_drive_xfer_rate (ide_drive_t *drive)
324{ 324{
325 ide_hwif_t *hwif = HWIF(drive);
326
327 drive->init_speed = 0; 325 drive->init_speed = 0;
328 326
329 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 327 if (ide_use_dma(drive) && config_chipset_for_dma(drive))
330 return hwif->ide_dma_on(drive); 328 return 0;
331 329
332 if (ide_use_fast_pio(drive)) 330 if (ide_use_fast_pio(drive))
333 pdc202xx_tune_drive(drive, 255); 331 pdc202xx_tune_drive(drive, 255);
334 332
335 return hwif->ide_dma_off_quietly(drive); 333 return -1;
336} 334}
337 335
338static int pdc202xx_quirkproc (ide_drive_t *drive) 336static int pdc202xx_quirkproc (ide_drive_t *drive)
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index caf606a1ee86..569822f4cf55 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -386,19 +386,17 @@ static int piix_config_drive_for_dma (ide_drive_t *drive)
386 386
387static int piix_config_drive_xfer_rate (ide_drive_t *drive) 387static int piix_config_drive_xfer_rate (ide_drive_t *drive)
388{ 388{
389 ide_hwif_t *hwif = HWIF(drive);
390
391 drive->init_speed = 0; 389 drive->init_speed = 0;
392 390
393 if (ide_use_dma(drive) && piix_config_drive_for_dma(drive)) 391 if (ide_use_dma(drive) && piix_config_drive_for_dma(drive))
394 return hwif->ide_dma_on(drive); 392 return 0;
395 393
396 if (ide_use_fast_pio(drive)) 394 if (ide_use_fast_pio(drive))
397 /* Find best PIO mode. */ 395 /* Find best PIO mode. */
398 (void) hwif->speedproc(drive, XFER_PIO_0 + 396 piix_tune_chipset(drive, XFER_PIO_0 +
399 ide_get_best_pio_mode(drive, 255, 4, NULL)); 397 ide_get_best_pio_mode(drive, 255, 4, NULL));
400 398
401 return hwif->ide_dma_off_quietly(drive); 399 return -1;
402} 400}
403 401
404/** 402/**
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index 8d762d323f8b..08e317f281e7 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -241,10 +241,7 @@ static int sc1200_config_dma2 (ide_drive_t *drive, int mode)
241 241
242 outb(inb(hwif->dma_base+2)|(unit?0x40:0x20), hwif->dma_base+2); /* set DMA_capable bit */ 242 outb(inb(hwif->dma_base+2)|(unit?0x40:0x20), hwif->dma_base+2); /* set DMA_capable bit */
243 243
244 /* 244 return 0; /* success */
245 * Finally, turn DMA on in software, and exit.
246 */
247 return hwif->ide_dma_on(drive); /* success */
248} 245}
249 246
250/* 247/*
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index f44a5ab8fe00..dbcd37a0c652 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -315,17 +315,15 @@ static int config_chipset_for_dma (ide_drive_t *drive)
315 315
316static int svwks_config_drive_xfer_rate (ide_drive_t *drive) 316static int svwks_config_drive_xfer_rate (ide_drive_t *drive)
317{ 317{
318 ide_hwif_t *hwif = HWIF(drive);
319
320 drive->init_speed = 0; 318 drive->init_speed = 0;
321 319
322 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 320 if (ide_use_dma(drive) && config_chipset_for_dma(drive))
323 return hwif->ide_dma_on(drive); 321 return 0;
324 322
325 if (ide_use_fast_pio(drive)) 323 if (ide_use_fast_pio(drive))
326 config_chipset_for_pio(drive); 324 config_chipset_for_pio(drive);
327 325
328 return hwif->ide_dma_off_quietly(drive); 326 return -1;
329} 327}
330 328
331static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const char *name) 329static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const char *name)
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index 290697e09e55..cb5c3211bd8e 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -296,9 +296,9 @@ static int sgiioc4_ide_dma_check(ide_drive_t *drive)
296 if (ide_config_drive_speed(drive, XFER_MW_DMA_2) != 0) { 296 if (ide_config_drive_speed(drive, XFER_MW_DMA_2) != 0) {
297 printk(KERN_WARNING "%s: couldn't set MWDMA2 mode, " 297 printk(KERN_WARNING "%s: couldn't set MWDMA2 mode, "
298 "using PIO instead\n", drive->name); 298 "using PIO instead\n", drive->name);
299 return sgiioc4_ide_dma_off_quietly(drive); 299 return -1;
300 } else 300 } else
301 return sgiioc4_ide_dma_on(drive); 301 return 0;
302} 302}
303 303
304/* returns 1 if dma irq issued, 0 otherwise */ 304/* returns 1 if dma irq issued, 0 otherwise */
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 1e5b8b17e6d8..7b4c189a9d99 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -414,15 +414,13 @@ static int config_chipset_for_dma (ide_drive_t *drive)
414 414
415static int siimage_config_drive_for_dma (ide_drive_t *drive) 415static int siimage_config_drive_for_dma (ide_drive_t *drive)
416{ 416{
417 ide_hwif_t *hwif = HWIF(drive);
418
419 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 417 if (ide_use_dma(drive) && config_chipset_for_dma(drive))
420 return hwif->ide_dma_on(drive); 418 return 0;
421 419
422 if (ide_use_fast_pio(drive)) 420 if (ide_use_fast_pio(drive))
423 config_chipset_for_pio(drive, 1); 421 config_chipset_for_pio(drive, 1);
424 422
425 return hwif->ide_dma_off_quietly(drive); 423 return -1;
426} 424}
427 425
428/* returns 1 if dma irq issued, 0 otherwise */ 426/* returns 1 if dma irq issued, 0 otherwise */
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 53ffeced06ff..2ba0669f36a1 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -669,19 +669,17 @@ static int config_chipset_for_dma (ide_drive_t *drive)
669 669
670static int sis5513_config_xfer_rate(ide_drive_t *drive) 670static int sis5513_config_xfer_rate(ide_drive_t *drive)
671{ 671{
672 ide_hwif_t *hwif = HWIF(drive);
673
674 config_art_rwp_pio(drive, 5); 672 config_art_rwp_pio(drive, 5);
675 673
676 drive->init_speed = 0; 674 drive->init_speed = 0;
677 675
678 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 676 if (ide_use_dma(drive) && config_chipset_for_dma(drive))
679 return hwif->ide_dma_on(drive); 677 return 0;
680 678
681 if (ide_use_fast_pio(drive)) 679 if (ide_use_fast_pio(drive))
682 sis5513_tune_drive(drive, 5); 680 sis5513_tune_drive(drive, 5);
683 681
684 return hwif->ide_dma_off_quietly(drive); 682 return -1;
685} 683}
686 684
687/* Chip detection and general config */ 685/* Chip detection and general config */
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index c7025858f237..27b21e120260 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -161,14 +161,14 @@ static int sl82c105_check_drive (ide_drive_t *drive)
161 if (id->field_valid & 2) { 161 if (id->field_valid & 2) {
162 if ((id->dma_mword & hwif->mwdma_mask) || 162 if ((id->dma_mword & hwif->mwdma_mask) ||
163 (id->dma_1word & hwif->swdma_mask)) 163 (id->dma_1word & hwif->swdma_mask))
164 return hwif->ide_dma_on(drive); 164 return 0;
165 } 165 }
166 166
167 if (__ide_dma_good_drive(drive) && id->eide_dma_time < 150) 167 if (__ide_dma_good_drive(drive) && id->eide_dma_time < 150)
168 return hwif->ide_dma_on(drive); 168 return 0;
169 } while (0); 169 } while (0);
170 170
171 return hwif->ide_dma_off_quietly(drive); 171 return -1;
172} 172}
173 173
174/* 174/*
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
index 917cc8e61e47..ae7eb58d961c 100644
--- a/drivers/ide/pci/slc90e66.c
+++ b/drivers/ide/pci/slc90e66.c
@@ -179,18 +179,16 @@ static int slc90e66_config_drive_for_dma (ide_drive_t *drive)
179 179
180static int slc90e66_config_drive_xfer_rate (ide_drive_t *drive) 180static int slc90e66_config_drive_xfer_rate (ide_drive_t *drive)
181{ 181{
182 ide_hwif_t *hwif = HWIF(drive);
183
184 drive->init_speed = 0; 182 drive->init_speed = 0;
185 183
186 if (ide_use_dma(drive) && slc90e66_config_drive_for_dma(drive)) 184 if (ide_use_dma(drive) && slc90e66_config_drive_for_dma(drive))
187 return hwif->ide_dma_on(drive); 185 return 0;
188 186
189 if (ide_use_fast_pio(drive)) 187 if (ide_use_fast_pio(drive))
190 (void) hwif->speedproc(drive, XFER_PIO_0 + 188 (void)slc90e66_tune_chipset(drive, XFER_PIO_0 +
191 ide_get_best_pio_mode(drive, 255, 4, NULL)); 189 ide_get_best_pio_mode(drive, 255, 4, NULL));
192 190
193 return hwif->ide_dma_off_quietly(drive); 191 return -1;
194} 192}
195 193
196static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) 194static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c
index 3703fc87d150..0b6d81d6ce48 100644
--- a/drivers/ide/pci/tc86c001.c
+++ b/drivers/ide/pci/tc86c001.c
@@ -185,15 +185,13 @@ static int config_chipset_for_dma(ide_drive_t *drive)
185 185
186static int tc86c001_config_drive_xfer_rate(ide_drive_t *drive) 186static int tc86c001_config_drive_xfer_rate(ide_drive_t *drive)
187{ 187{
188 ide_hwif_t *hwif = HWIF(drive);
189
190 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 188 if (ide_use_dma(drive) && config_chipset_for_dma(drive))
191 return hwif->ide_dma_on(drive); 189 return 0;
192 190
193 if (ide_use_fast_pio(drive)) 191 if (ide_use_fast_pio(drive))
194 tc86c001_tune_drive(drive, 255); 192 tc86c001_tune_drive(drive, 255);
195 193
196 return hwif->ide_dma_off_quietly(drive); 194 return -1;
197} 195}
198 196
199static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif) 197static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif)
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
index 1f5f6759fef8..5e06179c3469 100644
--- a/drivers/ide/pci/triflex.c
+++ b/drivers/ide/pci/triflex.c
@@ -113,13 +113,12 @@ static int triflex_config_drive_for_dma(ide_drive_t *drive)
113 113
114static int triflex_config_drive_xfer_rate(ide_drive_t *drive) 114static int triflex_config_drive_xfer_rate(ide_drive_t *drive)
115{ 115{
116 ide_hwif_t *hwif = HWIF(drive);
117
118 if (ide_use_dma(drive) && triflex_config_drive_for_dma(drive)) 116 if (ide_use_dma(drive) && triflex_config_drive_for_dma(drive))
119 return hwif->ide_dma_on(drive); 117 return 0;
118
119 triflex_tune_drive(drive, 255);
120 120
121 hwif->tuneproc(drive, 255); 121 return -1;
122 return hwif->ide_dma_off_quietly(drive);
123} 122}
124 123
125static void __devinit init_hwif_triflex(ide_hwif_t *hwif) 124static void __devinit init_hwif_triflex(ide_hwif_t *hwif)
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index 6fb6e50b8231..a508550c4095 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -240,8 +240,9 @@ static int via82cxxx_ide_dma_check (ide_drive_t *drive)
240 via_set_drive(drive, speed); 240 via_set_drive(drive, speed);
241 241
242 if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) 242 if (drive->autodma && (speed & XFER_MODE) != XFER_PIO)
243 return hwif->ide_dma_on(drive); 243 return 0;
244 return hwif->ide_dma_off_quietly(drive); 244
245 return -1;
245} 246}
246 247
247static struct via_isa_bridge *via_config_find(struct pci_dev **isa) 248static struct via_isa_bridge *via_config_find(struct pci_dev **isa)