summaryrefslogtreecommitdiffstats
path: root/drivers/dma/ste_dma40_ll.c
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2011-01-25 11:18:25 +0100
committerDan Williams <dan.j.williams@intel.com>2011-01-30 22:27:19 -0800
commite24b36bdf873b4a64545fd66da13877214d235cf (patch)
tree0490a45fe1cae96aa9a6c092172dcbba07aa6aa9 /drivers/dma/ste_dma40_ll.c
parent1c4b0927feab41346b0be971e0287aaf46eba8e0 (diff)
downloadlinux-e24b36bdf873b4a64545fd66da13877214d235cf.tar.bz2
dma40: combine duplicated code in log_sg_to_dev
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_ll.c')
-rw-r--r--drivers/dma/ste_dma40_ll.c52
1 files changed, 23 insertions, 29 deletions
diff --git a/drivers/dma/ste_dma40_ll.c b/drivers/dma/ste_dma40_ll.c
index fd7525162596..fa6c3ab93fae 100644
--- a/drivers/dma/ste_dma40_ll.c
+++ b/drivers/dma/ste_dma40_ll.c
@@ -385,40 +385,34 @@ int d40_log_sg_to_dev(struct scatterlist *sg,
struct d40_log_lli *lli_dst = lli->dst;
for_each_sg(sg, current_sg, sg_len, i) {
- total_size += sg_dma_len(current_sg);
+ dma_addr_t sg_addr = sg_dma_address(current_sg);
+ unsigned int len = sg_dma_len(current_sg);
+ dma_addr_t src;
+ dma_addr_t dst;
+
+ total_size += len;
if (direction == DMA_TO_DEVICE) {
- lli_src =
- d40_log_buf_to_lli(lli_src,
- sg_dma_address(current_sg),
- sg_dma_len(current_sg),
- lcsp->lcsp1, src_data_width,
- dst_data_width,
- true);
- lli_dst =
- d40_log_buf_to_lli(lli_dst,
- dev_addr,
- sg_dma_len(current_sg),
- lcsp->lcsp3, dst_data_width,
- src_data_width,
- false);
+ src = sg_addr;
+ dst = dev_addr;
} else {
- lli_dst =
- d40_log_buf_to_lli(lli_dst,
- sg_dma_address(current_sg),
- sg_dma_len(current_sg),
- lcsp->lcsp3, dst_data_width,
- src_data_width,
- true);
- lli_src =
- d40_log_buf_to_lli(lli_src,
- dev_addr,
- sg_dma_len(current_sg),
- lcsp->lcsp1, src_data_width,
- dst_data_width,
- false);
+ src = dev_addr;
+ dst = sg_addr;
}
+
+ lli_src = d40_log_buf_to_lli(lli_src, src, len,
+ lcsp->lcsp1,
+ src_data_width,
+ dst_data_width,
+ src == sg_addr);
+
+ lli_dst = d40_log_buf_to_lli(lli_dst, dst, len,
+ lcsp->lcsp3,
+ dst_data_width,
+ src_data_width,
+ dst == sg_addr);
}
+
return total_size;
}