aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-08-20 16:42:55 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-08-20 16:42:55 -0400
commit1116fae5fdfa80c6744a9b5d75fb3ef687a69b19 (patch)
treebaac86f015f51f1f257219f154a86a08f8529385 /drivers
parent8292e8c7e4c2b99f22120f677858487de43c484b (diff)
ide: config_drive_for_dma() fixes
* Add DMA blacklist checking (->ide_dma_on check probably can go now). * Add ->atapi_dma flag checking and remove no longer needed ns87415_ide_dma_check() from ns87415 host driver. * Remove now needless __ide_dma_check() wrapper and symbol export. * Check drive->autodma instead of hwif->autodma (there should be no changes in behavior as all users of config_drive_for_dma() set both ->autodma flags). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-dma.c26
-rw-r--r--drivers/ide/pci/ns87415.c9
2 files changed, 10 insertions, 25 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 5fe1d72ab451..865a2740a6e3 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -349,9 +349,17 @@ EXPORT_SYMBOL_GPL(ide_destroy_dmatable);
349 349
350static int config_drive_for_dma (ide_drive_t *drive) 350static int config_drive_for_dma (ide_drive_t *drive)
351{ 351{
352 ide_hwif_t *hwif = drive->hwif;
352 struct hd_driveid *id = drive->id; 353 struct hd_driveid *id = drive->id;
353 354
354 if ((id->capability & 1) && drive->hwif->autodma) { 355 /* consult the list of known "bad" drives */
356 if (__ide_dma_bad_drive(drive))
357 return -1;
358
359 if (drive->media != ide_disk && hwif->atapi_dma == 0)
360 return -1;
361
362 if ((id->capability & 1) && drive->autodma) {
355 /* 363 /*
356 * Enable DMA on any drive that has 364 * Enable DMA on any drive that has
357 * UltraDMA (mode 0/1/2/3/4/5/6) enabled 365 * UltraDMA (mode 0/1/2/3/4/5/6) enabled
@@ -514,20 +522,6 @@ int __ide_dma_on (ide_drive_t *drive)
514EXPORT_SYMBOL(__ide_dma_on); 522EXPORT_SYMBOL(__ide_dma_on);
515 523
516/** 524/**
517 * __ide_dma_check - check DMA setup
518 * @drive: drive to check
519 *
520 * Don't use - due for extermination
521 */
522
523int __ide_dma_check (ide_drive_t *drive)
524{
525 return config_drive_for_dma(drive);
526}
527
528EXPORT_SYMBOL(__ide_dma_check);
529
530/**
531 * ide_dma_setup - begin a DMA phase 525 * ide_dma_setup - begin a DMA phase
532 * @drive: target device 526 * @drive: target device
533 * 527 *
@@ -1021,7 +1015,7 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p
1021 if (!hwif->dma_host_on) 1015 if (!hwif->dma_host_on)
1022 hwif->dma_host_on = &ide_dma_host_on; 1016 hwif->dma_host_on = &ide_dma_host_on;
1023 if (!hwif->ide_dma_check) 1017 if (!hwif->ide_dma_check)
1024 hwif->ide_dma_check = &__ide_dma_check; 1018 hwif->ide_dma_check = &config_drive_for_dma;
1025 if (!hwif->dma_setup) 1019 if (!hwif->dma_setup)
1026 hwif->dma_setup = &ide_dma_setup; 1020 hwif->dma_setup = &ide_dma_setup;
1027 if (!hwif->dma_exec_cmd) 1021 if (!hwif->dma_exec_cmd)
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index 09941f37d635..465c935fdf25 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -187,14 +187,6 @@ static int ns87415_ide_dma_setup(ide_drive_t *drive)
187 return 1; 187 return 1;
188} 188}
189 189
190static int ns87415_ide_dma_check (ide_drive_t *drive)
191{
192 if (drive->media != ide_disk)
193 return -1;
194
195 return __ide_dma_check(drive);
196}
197
198static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) 190static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
199{ 191{
200 struct pci_dev *dev = hwif->pci_dev; 192 struct pci_dev *dev = hwif->pci_dev;
@@ -266,7 +258,6 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
266 258
267 outb(0x60, hwif->dma_status); 259 outb(0x60, hwif->dma_status);
268 hwif->dma_setup = &ns87415_ide_dma_setup; 260 hwif->dma_setup = &ns87415_ide_dma_setup;
269 hwif->ide_dma_check = &ns87415_ide_dma_check;
270 hwif->ide_dma_end = &ns87415_ide_dma_end; 261 hwif->ide_dma_end = &ns87415_ide_dma_end;
271 262
272 if (!noautodma) 263 if (!noautodma)