From patchwork Mon Jun 15 16:19:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joshua Clayton X-Patchwork-Id: 6610611 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 E9C649F1C1 for ; Mon, 15 Jun 2015 16:24:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D6F820769 for ; Mon, 15 Jun 2015 16:24:13 +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 31D0420768 for ; Mon, 15 Jun 2015 16:24:12 +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 1Z4X8f-0006uQ-AQ; Mon, 15 Jun 2015 16:21:33 +0000 Received: from mail-pd0-x233.google.com ([2607:f8b0:400e:c02::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z4X6u-0004vW-Gi for linux-arm-kernel@lists.infradead.org; Mon, 15 Jun 2015 16:19:45 +0000 Received: by pdjn11 with SMTP id n11so76238605pdj.0 for ; Mon, 15 Jun 2015 09:19:23 -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=3tN0VRLx0i4fFZ186SC1xzBaQWfSXta1aSOVbn03Fhc=; b=NaNmMeHQT+1/VrU+XgYmhVLviOGxb+u1pSltp+aWSrEXxH8KqmBFxyowLlcUfeqgV8 4ZbGW3vlDFzUnY++pC6+NDf4GQPXZLNwc9H3axbSJTFFXZbQu8ePj957R2q5yYBi6L9w rmadee2lTppC9R6PZ4hUJh3Q3yOUAa5JY1dDMljmr/+iseOIwLODqEjs7EqrP9+vUoYY PMTvE/X7NlVUmsbXxjXTcbK0pj2wBV1JZ/1jRVnRoLtQOXM/PasnFCAj+I0KCSLX8qPZ tq1QTZ4WJD4G35T9FPmiqmAmCqiMuZMp4NiSSbtJcapY/5uEgp/qx5fJVeVxaZHDk9vu PvZQ== X-Received: by 10.68.232.164 with SMTP id tp4mr49183528pbc.101.1434385163144; Mon, 15 Jun 2015 09:19:23 -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.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Jun 2015 09:19:22 -0700 (PDT) From: Joshua Clayton To: Vinod Koul Subject: [PATCH 06/10] dma: imx-sdma: config in sdma_config_channel() Date: Mon, 15 Jun 2015 09:19:01 -0700 Message-Id: <1434385144-4432-7-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_091944_640194_EECD80B0 X-CRM114-Status: GOOD ( 15.55 ) 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=unavailable 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 Move functionality that is part of sdma_config_channel() from the switch statement into the function itself. This puts code together that belongs together, and gets rid of a single use variable in struct sdma_channel Signed-off-by: Joshua Clayton --- drivers/dma/imx-sdma.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 8358a1a..a13383b 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -258,7 +258,6 @@ struct sdma_channel { struct sdma_buffer_descriptor *bd; dma_addr_t bd_phys; unsigned long flags; - dma_addr_t per_address; unsigned long event_mask[2]; unsigned long watermark_level; u32 shp_addr, per_addr; @@ -840,12 +839,26 @@ static void sdma_disable_channel(struct sdma_engine *sdma, int channel) sdma->channel[channel].status = DMA_ERROR; } -static int sdma_config_channel(struct sdma_channel *sdmac) +static int sdma_config_channel(struct sdma_channel *sdmac, + struct dma_slave_config *dmaengine_cfg) { int ret; int channel = sdmac->channel; struct sdma_engine *sdma = to_sdma_engine(sdmac); + dma_addr_t per_address; + if (dmaengine_cfg->direction == DMA_DEV_TO_MEM) { + per_address = dmaengine_cfg->src_addr; + sdmac->watermark_level = dmaengine_cfg->src_maxburst * + dmaengine_cfg->src_addr_width; + sdmac->word_size = dmaengine_cfg->src_addr_width; + } else { + per_address = dmaengine_cfg->dst_addr; + sdmac->watermark_level = dmaengine_cfg->dst_maxburst * + dmaengine_cfg->dst_addr_width; + sdmac->word_size = dmaengine_cfg->dst_addr_width; + } + sdmac->direction = dmaengine_cfg->direction; sdma_disable_channel(sdma, channel); sdmac->event_mask[0] = 0; @@ -887,7 +900,7 @@ static int sdma_config_channel(struct sdma_channel *sdmac) /* Watermark Level */ sdmac->watermark_level |= sdmac->watermark_level; /* Address */ - sdmac->shp_addr = sdmac->per_address; + sdmac->shp_addr = per_address; } else { sdmac->watermark_level = 0; /* FIXME: M3_BASE_ADDRESS */ } @@ -1215,19 +1228,7 @@ static int sdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, sdma_disable_channel(sdma, sdmac->channel); return 0; case DMA_SLAVE_CONFIG: - if (dmaengine_cfg->direction == DMA_DEV_TO_MEM) { - sdmac->per_address = dmaengine_cfg->src_addr; - sdmac->watermark_level = dmaengine_cfg->src_maxburst * - dmaengine_cfg->src_addr_width; - sdmac->word_size = dmaengine_cfg->src_addr_width; - } else { - sdmac->per_address = dmaengine_cfg->dst_addr; - sdmac->watermark_level = dmaengine_cfg->dst_maxburst * - dmaengine_cfg->dst_addr_width; - sdmac->word_size = dmaengine_cfg->dst_addr_width; - } - sdmac->direction = dmaengine_cfg->direction; - return sdma_config_channel(sdmac); + return sdma_config_channel(sdmac, dmaengine_cfg); default: return -ENOSYS; }