diff mbox

[v1,05/10] dmaengine: k3dma: use sg_nents_for_dma() helper

Message ID 20161021173535.100245-5-andriy.shevchenko@linux.intel.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Andy Shevchenko Oct. 21, 2016, 5:35 p.m. UTC
Instead of open coded variant let's use recently introduced helper.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/dma/k3dma.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c
index aabcb79..17ce6a9 100644
--- a/drivers/dma/k3dma.c
+++ b/drivers/dma/k3dma.c
@@ -526,18 +526,14 @@  static struct dma_async_tx_descriptor *k3_dma_prep_slave_sg(
 	size_t len, avail, total = 0;
 	struct scatterlist *sg;
 	dma_addr_t addr, src = 0, dst = 0;
-	int num = sglen, i;
+	int num, i;
 
 	if (sgl == NULL)
 		return NULL;
 
 	c->cyclic = 0;
 
-	for_each_sg(sgl, sg, sglen, i) {
-		avail = sg_dma_len(sg);
-		if (avail > DMA_MAX_SIZE)
-			num += DIV_ROUND_UP(avail, DMA_MAX_SIZE) - 1;
-	}
+	num = sg_nents_for_dma(sgl, sglen, DMA_MAX_SIZE);
 
 	ds = k3_dma_alloc_desc_resource(num, chan);
 	if (!ds)