From patchwork Mon Jun 15 16:19:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Clayton X-Patchwork-Id: 6610641 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A78F19F1C1 for ; Mon, 15 Jun 2015 16:26:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A9C2F2076A for ; Mon, 15 Jun 2015 16:26:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D030120768 for ; Mon, 15 Jun 2015 16:26:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z4XAY-0008Cm-A1; Mon, 15 Jun 2015 16:23:30 +0000 Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z4X71-0004wp-6R for linux-arm-kernel@lists.infradead.org; Mon, 15 Jun 2015 16:19:51 +0000 Received: by pacyx8 with SMTP id yx8so68536513pac.2 for ; Mon, 15 Jun 2015 09:19:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=s3lWg99diIgIziieNHzksgMVDykodg2KEcvRBv4mfSQ=; b=tQQHmoQ2qegI9j5e7ReScqiWxSocZW3X2Q1W4pgGmtvEQuvcF236qKcSR5ss52MmNG VcE1NbVEWkYO2UqJG2AAe4K/MOaRAicc5jKGjlq4Cfpryp+xL+zXqvMc9ZpeU3tZJ+Qn PB4xgJFZuCkQNoIVZjnnNcskQxbkFkmWDeIMA0Ynev+DMSb2lA6oux4JN/LoEigIKtch jHdMA/tF9ZoFl7uj+bih5Mb0mA/EG7ZFlk7+2w2hRzHLFyQAQBL+oazHXVfYqh4/1KzL V/3kma3RbIIqLjbyxypR/pPZIZerW4793ScRJKV/k0HYBoj8jNIj/ZqwjtjNPwnOZ0Vo RRtA== X-Received: by 10.70.47.138 with SMTP id d10mr49366775pdn.137.1434385169295; Mon, 15 Jun 2015 09:19:29 -0700 (PDT) Received: from localhost.localdomain (68-185-59-186.static.knwc.wa.charter.com. [68.185.59.186]) by mx.google.com with ESMTPSA id qg5sm12717637pdb.13.2015.06.15.09.19.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Jun 2015 09:19:28 -0700 (PDT) From: Joshua Clayton To: Vinod Koul Subject: [PATCH 09/10] dma: imx-sdma: use a for loop Date: Mon, 15 Jun 2015 09:19:04 -0700 Message-Id: <1434385144-4432-10-git-send-email-stillcompiling@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1434385144-4432-1-git-send-email-stillcompiling@gmail.com> References: <1434385144-4432-1-git-send-email-stillcompiling@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150615_091951_315318_C01D9B10 X-CRM114-Status: GOOD ( 13.12 ) X-Spam-Score: -0.8 (/) Cc: Joshua Clayton , linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, Dan Williams , Shawn Guo , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Switch out the strange while loop for a for loop Someone might have thought the this construction potects against odd sized buffers, but num_periods will alwasy be no bigger than the number of whole buffer descriptors Signed-off-by: Joshua Clayton --- drivers/dma/imx-sdma.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 4d447be..dfebef9 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -1158,7 +1158,7 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic( struct sdma_engine *sdma = to_sdma_engine(sdmac); int num_periods = buf_len / period_len; int channel = sdmac->channel; - int ret, i = 0, buf = 0; + int ret, i; sdma_prep_common(sdmac, buf_len / period_len, direction); @@ -1166,7 +1166,7 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic( sdmac->flags |= IMX_DMA_SG_LOOP; - while (buf < buf_len) { + for (i = 0; i < num_periods; i++) { struct sdma_buffer_descriptor *bd = &sdmac->bd[i]; int param; @@ -1191,9 +1191,6 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic( bd->mode.status = param; dma_addr += period_len; - buf += period_len; - - i++; } sdma->channel_control[channel].current_bd_ptr = sdmac->bd_phys;