diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2011-01-25 05:18:25 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-01-31 01:27:19 -0500 |
commit | e24b36bdf873b4a64545fd66da13877214d235cf (patch) | |
tree | 0490a45fe1cae96aa9a6c092172dcbba07aa6aa9 /drivers/dma/ste_dma40_ll.c | |
parent | 1c4b0927feab41346b0be971e0287aaf46eba8e0 (diff) |
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.c | 52 |
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, | |||
385 | struct d40_log_lli *lli_dst = lli->dst; | 385 | struct d40_log_lli *lli_dst = lli->dst; |
386 | 386 | ||
387 | for_each_sg(sg, current_sg, sg_len, i) { | 387 | for_each_sg(sg, current_sg, sg_len, i) { |
388 | total_size += sg_dma_len(current_sg); | 388 | dma_addr_t sg_addr = sg_dma_address(current_sg); |
389 | unsigned int len = sg_dma_len(current_sg); | ||
390 | dma_addr_t src; | ||
391 | dma_addr_t dst; | ||
392 | |||
393 | total_size += len; | ||
389 | 394 | ||
390 | if (direction == DMA_TO_DEVICE) { | 395 | if (direction == DMA_TO_DEVICE) { |
391 | lli_src = | 396 | src = sg_addr; |
392 | d40_log_buf_to_lli(lli_src, | 397 | dst = dev_addr; |
393 | sg_dma_address(current_sg), | ||
394 | sg_dma_len(current_sg), | ||
395 | lcsp->lcsp1, src_data_width, | ||
396 | dst_data_width, | ||
397 | true); | ||
398 | lli_dst = | ||
399 | d40_log_buf_to_lli(lli_dst, | ||
400 | dev_addr, | ||
401 | sg_dma_len(current_sg), | ||
402 | lcsp->lcsp3, dst_data_width, | ||
403 | src_data_width, | ||
404 | false); | ||
405 | } else { | 398 | } else { |
406 | lli_dst = | 399 | src = dev_addr; |
407 | d40_log_buf_to_lli(lli_dst, | 400 | dst = sg_addr; |
408 | sg_dma_address(current_sg), | ||
409 | sg_dma_len(current_sg), | ||
410 | lcsp->lcsp3, dst_data_width, | ||
411 | src_data_width, | ||
412 | true); | ||
413 | lli_src = | ||
414 | d40_log_buf_to_lli(lli_src, | ||
415 | dev_addr, | ||
416 | sg_dma_len(current_sg), | ||
417 | lcsp->lcsp1, src_data_width, | ||
418 | dst_data_width, | ||
419 | false); | ||
420 | } | 401 | } |
402 | |||
403 | lli_src = d40_log_buf_to_lli(lli_src, src, len, | ||
404 | lcsp->lcsp1, | ||
405 | src_data_width, | ||
406 | dst_data_width, | ||
407 | src == sg_addr); | ||
408 | |||
409 | lli_dst = d40_log_buf_to_lli(lli_dst, dst, len, | ||
410 | lcsp->lcsp3, | ||
411 | dst_data_width, | ||
412 | src_data_width, | ||
413 | dst == sg_addr); | ||
421 | } | 414 | } |
415 | |||
422 | return total_size; | 416 | return total_size; |
423 | } | 417 | } |
424 | 418 | ||