Make driver do DMA unmap for XOR operations.

Cc: Vinod Koul <vinod.k...@intel.com>
Cc: Havard Skinnemoen <hskinnem...@gmail.com>
Cc: Tomasz Figa <t.f...@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnier...@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.p...@samsung.com>
---
 drivers/dma/dmatest.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index 22655a7..eabb230 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -306,13 +306,13 @@ static int dmatest_func(void *data)
 
        /*
         * src buffers are freed by the DMAEngine code with dma_unmap_single()
-        * (except DMA_MEMCPY operations)
+        * (except DMA_MEMCPY and DMA_XOR operations)
         * dst buffers are freed by ourselves below
         */
        flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT
              | DMA_COMPL_SKIP_DEST_UNMAP;
 
-       if (thread->type == DMA_MEMCPY)
+       if (thread->type == DMA_MEMCPY || thread->type == DMA_XOR)
                flags |= DMA_COMPL_SKIP_SRC_UNMAP;
        else
                flags |= DMA_COMPL_SRC_UNMAP_SINGLE;
@@ -449,9 +449,11 @@ static int dmatest_func(void *data)
                }
 
                /* Unmap by myself (see DMA_COMPL_SKIP_DEST_UNMAP above) */
-               if (thread->type == DMA_MEMCPY)
-                       dma_unmap_single(dev->dev, dma_srcs[0], len,
-                                        DMA_TO_DEVICE);
+               if (thread->type == DMA_MEMCPY || thread->type == DMA_XOR) {
+                       for (i = 0; i < src_cnt; i++)
+                               dma_unmap_single(dev->dev, dma_srcs[i], len,
+                                                DMA_TO_DEVICE);
+               }
                for (i = 0; i < dst_cnt; i++)
                        dma_unmap_single(dev->dev, dma_dsts[i], test_buf_size,
                                         DMA_BIDIRECTIONAL);
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to