On Fri, Oct 21, 2016 at 08:35:29PM +0300, Andy Shevchenko wrote: > Instead of open coded variant let's use recently introduced helper. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> > --- > drivers/dma/imx-dma.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c > index ab0fb80..a3cb4fe 100644 > --- a/drivers/dma/imx-dma.c > +++ b/drivers/dma/imx-dma.c > @@ -813,8 +813,6 @@ static struct dma_async_tx_descriptor *imxdma_prep_slave_sg( > unsigned long flags, void *context) > { > struct imxdma_channel *imxdmac = to_imxdma_chan(chan); > - struct scatterlist *sg; > - int i, dma_length = 0; > struct imxdma_desc *desc; > > if (list_empty(&imxdmac->ld_free) || > @@ -823,10 +821,6 @@ static struct dma_async_tx_descriptor *imxdma_prep_slave_sg( > > desc = list_first_entry(&imxdmac->ld_free, struct imxdma_desc, node); > > - for_each_sg(sgl, sg, sg_len, i) { > - dma_length += sg_dma_len(sg); > - } > - > switch (imxdmac->word_size) { > case DMA_SLAVE_BUSWIDTH_4_BYTES: > if (sg_dma_len(sgl) & 3 || sgl->dma_address & 3) > @@ -845,7 +839,7 @@ static struct dma_async_tx_descriptor *imxdma_prep_slave_sg( > desc->type = IMXDMA_DESC_SLAVE_SG; > desc->sg = sgl; > desc->sgcount = sg_len; > - desc->len = dma_length; > + desc->len = sg_nents_for_dma(sgl, sg_len, SIZE_MAX); Okay now am convinced this doesn't sound right... Here would would rturn entries and not length which is required.. -- ~Vinod -- 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