Skip to content

Commit

Permalink
davinci: Fix edma_alloc_channel api for EDMA_CHANNEL_ANY case
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sudhakar Rajashekhara authored and Kevin Hilman committed Feb 4, 2010
1 parent 2d51750 commit 447f18f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arch/arm/mach-davinci/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ int edma_alloc_channel(int channel,
void *data,
enum dma_event_q eventq_no)
{
unsigned i, done, ctlr = 0;
unsigned i, done = 0, ctlr = 0;

if (channel >= 0) {
ctlr = EDMA_CTLR(channel);
Expand All @@ -611,7 +611,7 @@ int edma_alloc_channel(int channel,
edma_info[i]->num_channels,
channel);
if (channel == edma_info[i]->num_channels)
return -ENOMEM;
break;
if (!test_and_set_bit(channel,
edma_info[i]->edma_inuse)) {
done = 1;
Expand All @@ -623,6 +623,8 @@ int edma_alloc_channel(int channel,
if (done)
break;
}
if (!done)
return -ENOMEM;
} else if (channel >= edma_info[ctlr]->num_channels) {
return -EINVAL;
} else if (test_and_set_bit(channel, edma_info[ctlr]->edma_inuse)) {
Expand Down

0 comments on commit 447f18f

Please sign in to comment.