Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1401365

[PATCH 02/10] dma: imx-sdma: don't update BD in isr routine

From Jiada Wang <jiada_wang@mentor.com>
Newsgroups linux.kernel
Subject [PATCH 02/10] dma: imx-sdma: don't update BD in isr routine
Date 2016-05-16 10:40 +0200
Message-ID <rzmee-4Dx-17@gated-at.bofh.it> (permalink)
References <rzmed-4Dx-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


commit d1a792f3b407 ("Update imx-sdma cyclic handling to report residue")
moves updating of BD to isr routine, to avoid stop
of cyclic dma, but there is chance 'new' isr comes before the 'old'
tasklet can be fired, thus cause data loss due to missing of one
tasklet. So move updating of BD back to tasklet.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
---
 drivers/dma/imx-sdma.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 1f1b64b..887e4e5 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -656,12 +656,6 @@ static void sdma_event_disable(struct sdma_channel *sdmac, unsigned int event)
 
 static void sdma_handle_channel_loop(struct sdma_channel *sdmac)
 {
-	if (sdmac->desc.callback)
-		sdmac->desc.callback(sdmac->desc.callback_param);
-}
-
-static void sdma_update_channel_loop(struct sdma_channel *sdmac)
-{
 	struct sdma_buffer_descriptor *bd;
 
 	/*
@@ -685,6 +679,9 @@ static void sdma_update_channel_loop(struct sdma_channel *sdmac)
 			sdmac->chn_real_count = bd->mode.count;
 			bd->mode.count = sdmac->chn_count;
 		}
+
+		if (sdmac->desc.callback)
+			sdmac->desc.callback(sdmac->desc.callback_param);
 	}
 }
 
@@ -740,9 +737,6 @@ static irqreturn_t sdma_int_handler(int irq, void *dev_id)
 		int channel = fls(stat) - 1;
 		struct sdma_channel *sdmac = &sdma->channel[channel];
 
-		if (sdmac->flags & IMX_DMA_SG_LOOP)
-			sdma_update_channel_loop(sdmac);
-
 		tasklet_schedule(&sdmac->tasklet);
 
 		__clear_bit(channel, &stat);
-- 
2.4.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v1 00/10] *** imx-sdma: misc fix *** Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:40 +0200
  [PATCH 06/10] dma: imx-sdma: add terminate_all support Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:40 +0200
  [PATCH 02/10] dma: imx-sdma: don't update BD in isr routine Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:40 +0200
  [PATCH 08/10] dma: imx-sdma: abort updating channel when it has been terminated Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:40 +0200
  [PATCH 10/10] dma: imx-sdma: clear channel0 interrupt bit in irq routine Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:40 +0200
  [PATCH 07/10] dma: imx-sdma: Add synchronization support Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:40 +0200
  [PATCH 01/10] dma: imx-sdma: use chn_real_count to report residue for UART Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:50 +0200
  [PATCH 05/10] dma: imx-sdma: add flag to indicate SDMA channel state Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:50 +0200
  [PATCH 03/10] dma: imx-sdma: clear BD_RROR flag before pass it to sdma script Jiada Wang <jiada_wang@mentor.com> - 2016-05-16 10:50 +0200
  Re: [PATCH v1 00/10] *** imx-sdma: misc fix *** Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> - 2016-05-16 13:10 +0200

csiph-web