[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1434385144-4432-7-git-send-email-stillcompiling@gmail.com>
Date: Mon, 15 Jun 2015 09:19:01 -0700
From: Joshua Clayton <stillcompiling@...il.com>
To: Vinod Koul <vinod.koul@...el.com>
Cc: Joshua Clayton <stillcompiling@...il.com>,
Dan Williams <dan.j.williams@...el.com>,
dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
Shawn Guo <shawn.guo@...aro.org>
Subject: [PATCH 06/10] dma: imx-sdma: config in sdma_config_channel()
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 <stillcompiling@...il.com>
---
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;
}
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists