[PATCH/RFC] dmaengine: shdma: clear channel buffers on TERMINATE_ALL

From: Guennadi Liakhovetski
Date: Fri Jan 06 2012 - 07:12:39 EST


Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@xxxxxx>
---

No, I don't have a bug for this fix:-) That's why I marked it an RFC and,
actually, I wouldn't apply it. Clearing the buffers seems to be a good
idea to me, but so far I haven't had a case, where it was needed. Let's
just have this patch out there in archives in case we need it one day.

drivers/dma/shdma.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index e1a2fa6..cabcfe8 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -707,6 +707,7 @@ static int sh_dmae_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
unsigned long arg)
{
struct sh_dmae_chan *sh_chan = to_sh_chan(chan);
+ struct sh_dmae_device *shdev = to_sh_dev(sh_chan);
unsigned long flags;

/* Only supports DMA_TERMINATE_ALL */
@@ -719,6 +720,9 @@ static int sh_dmae_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
spin_lock_irqsave(&sh_chan->desc_lock, flags);
dmae_halt(sh_chan);

+ if (shdev->pdata->chclr_present)
+ chclr_write(sh_chan, 0);
+
if (!list_empty(&sh_chan->ld_queue)) {
/* Record partial transfer */
struct sh_desc *desc = list_entry(sh_chan->ld_queue.next,
--
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/