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: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent fcc11759
...@@ -282,12 +282,12 @@ int ide_build_dmatable (ide_drive_t *drive, struct request *rq) ...@@ -282,12 +282,12 @@ int ide_build_dmatable (ide_drive_t *drive, struct request *rq)
*--table |= cpu_to_le32(0x80000000); *--table |= cpu_to_le32(0x80000000);
return count; return count;
} }
printk(KERN_ERR "%s: empty DMA table?\n", drive->name); printk(KERN_ERR "%s: empty DMA table?\n", drive->name);
use_pio_instead: use_pio_instead:
pci_unmap_sg(hwif->pci_dev, ide_destroy_dmatable(drive);
hwif->sg_table,
hwif->sg_nents,
hwif->sg_dma_direction);
return 0; /* revert to PIO for this request */ return 0; /* revert to PIO for this request */
} }
......
...@@ -517,8 +517,7 @@ sgiioc4_build_dma_table(ide_drive_t * drive, struct request *rq, int ddir) ...@@ -517,8 +517,7 @@ sgiioc4_build_dma_table(ide_drive_t * drive, struct request *rq, int ddir)
} }
use_pio_instead: use_pio_instead:
pci_unmap_sg(hwif->pci_dev, hwif->sg_table, hwif->sg_nents, ide_destroy_dmatable(drive);
hwif->sg_dma_direction);
return 0; /* revert to PIO for this request */ return 0; /* revert to PIO for this request */
} }
......
...@@ -1535,11 +1535,10 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq) ...@@ -1535,11 +1535,10 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq)
} }
printk(KERN_DEBUG "%s: empty DMA table?\n", drive->name); printk(KERN_DEBUG "%s: empty DMA table?\n", drive->name);
use_pio_instead:
pci_unmap_sg(hwif->pci_dev, use_pio_instead:
hwif->sg_table, ide_destroy_dmatable(drive);
hwif->sg_nents,
hwif->sg_dma_direction);
return 0; /* revert to PIO for this request */ return 0; /* revert to PIO for this request */
} }
...@@ -1548,12 +1547,9 @@ static void ...@@ -1548,12 +1547,9 @@ static void
pmac_ide_destroy_dmatable (ide_drive_t *drive) pmac_ide_destroy_dmatable (ide_drive_t *drive)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
struct pci_dev *dev = HWIF(drive)->pci_dev;
struct scatterlist *sg = hwif->sg_table;
int nents = hwif->sg_nents;
if (nents) { if (hwif->sg_nents) {
pci_unmap_sg(dev, sg, nents, hwif->sg_dma_direction); ide_destroy_dmatable(drive);
hwif->sg_nents = 0; hwif->sg_nents = 0;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment