From patchwork Mon Jan 20 12:33:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 3512201 X-Patchwork-Delegate: vinod.koul@intel.com Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 935C29F2E9 for ; Mon, 20 Jan 2014 12:34:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A0802010B for ; Mon, 20 Jan 2014 12:34:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C2BA200F4 for ; Mon, 20 Jan 2014 12:34:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751606AbaATMeI (ORCPT ); Mon, 20 Jan 2014 07:34:08 -0500 Received: from moutng.kundenserver.de ([212.227.126.187]:60989 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750738AbaATMeH (ORCPT ); Mon, 20 Jan 2014 07:34:07 -0500 Received: from axis700.grange (dslb-178-009-253-197.pools.arcor-ip.net [178.9.253.197]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0Mh6n3-1Vj0EM1sZ7-00M45k; Mon, 20 Jan 2014 13:33:56 +0100 Received: by axis700.grange (Postfix, from userid 1000) id 7136940BB4; Mon, 20 Jan 2014 13:33:54 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 612D940BB3; Mon, 20 Jan 2014 13:33:54 +0100 (CET) Date: Mon, 20 Jan 2014 13:33:54 +0100 (CET) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: dmaengine@vger.kernel.org cc: "Koul, Vinod" , Sascha Hauer Subject: [PATCH RFC 2/2] DMA: imx-sdma: (cosmetic) simplify a loop Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:r7TQ6rpmzYhTGtP/fLbF9SthS+yOP36Sj9GvIVXEd26 QCTQJu65CdYDcylev8fi/zwCYot5C/95aPkFBbsU2sG/X7N70I uDL0cqHkESrwAD7wg5uA4Cv/0xUlMqAn2JYBuGhY8anvONSvmk z0gfpoIzaDZN5UHt6M4PinxiGqsLrODlhYKmNoRFDTB4vtNSKa 20sFqLqISjaVfLWCv/rPtvfAi7Hvo64Jp3YYr3bAOGZw9EbeLE 1XkuluWYwg5OiKIMW25eO/d0M8qf3TJLuQuVvvqd6ZuRMle4Kk yBeTDxniSEI5p+OekNy1Mie04ORlxltmL5qfbIGICZ/Pj6teCv 2tupq413vGs8lJBQOXz+mmVNVLH6mCGwKKpMFdur80PJX+lmL4 zjPEdGFjuz/Tg== Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of initialising variables in their definitions and using a while loop switch to using a for loop. Signed-off-by: Guennadi Liakhovetski --- Just seems a bit cleaner to me, but that's subjective :) 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) { 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;