Instead of open coded variant let's use recently introduced helper. Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> --- drivers/dma/xilinx/zynqmp_dma.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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) { -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html