ide: cleanup ide_setup_dma()
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 26 Apr 2008 20:25:21 +0000 (22:25 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 26 Apr 2008 20:25:21 +0000 (22:25 +0200)
* There is no need to call ide_release_dma_engine().

* Move the code up to (and including) ide_allocate_dma_engine()
  call to the callers of ide_setup_dma().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/arm/palm_bk3710.c
drivers/ide/ide-dma.c
drivers/ide/setup-pci.c

index 9e21b8e6099c94df949bede4ab6537fbfa995c5b..7ed79e7f3110efd2fd1f25b170826bdb8d9d8317 100644 (file)
@@ -392,7 +392,10 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev)
        hwif->mmio = 1;
        default_hwif_mmiops(hwif);
 
-       ide_setup_dma(hwif, mem->start);
+       printk(KERN_INFO "    %s: MMIO-DMA\n", hwif->name);
+
+       if (ide_allocate_dma_engine(hwif) == 0)
+               ide_setup_dma(hwif, mem->start);
 
        idx[0] = i;
 
index ca7f974a71f5a8644215067384bc667d167c56d9..366bbc841fc9896cbf41e540f8032a4d9d34a4e3 100644 (file)
@@ -841,19 +841,6 @@ EXPORT_SYMBOL_GPL(ide_allocate_dma_engine);
 
 void ide_setup_dma(ide_hwif_t *hwif, unsigned long base)
 {
-       if (hwif->mmio)
-               printk(KERN_INFO "    %s: MMIO-DMA\n", hwif->name);
-       else
-               printk(KERN_INFO "    %s: BM-DMA at 0x%04lx-0x%04lx\n",
-                                hwif->name, base, base + 7);
-
-       hwif->extra_base = base + (hwif->channel ? 8 : 16);
-
-       if (ide_allocate_dma_engine(hwif)) {
-               ide_release_dma_engine(hwif);
-               return;
-       }
-
        hwif->dma_base = base;
 
        if (!hwif->dma_command)
index bf28970b0278ef44a65595c235be05875e727938..5006ea98733b677ff30424b2b88dda153fb4b25e 100644 (file)
@@ -367,15 +367,24 @@ void ide_hwif_setup_dma(ide_hwif_t *hwif, const struct ide_port_info *d)
        if ((d->host_flags & IDE_HFLAG_NO_AUTODMA) == 0 ||
            ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE &&
             (dev->class & 0x80))) {
-               unsigned long dma_base = ide_get_or_set_dma_base(d, hwif);
+               unsigned long base = ide_get_or_set_dma_base(d, hwif);
 
-               if (dma_base == 0 || ide_pci_set_master(dev, d->name) < 0)
+               if (base == 0 || ide_pci_set_master(dev, d->name) < 0)
                        goto out_disabled;
 
                if (d->init_dma)
-                       d->init_dma(hwif, dma_base);
+                       d->init_dma(hwif, base);
 
-               ide_setup_dma(hwif, dma_base);
+               if (hwif->mmio)
+                       printk(KERN_INFO "    %s: MMIO-DMA\n", hwif->name);
+               else
+                       printk(KERN_INFO "    %s: BM-DMA at 0x%04lx-0x%04lx\n",
+                                        hwif->name, base, base + 7);
+
+               hwif->extra_base = base + (hwif->channel ? 8 : 16);
+
+               if (ide_allocate_dma_engine(hwif) == 0)
+                       ide_setup_dma(hwif, base);
        }
 
        return;