aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-probe.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:22 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:22 -0400
commitb123f56e04c7c112f754f948198d1ea5a80e649d (patch)
treec58e83e954159d7755aa7f04d433e4c7e25dc330 /drivers/ide/ide-probe.c
parentf629b38beddf2ff8bc3fda1754bbd6cc7d3acc03 (diff)
ide: do complete DMA setup in ->init_dma method (take 2)
* Make ide_hwif_setup_dma() return an error value. * Pass 'const struct ide_port_info *d' instead of 'unsigned long dmabase' to ->init_dma method and make it return an error value. * Rename ide_get_or_set_dma_base() to ide_pci_dma_base(), change ordering of its arguments and then export it. * Export ide_pci_set_master(). * Do complete DMA setup inside ->init_dma method and update ->init_dma users accordingly. * Sanitize code for DMA setup in ide_init_port(). v2: * Fix for CONFIG_BLK_DEV_IDEDMA_PCI=n configs (from Jiri Slaby <jirislaby@gmail.com>): Fix following compiler warning by returning EINVAL: In file included from ANYTHING-INCLUDING-IDE.H:45: include/linux/ide.h: In function ‘ide_hwif_setup_dma’: include/linux/ide.h:1022: warning: no return statement in function returning non-void Cc: Jiri Slaby <jirislaby@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r--drivers/ide/ide-probe.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index d2faef17e548..e0316869eb6f 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1356,9 +1356,6 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
1356 if (d->init_iops) 1356 if (d->init_iops)
1357 d->init_iops(hwif); 1357 d->init_iops(hwif);
1358 1358
1359 if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0)
1360 ide_hwif_setup_dma(hwif, d);
1361
1362 if ((!hwif->irq && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) || 1359 if ((!hwif->irq && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) ||
1363 (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) 1360 (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS))
1364 hwif->irq = port ? 15 : 14; 1361 hwif->irq = port ? 15 : 14;
@@ -1377,9 +1374,21 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
1377 hwif->mwdma_mask = d->mwdma_mask; 1374 hwif->mwdma_mask = d->mwdma_mask;
1378 hwif->ultra_mask = d->udma_mask; 1375 hwif->ultra_mask = d->udma_mask;
1379 1376
1380 /* reset DMA masks only for SFF-style DMA controllers */ 1377 if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) {
1381 if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0 && hwif->dma_base == 0) 1378 int rc;
1382 hwif->swdma_mask = hwif->mwdma_mask = hwif->ultra_mask = 0; 1379
1380 if (d->init_dma)
1381 rc = d->init_dma(hwif, d);
1382 else
1383 rc = ide_hwif_setup_dma(hwif, d);
1384
1385 if (rc < 0) {
1386 printk(KERN_INFO "%s: DMA disabled\n", hwif->name);
1387 hwif->swdma_mask = 0;
1388 hwif->mwdma_mask = 0;
1389 hwif->ultra_mask = 0;
1390 }
1391 }
1383 1392
1384 if (d->host_flags & IDE_HFLAG_RQSIZE_256) 1393 if (d->host_flags & IDE_HFLAG_RQSIZE_256)
1385 hwif->rqsize = 256; 1394 hwif->rqsize = 256;