summaryrefslogtreecommitdiff
path: root/drivers/dma
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2011-01-25 11:18:25 +0100
committerRabin VINCENT <rabin.vincent@stericsson.com>2011-10-20 14:56:16 +0200
commit9b443812cf12d8c8e2f30064e5eaff56e2116cb0 (patch)
tree523e438b55b59179b0d35e07149acd165a680cd6 /drivers/dma
parent83050f1f167cdbf2f9957c4d26591a9d29b5b608 (diff)
dma40: combine duplicated code in log_sg_to_dev
ST-Ericsson ID: 362972 ST-Ericsson FOSS-OUT ID: NA ST-Ericsson Linux next: NA Change-Id: If9c32d98633fb88fc04b1ef948f197fb0fc63387 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> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/34700 Tested-by: Narayanan GOPALAKRISHNAN <narayanan.gopalakrishnan@stericsson.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/ste_dma40_ll.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/dma/ste_dma40_ll.c b/drivers/dma/ste_dma40_ll.c
index 75c8e6cbdcc..28098d49eac 100644
--- a/drivers/dma/ste_dma40_ll.c
+++ b/drivers/dma/ste_dma40_ll.c
@@ -342,32 +342,32 @@ int d40_log_sg_to_dev(struct scatterlist *sg,
int i;
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) {
- d40_log_fill_lli(&lli->src[i],
- sg_dma_address(current_sg),
- sg_dma_len(current_sg),
- lcsp->lcsp1, src_data_width,
- true);
- d40_log_fill_lli(&lli->dst[i],
- dev_addr,
- sg_dma_len(current_sg),
- lcsp->lcsp3, dst_data_width,
- false);
+ src = sg_addr;
+ dst = dev_addr;
} else {
- d40_log_fill_lli(&lli->dst[i],
- sg_dma_address(current_sg),
- sg_dma_len(current_sg),
- lcsp->lcsp3, dst_data_width,
- true);
- d40_log_fill_lli(&lli->src[i],
- dev_addr,
- sg_dma_len(current_sg),
- lcsp->lcsp1, src_data_width,
- false);
+ src = dev_addr;
+ dst = sg_addr;
}
+
+ d40_log_fill_lli(&lli->src[i], src, len,
+ lcsp->lcsp1,
+ src_data_width,
+ src == sg_addr);
+
+ d40_log_fill_lli(&lli->dst[i], dst, len,
+ lcsp->lcsp3,
+ dst_data_width,
+ dst == sg_addr);
}
+
return total_size;
}