aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/sgiioc4.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:47 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-13 15:39:47 -0400
commit2bbd57cad3d72334c9fcc4e229a5a5b04dc6aebc (patch)
treec0866cb7b4a3e12d11179c65d86e2ba012db5002 /drivers/ide/pci/sgiioc4.c
parentffa15a6915b7f6f6f69b4a66e1100a9c68d11250 (diff)
ide: switch to DMA-mapping API part #2
Follow-up to commit 5c05ff68b9a9b40a9be949497e0aa980185565cf ("ide: switch to DMA-mapping API"): * pci_{alloc,free}_consistent() -> dma_{alloc,free}_coherent() in ide_{allocate,release}_dma_engine(). * Add ->prd_max_nents and ->prd_ent_size fields to ide_hwif_t (+ set default values in ide_allocate_dma_engine()). * Make ide_{allocate,release}_dma_engine() available also for CONFIG_BLK_DEV_IDEDMA_SFF=n. Then convert au1xxx-ide.c, scc_pata.c and sgiioc4.c to use them. * Add missing ->init_dma method to scc_pata. This patch also fixes: - ->dmatable_cpu leak for au1xxx-ide - too early realease of ->dmatable_cpu for scc_pata - wrong amount of ->dmatable_cpu memory being freed for sgiioc4 While at it: - remove superfluous ->dma_base check from ide_unregister() - return -ENOMEM on error in ide_release_dma_engine() - beautify error message in ide_release_dma_engine() Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/sgiioc4.c')
-rw-r--r--drivers/ide/pci/sgiioc4.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index 84cd986810cf..dd634541ce36 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -357,14 +357,13 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d)
357 } 357 }
358 hwif->dma_base = (unsigned long) virt_dma_base; 358 hwif->dma_base = (unsigned long) virt_dma_base;
359 359
360 hwif->dmatable_cpu = pci_alloc_consistent(dev, 360 hwif->sg_max_nents = IOC4_PRD_ENTRIES;
361 IOC4_PRD_ENTRIES * IOC4_PRD_BYTES,
362 &hwif->dmatable_dma);
363 361
364 if (!hwif->dmatable_cpu) 362 hwif->prd_max_nents = IOC4_PRD_ENTRIES;
365 goto dma_pci_alloc_failure; 363 hwif->prd_ent_size = IOC4_PRD_BYTES;
366 364
367 hwif->sg_max_nents = IOC4_PRD_ENTRIES; 365 if (ide_allocate_dma_engine(hwif))
366 goto dma_pci_alloc_failure;
368 367
369 pad = pci_alloc_consistent(dev, IOC4_IDE_CACHELINE_SIZE, 368 pad = pci_alloc_consistent(dev, IOC4_IDE_CACHELINE_SIZE,
370 (dma_addr_t *)&hwif->extra_base); 369 (dma_addr_t *)&hwif->extra_base);
@@ -373,8 +372,8 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d)
373 return 0; 372 return 0;
374 } 373 }
375 374
376 pci_free_consistent(dev, IOC4_PRD_ENTRIES * IOC4_PRD_BYTES, 375 ide_release_dma_engine(hwif);
377 hwif->dmatable_cpu, hwif->dmatable_dma); 376
378 printk(KERN_ERR "%s(%s) -- ERROR: Unable to allocate DMA maps\n", 377 printk(KERN_ERR "%s(%s) -- ERROR: Unable to allocate DMA maps\n",
379 __func__, hwif->name); 378 __func__, hwif->name);
380 printk(KERN_INFO "%s: changing from DMA to PIO mode", hwif->name); 379 printk(KERN_INFO "%s: changing from DMA to PIO mode", hwif->name);