aboutsummaryrefslogtreecommitdiff
path: root/drivers/dma/ste_dma40.c
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2011-01-25 11:18:26 +0100
committerDan Williams <dan.j.williams@intel.com>2011-01-30 22:27:19 -0800
commit5ed04b8575cb22920b1333aeb55121339449048f (patch)
tree4931e3f65f92da16a1967263b4c0f3623cce144d /drivers/dma/ste_dma40.c
parente24b36bdf873b4a64545fd66da13877214d235cf (diff)
dma40: unify d40_log_sg_to_lli funcs for mem and slave
Acked-by: Per Forlin <per.forlin@stericsson.com> Acked-by: Jonas Aaberg <jonas.aberg@stericsson.com> Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/ste_dma40.c')
-rw-r--r--drivers/dma/ste_dma40.c41
1 files changed, 16 insertions, 25 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 6a7a00d5d68..c597dba713b 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -1638,37 +1638,28 @@ d40_prep_sg_log(struct d40_chan *chan, struct d40_desc *desc,
unsigned int sg_len, enum dma_data_direction direction,
dma_addr_t dev_addr)
{
+ dma_addr_t src_dev_addr = direction == DMA_FROM_DEVICE ? dev_addr : 0;
+ dma_addr_t dst_dev_addr = direction == DMA_TO_DEVICE ? dev_addr : 0;
struct stedma40_chan_cfg *cfg = &chan->dma_cfg;
struct stedma40_half_channel_info *src_info = &cfg->src_info;
struct stedma40_half_channel_info *dst_info = &cfg->dst_info;
+ int ret;
- if (direction == DMA_NONE) {
- /* memcpy */
- (void) d40_log_sg_to_lli(sg_src, sg_len,
- desc->lli_log.src,
- chan->log_def.lcsp1,
- src_info->data_width,
- dst_info->data_width);
-
- (void) d40_log_sg_to_lli(sg_dst, sg_len,
- desc->lli_log.dst,
- chan->log_def.lcsp3,
- dst_info->data_width,
- src_info->data_width);
- } else {
- unsigned int total_size;
+ ret = d40_log_sg_to_lli(sg_src, sg_len,
+ src_dev_addr,
+ desc->lli_log.src,
+ chan->log_def.lcsp1,
+ src_info->data_width,
+ dst_info->data_width);
- total_size = d40_log_sg_to_dev(sg_src, sg_len,
- &desc->lli_log,
- &chan->log_def,
- src_info->data_width,
- dst_info->data_width,
- direction, dev_addr);
- if (total_size < 0)
- return -EINVAL;
- }
+ ret = d40_log_sg_to_lli(sg_dst, sg_len,
+ dst_dev_addr,
+ desc->lli_log.dst,
+ chan->log_def.lcsp3,
+ dst_info->data_width,
+ src_info->data_width);
- return 0;
+ return ret < 0 ? ret : 0;
}
static int