diff mbox

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

Message ID 20161021173535.100245-10-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 <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/xilinx/zynqmp_dma.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index 6d221e5..3fef044 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -853,12 +853,9 @@  static struct dma_async_tx_descriptor *zynqmp_dma_prep_sg(
 	void *desc = NULL, *prev = NULL;
 	size_t len, dst_avail, src_avail;
 	dma_addr_t dma_dst, dma_src;
-	u32 desc_cnt = 0, i;
-	struct scatterlist *sg;
+	u32 desc_cnt;
 
-	for_each_sg(src_sg, sg, src_sg_len, i)
-		desc_cnt += DIV_ROUND_UP(sg_dma_len(sg),
-					 ZYNQMP_DMA_MAX_TRANS_LEN);
+	desc_cnt = sg_nents_for_dma(src_sg, src_sg_len, ZYNQMP_DMA_MAX_TRANS_LEN);
 
 	spin_lock_bh(&chan->lock);
 	if (desc_cnt > chan->desc_free_cnt) {