]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
nds32: implement the unmap_sg DMA operation
authorChristoph Hellwig <hch@lst.de>
Sat, 19 May 2018 07:22:05 +0000 (09:22 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 29 May 2018 14:10:27 +0000 (16:10 +0200)
This matches the implementation of the more commonly used unmap_single
routines and the sync_sg_for_cpu method which should provide equivalent
cache maintainance.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Greentime Hu <greentime@andestech.com>
Tested-by: Greentime Hu <greentime@andestech.com>
arch/nds32/kernel/dma.c

index e0c94a2889c52dc2f472b6c6a3052cea7279900c..b9973317c734d28ee0f0acbfca250588cb39762a 100644 (file)
@@ -458,6 +458,12 @@ static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
                               int nhwentries, enum dma_data_direction dir,
                               unsigned long attrs)
 {
+       int i;
+
+       for (i = 0; i < nhwentries; i++, sg++) {
+               nds32_dma_sync_single_for_cpu(dev, sg_dma_address(sg),
+                               sg->length, dir);
+       }
 }
 
 struct dma_map_ops nds32_dma_ops = {