diff options
author | Sudhakar Rajashekhara <sudhakar.raj@ti.com> | 2010-01-06 06:59:11 -0500 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2010-02-04 16:30:01 -0500 |
commit | 447f18f1b4a3e86159353d016dcaac25414b3a42 (patch) | |
tree | 6a7d3c23189ee9e9c4dd53a2be74bc3f68783b63 /arch/arm/mach-davinci/dma.c | |
parent | 2d517508060c22ef371a61495773cf890def291a (diff) |
davinci: Fix edma_alloc_channel api for EDMA_CHANNEL_ANY case
Though edma_alloc_channel api was looping through the available
channel controllers in EDMA_CHANNEL_ANY case, it was never
returning the channel for 2nd channel controller, if 1st
channel controller had no free channels. This issue has
been fixed with this patch.
Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/dma.c')
-rw-r--r-- | arch/arm/mach-davinci/dma.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c index 97a49f98fe13..89a3dccde19f 100644 --- a/arch/arm/mach-davinci/dma.c +++ b/arch/arm/mach-davinci/dma.c | |||
@@ -595,7 +595,7 @@ int edma_alloc_channel(int channel, | |||
595 | void *data, | 595 | void *data, |
596 | enum dma_event_q eventq_no) | 596 | enum dma_event_q eventq_no) |
597 | { | 597 | { |
598 | unsigned i, done, ctlr = 0; | 598 | unsigned i, done = 0, ctlr = 0; |
599 | 599 | ||
600 | if (channel >= 0) { | 600 | if (channel >= 0) { |
601 | ctlr = EDMA_CTLR(channel); | 601 | ctlr = EDMA_CTLR(channel); |
@@ -611,7 +611,7 @@ int edma_alloc_channel(int channel, | |||
611 | edma_info[i]->num_channels, | 611 | edma_info[i]->num_channels, |
612 | channel); | 612 | channel); |
613 | if (channel == edma_info[i]->num_channels) | 613 | if (channel == edma_info[i]->num_channels) |
614 | return -ENOMEM; | 614 | break; |
615 | if (!test_and_set_bit(channel, | 615 | if (!test_and_set_bit(channel, |
616 | edma_info[i]->edma_inuse)) { | 616 | edma_info[i]->edma_inuse)) { |
617 | done = 1; | 617 | done = 1; |
@@ -623,6 +623,8 @@ int edma_alloc_channel(int channel, | |||
623 | if (done) | 623 | if (done) |
624 | break; | 624 | break; |
625 | } | 625 | } |
626 | if (!done) | ||
627 | return -ENOMEM; | ||
626 | } else if (channel >= edma_info[ctlr]->num_channels) { | 628 | } else if (channel >= edma_info[ctlr]->num_channels) { |
627 | return -EINVAL; | 629 | return -EINVAL; |
628 | } else if (test_and_set_bit(channel, edma_info[ctlr]->edma_inuse)) { | 630 | } else if (test_and_set_bit(channel, edma_info[ctlr]->edma_inuse)) { |