mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
sgiwd93: convert to dma_alloc_noncoherent
Use the new non-coherent DMA API including proper ownership transfers. This also means we can allocate the memory as DMA_TO_DEVICE instead of bidirectional. Signed-off-by: Christoph Hellwig <hch@lst.de> Tested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
This commit is contained in:
@@ -95,7 +95,7 @@ void fill_hpc_entries(struct ip22_hostdata *hd, struct scsi_cmnd *cmd, int din)
|
|||||||
*/
|
*/
|
||||||
hcp->desc.pbuf = 0;
|
hcp->desc.pbuf = 0;
|
||||||
hcp->desc.cntinfo = HPCDMA_EOX;
|
hcp->desc.cntinfo = HPCDMA_EOX;
|
||||||
dma_cache_sync(hd->dev, hd->cpu,
|
dma_sync_single_for_device(hd->dev, hd->dma,
|
||||||
(unsigned long)(hcp + 1) - (unsigned long)hd->cpu,
|
(unsigned long)(hcp + 1) - (unsigned long)hd->cpu,
|
||||||
DMA_TO_DEVICE);
|
DMA_TO_DEVICE);
|
||||||
}
|
}
|
||||||
@@ -234,8 +234,8 @@ static int sgiwd93_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
hdata = host_to_hostdata(host);
|
hdata = host_to_hostdata(host);
|
||||||
hdata->dev = &pdev->dev;
|
hdata->dev = &pdev->dev;
|
||||||
hdata->cpu = dma_alloc_attrs(&pdev->dev, HPC_DMA_SIZE, &hdata->dma,
|
hdata->cpu = dma_alloc_noncoherent(&pdev->dev, HPC_DMA_SIZE,
|
||||||
GFP_KERNEL, DMA_ATTR_NON_CONSISTENT);
|
&hdata->dma, DMA_TO_DEVICE, GFP_KERNEL);
|
||||||
if (!hdata->cpu) {
|
if (!hdata->cpu) {
|
||||||
printk(KERN_WARNING "sgiwd93: Could not allocate memory for "
|
printk(KERN_WARNING "sgiwd93: Could not allocate memory for "
|
||||||
"host %d buffer.\n", unit);
|
"host %d buffer.\n", unit);
|
||||||
@@ -274,8 +274,8 @@ static int sgiwd93_probe(struct platform_device *pdev)
|
|||||||
out_irq:
|
out_irq:
|
||||||
free_irq(irq, host);
|
free_irq(irq, host);
|
||||||
out_free:
|
out_free:
|
||||||
dma_free_attrs(&pdev->dev, HPC_DMA_SIZE, hdata->cpu, hdata->dma,
|
dma_free_noncoherent(&pdev->dev, HPC_DMA_SIZE, hdata->cpu, hdata->dma,
|
||||||
DMA_ATTR_NON_CONSISTENT);
|
DMA_TO_DEVICE);
|
||||||
out_put:
|
out_put:
|
||||||
scsi_host_put(host);
|
scsi_host_put(host);
|
||||||
out:
|
out:
|
||||||
@@ -291,8 +291,8 @@ static int sgiwd93_remove(struct platform_device *pdev)
|
|||||||
|
|
||||||
scsi_remove_host(host);
|
scsi_remove_host(host);
|
||||||
free_irq(pd->irq, host);
|
free_irq(pd->irq, host);
|
||||||
dma_free_attrs(&pdev->dev, HPC_DMA_SIZE, hdata->cpu, hdata->dma,
|
dma_free_noncoherent(&pdev->dev, HPC_DMA_SIZE, hdata->cpu, hdata->dma,
|
||||||
DMA_ATTR_NON_CONSISTENT);
|
DMA_TO_DEVICE);
|
||||||
scsi_host_put(host);
|
scsi_host_put(host);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user