aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-dma.c')
-rw-r--r--drivers/ide/ide-dma.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 1ca1210ec1c0..782e5da01578 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -184,6 +184,7 @@ static int ide_dma_good_drive(ide_drive_t *drive)
184int ide_build_sglist(ide_drive_t *drive, struct request *rq) 184int ide_build_sglist(ide_drive_t *drive, struct request *rq)
185{ 185{
186 ide_hwif_t *hwif = HWIF(drive); 186 ide_hwif_t *hwif = HWIF(drive);
187 struct pci_dev *pdev = to_pci_dev(hwif->dev);
187 struct scatterlist *sg = hwif->sg_table; 188 struct scatterlist *sg = hwif->sg_table;
188 189
189 ide_map_sg(drive, rq); 190 ide_map_sg(drive, rq);
@@ -193,7 +194,7 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq)
193 else 194 else
194 hwif->sg_dma_direction = PCI_DMA_TODEVICE; 195 hwif->sg_dma_direction = PCI_DMA_TODEVICE;
195 196
196 return pci_map_sg(hwif->pci_dev, sg, hwif->sg_nents, hwif->sg_dma_direction); 197 return pci_map_sg(pdev, sg, hwif->sg_nents, hwif->sg_dma_direction);
197} 198}
198 199
199EXPORT_SYMBOL_GPL(ide_build_sglist); 200EXPORT_SYMBOL_GPL(ide_build_sglist);
@@ -306,11 +307,11 @@ EXPORT_SYMBOL_GPL(ide_build_dmatable);
306 307
307void ide_destroy_dmatable (ide_drive_t *drive) 308void ide_destroy_dmatable (ide_drive_t *drive)
308{ 309{
309 struct pci_dev *dev = HWIF(drive)->pci_dev; 310 ide_hwif_t *hwif = drive->hwif;
310 struct scatterlist *sg = HWIF(drive)->sg_table; 311 struct pci_dev *pdev = to_pci_dev(hwif->dev);
311 int nents = HWIF(drive)->sg_nents;
312 312
313 pci_unmap_sg(dev, sg, nents, HWIF(drive)->sg_dma_direction); 313 pci_unmap_sg(pdev, hwif->sg_table, hwif->sg_nents,
314 hwif->sg_dma_direction);
314} 315}
315 316
316EXPORT_SYMBOL_GPL(ide_destroy_dmatable); 317EXPORT_SYMBOL_GPL(ide_destroy_dmatable);
@@ -843,10 +844,10 @@ EXPORT_SYMBOL(ide_dma_timeout);
843static void ide_release_dma_engine(ide_hwif_t *hwif) 844static void ide_release_dma_engine(ide_hwif_t *hwif)
844{ 845{
845 if (hwif->dmatable_cpu) { 846 if (hwif->dmatable_cpu) {
846 pci_free_consistent(hwif->pci_dev, 847 struct pci_dev *pdev = to_pci_dev(hwif->dev);
847 PRD_ENTRIES * PRD_BYTES, 848
848 hwif->dmatable_cpu, 849 pci_free_consistent(pdev, PRD_ENTRIES * PRD_BYTES,
849 hwif->dmatable_dma); 850 hwif->dmatable_cpu, hwif->dmatable_dma);
850 hwif->dmatable_cpu = NULL; 851 hwif->dmatable_cpu = NULL;
851 } 852 }
852} 853}
@@ -874,7 +875,9 @@ int ide_release_dma(ide_hwif_t *hwif)
874 875
875static int ide_allocate_dma_engine(ide_hwif_t *hwif) 876static int ide_allocate_dma_engine(ide_hwif_t *hwif)
876{ 877{
877 hwif->dmatable_cpu = pci_alloc_consistent(hwif->pci_dev, 878 struct pci_dev *pdev = to_pci_dev(hwif->dev);
879
880 hwif->dmatable_cpu = pci_alloc_consistent(pdev,
878 PRD_ENTRIES * PRD_BYTES, 881 PRD_ENTRIES * PRD_BYTES,
879 &hwif->dmatable_dma); 882 &hwif->dmatable_dma);
880 883