diff options
| author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-02-16 20:40:26 -0500 |
|---|---|---|
| committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2007-02-16 20:40:26 -0500 |
| commit | 3608b5d71a52c053787dbad6af20c25f7e0b75a9 (patch) | |
| tree | 5bd6ac777d32d8426e65e3c31cc1587674771e8c /drivers/ide | |
| parent | 9ef5791e1be91007951477b8ed1530ac1166a8e7 (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')
35 files changed, 118 insertions, 139 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 61ce40d52f5f..aeed0205ce64 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
| @@ -365,10 +365,7 @@ static int icside_dma_check(ide_drive_t *drive) | |||
| 365 | out: | 365 | out: |
| 366 | on = icside_set_speed(drive, xfer_mode); | 366 | on = icside_set_speed(drive, xfer_mode); |
| 367 | 367 | ||
| 368 | if (on) | 368 | return on ? 0 : -1; |
| 369 | return icside_dma_on(drive); | ||
| 370 | else | ||
| 371 | return icside_dma_off_quietly(drive); | ||
| 372 | } | 369 | } |
| 373 | 370 | ||
| 374 | static int icside_dma_end(ide_drive_t *drive) | 371 | static int icside_dma_end(ide_drive_t *drive) |
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index 24281176b4dc..027341d66b28 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c | |||
| @@ -1048,12 +1048,10 @@ static ide_startstop_t cris_dma_intr (ide_drive_t *drive) | |||
| 1048 | 1048 | ||
| 1049 | static int cris_dma_check(ide_drive_t *drive) | 1049 | static int cris_dma_check(ide_drive_t *drive) |
| 1050 | { | 1050 | { |
| 1051 | ide_hwif_t *hwif = drive->hwif; | ||
| 1052 | |||
| 1053 | if (ide_use_dma(drive) && cris_config_drive_for_dma(drive)) | 1051 | if (ide_use_dma(drive) && cris_config_drive_for_dma(drive)) |
| 1054 | return hwif->ide_dma_on(drive); | 1052 | return 0; |
| 1055 | 1053 | ||
| 1056 | return hwif->ide_dma_off_quietly(drive); | 1054 | return -1; |
| 1057 | } | 1055 | } |
| 1058 | 1056 | ||
| 1059 | static int cris_dma_end(ide_drive_t *drive) | 1057 | static int cris_dma_end(ide_drive_t *drive) |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 1a288e5307d3..4fbcea4c1025 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
| @@ -348,15 +348,14 @@ EXPORT_SYMBOL_GPL(ide_destroy_dmatable); | |||
| 348 | static int config_drive_for_dma (ide_drive_t *drive) | 348 | static int config_drive_for_dma (ide_drive_t *drive) |
| 349 | { | 349 | { |
| 350 | struct hd_driveid *id = drive->id; | 350 | struct hd_driveid *id = drive->id; |
| 351 | ide_hwif_t *hwif = HWIF(drive); | ||
| 352 | 351 | ||
| 353 | if ((id->capability & 1) && hwif->autodma) { | 352 | if ((id->capability & 1) && drive->hwif->autodma) { |
| 354 | /* | 353 | /* |
| 355 | * Enable DMA on any drive that has | 354 | * Enable DMA on any drive that has |
| 356 | * UltraDMA (mode 0/1/2/3/4/5/6) enabled | 355 | * UltraDMA (mode 0/1/2/3/4/5/6) enabled |
| 357 | */ | 356 | */ |
| 358 | if ((id->field_valid & 4) && ((id->dma_ultra >> 8) & 0x7f)) | 357 | if ((id->field_valid & 4) && ((id->dma_ultra >> 8) & 0x7f)) |
| 359 | return hwif->ide_dma_on(drive); | 358 | return 0; |
| 360 | /* | 359 | /* |
| 361 | * Enable DMA on any drive that has mode2 DMA | 360 | * Enable DMA on any drive that has mode2 DMA |
| 362 | * (multi or single) enabled | 361 | * (multi or single) enabled |
| @@ -364,14 +363,14 @@ static int config_drive_for_dma (ide_drive_t *drive) | |||
| 364 | if (id->field_valid & 2) /* regular DMA */ | 363 | if (id->field_valid & 2) /* regular DMA */ |
| 365 | if ((id->dma_mword & 0x404) == 0x404 || | 364 | if ((id->dma_mword & 0x404) == 0x404 || |
| 366 | (id->dma_1word & 0x404) == 0x404) | 365 | (id->dma_1word & 0x404) == 0x404) |
| 367 | return hwif->ide_dma_on(drive); | 366 | return 0; |
| 368 | 367 | ||
| 369 | /* Consult the list of known "good" drives */ | 368 | /* Consult the list of known "good" drives */ |
| 370 | if (__ide_dma_good_drive(drive)) | 369 | if (__ide_dma_good_drive(drive)) |
| 371 | return hwif->ide_dma_on(drive); | 370 | return 0; |
| 372 | } | 371 | } |
| 373 | // if (hwif->tuneproc != NULL) hwif->tuneproc(drive, 255); | 372 | |
| 374 | return hwif->ide_dma_off_quietly(drive); | 373 | return -1; |
| 375 | } | 374 | } |
| 376 | 375 | ||
| 377 | /** | 376 | /** |
| @@ -765,6 +764,30 @@ bug_dma_off: | |||
| 765 | 764 | ||
| 766 | EXPORT_SYMBOL(ide_dma_verbose); | 765 | EXPORT_SYMBOL(ide_dma_verbose); |
| 767 | 766 | ||
| 767 | int ide_set_dma(ide_drive_t *drive) | ||
| 768 | { | ||
| 769 | ide_hwif_t *hwif = drive->hwif; | ||
| 770 | int rc; | ||
| 771 | |||
| 772 | rc = hwif->ide_dma_check(drive); | ||
| 773 | |||
| 774 | switch(rc) { | ||
| 775 | case -1: /* DMA needs to be disabled */ | ||
| 776 | return hwif->ide_dma_off_quietly(drive); | ||
| 777 | case 0: /* DMA needs to be enabled */ | ||
| 778 | return hwif->ide_dma_on(drive); | ||
| 779 | case 1: /* DMA setting cannot be changed */ | ||
| 780 | break; | ||
| 781 | default: | ||
| 782 | BUG(); | ||
| 783 | break; | ||
| 784 | } | ||
| 785 | |||
| 786 | return rc; | ||
| 787 | } | ||
| 788 | |||
| 789 | EXPORT_SYMBOL_GPL(ide_set_dma); | ||
| 790 | |||
| 768 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI | 791 | #ifdef CONFIG_BLK_DEV_IDEDMA_PCI |
| 769 | int __ide_dma_lostirq (ide_drive_t *drive) | 792 | int __ide_dma_lostirq (ide_drive_t *drive) |
| 770 | { | 793 | { |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 99d1c43f433e..9f45a84588d9 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
| @@ -226,7 +226,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * | |||
| 226 | break; | 226 | break; |
| 227 | if (drive->hwif->ide_dma_check == NULL) | 227 | if (drive->hwif->ide_dma_check == NULL) |
| 228 | break; | 228 | break; |
| 229 | drive->hwif->ide_dma_check(drive); | 229 | ide_set_dma(drive); |
| 230 | break; | 230 | break; |
| 231 | } | 231 | } |
| 232 | pm->pm_step = ide_pm_state_completed; | 232 | pm->pm_step = ide_pm_state_completed; |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 176bbc850d6b..72218f3e440f 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
| @@ -857,7 +857,7 @@ static void probe_hwif(ide_hwif_t *hwif) | |||
| 857 | #ifdef CONFIG_IDEDMA_ONLYDISK | 857 | #ifdef CONFIG_IDEDMA_ONLYDISK |
| 858 | if (drive->media == ide_disk) | 858 | if (drive->media == ide_disk) |
| 859 | #endif | 859 | #endif |
| 860 | hwif->ide_dma_check(drive); | 860 | ide_set_dma(drive); |
| 861 | } | 861 | } |
| 862 | } | 862 | } |
| 863 | } | 863 | } |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index fbc6d39ace68..5585c01a9b7f 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
| @@ -1135,7 +1135,8 @@ static int set_using_dma (ide_drive_t *drive, int arg) | |||
| 1135 | if (HWIF(drive)->ide_dma_check == NULL) | 1135 | if (HWIF(drive)->ide_dma_check == NULL) |
| 1136 | return -EPERM; | 1136 | return -EPERM; |
| 1137 | if (arg) { | 1137 | if (arg) { |
| 1138 | if (HWIF(drive)->ide_dma_check(drive)) return -EIO; | 1138 | if (ide_set_dma(drive)) |
| 1139 | return -EIO; | ||
| 1139 | if (HWIF(drive)->ide_dma_on(drive)) return -EIO; | 1140 | if (HWIF(drive)->ide_dma_on(drive)) return -EIO; |
| 1140 | } else { | 1141 | } else { |
| 1141 | if (__ide_dma_off(drive)) | 1142 | if (__ide_dma_off(drive)) |
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index b431b990426d..8a723c81c4b8 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c | |||
| @@ -414,9 +414,9 @@ static int auide_dma_check(ide_drive_t *drive) | |||
| 414 | speed = ide_find_best_mode(drive, XFER_PIO | XFER_MWDMA); | 414 | speed = ide_find_best_mode(drive, XFER_PIO | XFER_MWDMA); |
| 415 | 415 | ||
| 416 | if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) | 416 | if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) |
| 417 | return HWIF(drive)->ide_dma_on(drive); | 417 | return 0; |
| 418 | 418 | ||
| 419 | return HWIF(drive)->ide_dma_off_quietly(drive); | 419 | return -1; |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | static int auide_dma_test_irq(ide_drive_t *drive) | 422 | static int auide_dma_test_irq(ide_drive_t *drive) |
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 | ||
| 210 | static int aec62xx_config_drive_xfer_rate (ide_drive_t *drive) | 210 | static 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 | ||
| 223 | static int aec62xx_irq_timeout (ide_drive_t *drive) | 221 | static 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 | ||
| 514 | static int ali15x3_config_drive_for_dma(ide_drive_t *drive) | 512 | static 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: | |||
| 552 | ata_pio: | 550 | ata_pio: |
| 553 | hwif->tuneproc(drive, 255); | 551 | hwif->tuneproc(drive, 255); |
| 554 | no_dma_set: | 552 | no_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 | ||
| 253 | static int atiixp_dma_check(ide_drive_t *drive) | 253 | static 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 | ||
| 475 | static int cmd64x_config_drive_for_dma (ide_drive_t *drive) | 475 | static 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 | ||
| 488 | static int cmd64x_alt_dma_status (struct pci_dev *dev) | 486 | static 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 | ||
| 133 | static int cs5520_config_drive_xfer_rate(ide_drive_t *drive) | 133 | static 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 | ||
| 196 | static int cs5535_dma_check(ide_drive_t *drive) | 196 | static 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 | ||
| 214 | static u8 __devinit cs5535_cable_detect(struct pci_dev *dev) | 213 | static 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 | ||
| 110 | static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive) | 110 | static 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 | ||
| 737 | static int hpt366_config_drive_xfer_rate(ide_drive_t *drive) | 737 | static 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 | ||
| 245 | static int it8213_config_drive_for_dma (ide_drive_t *drive) | 245 | static 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 | ||
| 521 | static int it821x_config_drive_for_dma (ide_drive_t *drive) | 521 | static 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 | ||
| 165 | static int jmicron_config_drive_for_dma (ide_drive_t *drive) | 165 | static 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) | |||
| 190 | static int ns87415_ide_dma_check (ide_drive_t *drive) | 190 | static 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 | ||
| 282 | static int pdcnew_config_drive_xfer_rate(ide_drive_t *drive) | 282 | static 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 | ||
| 297 | static int pdcnew_quirkproc(ide_drive_t *drive) | 295 | static 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 | ||
| 323 | static int pdc202xx_config_drive_xfer_rate (ide_drive_t *drive) | 323 | static 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 | ||
| 338 | static int pdc202xx_quirkproc (ide_drive_t *drive) | 336 | static 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 | ||
| 387 | static int piix_config_drive_xfer_rate (ide_drive_t *drive) | 387 | static 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 | ||
| 316 | static int svwks_config_drive_xfer_rate (ide_drive_t *drive) | 316 | static 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 | ||
| 331 | static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const char *name) | 329 | static 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 | ||
| 415 | static int siimage_config_drive_for_dma (ide_drive_t *drive) | 415 | static 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 | ||
| 670 | static int sis5513_config_xfer_rate(ide_drive_t *drive) | 670 | static 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 | ||
| 180 | static int slc90e66_config_drive_xfer_rate (ide_drive_t *drive) | 180 | static 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 | ||
| 196 | static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) | 194 | static 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 | ||
| 186 | static int tc86c001_config_drive_xfer_rate(ide_drive_t *drive) | 186 | static 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 | ||
| 199 | static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif) | 197 | static 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 | ||
| 114 | static int triflex_config_drive_xfer_rate(ide_drive_t *drive) | 114 | static 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 | ||
| 125 | static void __devinit init_hwif_triflex(ide_hwif_t *hwif) | 124 | static 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 | ||
| 247 | static struct via_isa_bridge *via_config_find(struct pci_dev **isa) | 248 | static struct via_isa_bridge *via_config_find(struct pci_dev **isa) |
diff --git a/drivers/ide/ppc/scc_pata.c b/drivers/ide/ppc/scc_pata.c index 7e3e93caafd0..de64b022478b 100644 --- a/drivers/ide/ppc/scc_pata.c +++ b/drivers/ide/ppc/scc_pata.c | |||
| @@ -371,15 +371,13 @@ static int scc_config_chipset_for_dma(ide_drive_t *drive) | |||
| 371 | 371 | ||
| 372 | static int scc_config_drive_for_dma(ide_drive_t *drive) | 372 | static int scc_config_drive_for_dma(ide_drive_t *drive) |
| 373 | { | 373 | { |
| 374 | ide_hwif_t *hwif = HWIF(drive); | ||
| 375 | |||
| 376 | if (ide_use_dma(drive) && scc_config_chipset_for_dma(drive)) | 374 | if (ide_use_dma(drive) && scc_config_chipset_for_dma(drive)) |
| 377 | return hwif->ide_dma_on(drive); | 375 | return 0; |
| 378 | 376 | ||
| 379 | if (ide_use_fast_pio(drive)) | 377 | if (ide_use_fast_pio(drive)) |
| 380 | hwif->tuneproc(drive, 4); | 378 | scc_tuneproc(drive, 4); |
| 381 | 379 | ||
| 382 | return hwif->ide_dma_off_quietly(drive); | 380 | return -1; |
| 383 | } | 381 | } |
| 384 | 382 | ||
| 385 | /** | 383 | /** |
