On Wed, Jan 22, 2014 at 07:55:25AM +0100, Sascha Hauer wrote: > On Mon, Jan 20, 2014 at 01:33:54PM +0100, Guennadi Liakhovetski wrote: > > Instead of initialising variables in their definitions and using a while > > loop switch to using a for loop. > > > > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@xxxxxx> > > --- > > > > Just seems a bit cleaner to me, but that's subjective :) > > Indeed, that's subjective ;) > > I just find it harder to read. > > Sascha > > > > > drivers/dma/imx-sdma.c | 13 +++++-------- > > 1 files changed, 5 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c > > index c75679d..875d08e 100644 > > --- a/drivers/dma/imx-sdma.c > > +++ b/drivers/dma/imx-sdma.c > > @@ -1113,9 +1113,10 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic( > > { > > struct sdma_channel *sdmac = to_sdma_chan(chan); > > struct sdma_engine *sdma = sdmac->sdma; > > + struct sdma_buffer_descriptor *bd; > > int num_periods = buf_len / period_len; > > int channel = sdmac->channel; > > - int ret, i = 0, buf = 0; > > + int ret, i, buf; > > > > dev_dbg(sdma->dev, "%s channel: %d\n", __func__, channel); > > > > @@ -1144,8 +1145,9 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic( > > goto err_out; > > } > > > > - while (buf < buf_len) { > > - struct sdma_buffer_descriptor *bd = &sdmac->bd[i]; > > + for (i = 0, buf = 0, bd = sdmac->bd; > > + buf < buf_len; > > + i++, bd++, buf += period_len, dma_addr += period_len) { well sorry but this line blew me. to quote Documentation/CodingStyle: "Don't put multiple assignments on a single line either. Kernel coding style is super simple. Avoid tricky expressions." -- ~Vinod > > int param; > > > > bd->buffer_addr = dma_addr; > > @@ -1169,11 +1171,6 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic( > > param & BD_INTR ? " intr" : ""); > > > > bd->mode.status = param; > > - > > - dma_addr += period_len; > > - buf += period_len; > > - > > - i++; > > } > > > > sdmac->num_bd = num_periods; > > -- > > 1.7.2.5 > > > > > > -- > Pengutronix e.K. | | > Industrial Linux Solutions | http://www.pengutronix.de/ | > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | -- -- 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