Skip to content

Commit

Permalink
fsldma: fix off by one in dma_halt
Browse files Browse the repository at this point in the history
Prevent dev_err from firing even if we successfully detected 'dma-idle'
before the full 1ms timeout has elapsed.

Acked-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
  • Loading branch information
Dan Williams committed Mar 4, 2009
1 parent 0c33e1c commit 900325a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/dma/fsldma.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,20 @@ static void dma_start(struct fsl_dma_chan *fsl_chan)

static void dma_halt(struct fsl_dma_chan *fsl_chan)
{
int i = 0;
int i;

DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr,
DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) | FSL_DMA_MR_CA,
32);
DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr,
DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) & ~(FSL_DMA_MR_CS
| FSL_DMA_MR_EMS_EN | FSL_DMA_MR_CA), 32);

while (!dma_is_idle(fsl_chan) && (i++ < 100))
for (i = 0; i < 100; i++) {
if (dma_is_idle(fsl_chan))
break;
udelay(10);
}
if (i >= 100 && !dma_is_idle(fsl_chan))
dev_err(fsl_chan->dev, "DMA halt timeout!\n");
}
Expand Down

0 comments on commit 900325a

Please sign in to comment.