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

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>

+7 -7
+7 -7
drivers/scsi/sgiwd93.c
··· 95 95 */ 96 96 hcp->desc.pbuf = 0; 97 97 hcp->desc.cntinfo = HPCDMA_EOX; 98 - dma_cache_sync(hd->dev, hd->cpu, 98 + dma_sync_single_for_device(hd->dev, hd->dma, 99 99 (unsigned long)(hcp + 1) - (unsigned long)hd->cpu, 100 100 DMA_TO_DEVICE); 101 101 } ··· 234 234 235 235 hdata = host_to_hostdata(host); 236 236 hdata->dev = &pdev->dev; 237 - hdata->cpu = dma_alloc_attrs(&pdev->dev, HPC_DMA_SIZE, &hdata->dma, 238 - GFP_KERNEL, DMA_ATTR_NON_CONSISTENT); 237 + hdata->cpu = dma_alloc_noncoherent(&pdev->dev, HPC_DMA_SIZE, 238 + &hdata->dma, DMA_TO_DEVICE, GFP_KERNEL); 239 239 if (!hdata->cpu) { 240 240 printk(KERN_WARNING "sgiwd93: Could not allocate memory for " 241 241 "host %d buffer.\n", unit); ··· 274 274 out_irq: 275 275 free_irq(irq, host); 276 276 out_free: 277 - dma_free_attrs(&pdev->dev, HPC_DMA_SIZE, hdata->cpu, hdata->dma, 278 - DMA_ATTR_NON_CONSISTENT); 277 + dma_free_noncoherent(&pdev->dev, HPC_DMA_SIZE, hdata->cpu, hdata->dma, 278 + DMA_TO_DEVICE); 279 279 out_put: 280 280 scsi_host_put(host); 281 281 out: ··· 291 291 292 292 scsi_remove_host(host); 293 293 free_irq(pd->irq, host); 294 - dma_free_attrs(&pdev->dev, HPC_DMA_SIZE, hdata->cpu, hdata->dma, 295 - DMA_ATTR_NON_CONSISTENT); 294 + dma_free_noncoherent(&pdev->dev, HPC_DMA_SIZE, hdata->cpu, hdata->dma, 295 + DMA_TO_DEVICE); 296 296 scsi_host_put(host); 297 297 return 0; 298 298 }