Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ide: use ide_destroy_dmatable() instead of pci_unmap_sg() (take 2)

Use ide_destroy_dmatable() in:
* ide-dma.c::ide_build_dmatable()
* sgiioc4.c::sgiioc4_build_dma_table()
* pmac.c::pmac_ide_{build,destroy}_dmatable()

There should be no functionality changes caused by this patch.

v2:
* pmac.c build fix from Andrew Morton.

Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

+11 -16
+4 -4
drivers/ide/ide-dma.c
··· 282 282 *--table |= cpu_to_le32(0x80000000); 283 283 return count; 284 284 } 285 + 285 286 printk(KERN_ERR "%s: empty DMA table?\n", drive->name); 287 + 286 288 use_pio_instead: 287 - pci_unmap_sg(hwif->pci_dev, 288 - hwif->sg_table, 289 - hwif->sg_nents, 290 - hwif->sg_dma_direction); 289 + ide_destroy_dmatable(drive); 290 + 291 291 return 0; /* revert to PIO for this request */ 292 292 } 293 293
+1 -2
drivers/ide/pci/sgiioc4.c
··· 517 517 } 518 518 519 519 use_pio_instead: 520 - pci_unmap_sg(hwif->pci_dev, hwif->sg_table, hwif->sg_nents, 521 - hwif->sg_dma_direction); 520 + ide_destroy_dmatable(drive); 522 521 523 522 return 0; /* revert to PIO for this request */ 524 523 }
+6 -10
drivers/ide/ppc/pmac.c
··· 1535 1535 } 1536 1536 1537 1537 printk(KERN_DEBUG "%s: empty DMA table?\n", drive->name); 1538 - use_pio_instead: 1539 - pci_unmap_sg(hwif->pci_dev, 1540 - hwif->sg_table, 1541 - hwif->sg_nents, 1542 - hwif->sg_dma_direction); 1538 + 1539 + use_pio_instead: 1540 + ide_destroy_dmatable(drive); 1541 + 1543 1542 return 0; /* revert to PIO for this request */ 1544 1543 } 1545 1544 ··· 1547 1548 pmac_ide_destroy_dmatable (ide_drive_t *drive) 1548 1549 { 1549 1550 ide_hwif_t *hwif = drive->hwif; 1550 - struct pci_dev *dev = HWIF(drive)->pci_dev; 1551 - struct scatterlist *sg = hwif->sg_table; 1552 - int nents = hwif->sg_nents; 1553 1551 1554 - if (nents) { 1555 - pci_unmap_sg(dev, sg, nents, hwif->sg_dma_direction); 1552 + if (hwif->sg_nents) { 1553 + ide_destroy_dmatable(drive); 1556 1554 hwif->sg_nents = 0; 1557 1555 } 1558 1556 }