dmaengine: omap-dma: Clean up the prep_slave_sg sg list walk code
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Wed, 11 Nov 2015 10:37:56 +0000 (12:37 +0200)
committerVinod Koul <vinod.koul@intel.com>
Sat, 5 Dec 2015 08:06:38 +0000 (13:36 +0530)
The for_each_sg() macro's last parameter is inteded to be used as counter.
We can use 'i' instead of 'j' within the loop for indexes.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/omap-dma.c

index 8ed39ce24d461cab55aaa973287b0a3b7c30a3b0..4afc2c18d451444c0d8cd679c57649f36f449422 100644 (file)
@@ -768,7 +768,7 @@ static struct dma_async_tx_descriptor *omap_dma_prep_slave_sg(
        struct scatterlist *sgent;
        struct omap_desc *d;
        dma_addr_t dev_addr;
-       unsigned i, j = 0, es, en, frame_bytes;
+       unsigned i, es, en, frame_bytes;
        u32 burst;
 
        if (dir == DMA_DEV_TO_MEM) {
@@ -845,13 +845,12 @@ static struct dma_async_tx_descriptor *omap_dma_prep_slave_sg(
        en = burst;
        frame_bytes = es_bytes[es] * en;
        for_each_sg(sgl, sgent, sglen, i) {
-               d->sg[j].addr = sg_dma_address(sgent);
-               d->sg[j].en = en;
-               d->sg[j].fn = sg_dma_len(sgent) / frame_bytes;
-               j++;
+               d->sg[i].addr = sg_dma_address(sgent);
+               d->sg[i].en = en;
+               d->sg[i].fn = sg_dma_len(sgent) / frame_bytes;
        }
 
-       d->sglen = j;
+       d->sglen = sglen;
 
        return vchan_tx_prep(&c->vc, &d->vd, tx_flags);
 }