From patchwork Tue May 17 03:47:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Jiada" X-Patchwork-Id: 9108801 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5F959BF29F for ; Tue, 17 May 2016 03:53:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A81A20268 for ; Tue, 17 May 2016 03:53:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 88C48201B9 for ; Tue, 17 May 2016 03:53:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755479AbcEQDx1 (ORCPT ); Mon, 16 May 2016 23:53:27 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:38134 "EHLO relay1.mentorg.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752408AbcEQDr7 (ORCPT ); Mon, 16 May 2016 23:47:59 -0400 Received: from svr-orw-fem-05.mgc.mentorg.com ([147.34.97.43]) by relay1.mentorg.com with esmtp id 1b2VzC-0004qN-9W from Jiada_Wang@mentor.com ; Mon, 16 May 2016 20:47:58 -0700 Received: from jiwang-OptiPlex-980.tokyo.mentorg.com (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.3.224.2; Mon, 16 May 2016 20:47:58 -0700 From: Jiada Wang To: , CC: , , , , , Subject: [PATCH 02/10] dma: imx-sdma: don't update BD in isr routine Date: Tue, 17 May 2016 12:47:48 +0900 Message-ID: <1463456876-10580-3-git-send-email-jiada_wang@mentor.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1463456876-10580-1-git-send-email-jiada_wang@mentor.com> References: <1463456876-10580-1-git-send-email-jiada_wang@mentor.com> MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);