From patchwork Sat Jul 21 11:06:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 10538665 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C40C3602D7 for ; Sat, 21 Jul 2018 11:08:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB5E728B36 for ; Sat, 21 Jul 2018 11:08:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF3DC28CA6; Sat, 21 Jul 2018 11:08:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 662B028B36 for ; Sat, 21 Jul 2018 11:08:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728700AbeGUMAU (ORCPT ); Sat, 21 Jul 2018 08:00:20 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:44658 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728508AbeGUMAT (ORCPT ); Sat, 21 Jul 2018 08:00:19 -0400 From: Paul Cercueil To: Vinod Koul , Rob Herring , Mark Rutland , Ralf Baechle , Paul Burton , James Hogan , Zubair Lutfullah Kakakhel Cc: Mathieu Malaterre , Daniel Silsby , Paul Cercueil , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org Subject: [PATCH v3 15/18] dmaengine: dma-jz4780: Use dma_set_residue() Date: Sat, 21 Jul 2018 13:06:40 +0200 Message-Id: <20180721110643.19624-16-paul@crapouillou.net> In-Reply-To: <20180721110643.19624-1-paul@crapouillou.net> References: <20180721110643.19624-1-paul@crapouillou.net> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1532171278; bh=3ZNA5tKC0PGvEG0Z0j7s7lQNO20AqvUdxucu4hPPzyY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=vd3TBKm0DcJ+/WKLGPQ0VJ9kOP1kpR/r56EGnfG14HPkY7FEyKkphJHJQX/TKvO5rG0rCMtNvAMrqrMOoiO6NF+BobVPbUCBSqFZKODWIq2FhmmIzky+wlsLjtKQpsOvUGJohW5oxpwY17CEAcfxqfSUuIKSV26eAlKZmfLOrv0= Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Silsby This is the standard method provided by dmaengine header. Signed-off-by: Daniel Silsby Tested-by: Mathieu Malaterre --- drivers/dma/dma-jz4780.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) v2: No change v3: No change diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c index b9db539a5b34..ea17886031fa 100644 --- a/drivers/dma/dma-jz4780.c +++ b/drivers/dma/dma-jz4780.c @@ -637,6 +637,7 @@ static enum dma_status jz4780_dma_tx_status(struct dma_chan *chan, struct virt_dma_desc *vdesc; enum dma_status status; unsigned long flags; + unsigned long residue = 0; status = dma_cookie_status(chan, cookie, txstate); if ((status == DMA_COMPLETE) || (txstate == NULL)) @@ -647,13 +648,13 @@ static enum dma_status jz4780_dma_tx_status(struct dma_chan *chan, vdesc = vchan_find_desc(&jzchan->vchan, cookie); if (vdesc) { /* On the issued list, so hasn't been processed yet */ - txstate->residue = jz4780_dma_desc_residue(jzchan, + residue = jz4780_dma_desc_residue(jzchan, to_jz4780_dma_desc(vdesc), 0); } else if (cookie == jzchan->desc->vdesc.tx.cookie) { - txstate->residue = jz4780_dma_desc_residue(jzchan, jzchan->desc, + residue = jz4780_dma_desc_residue(jzchan, jzchan->desc, jzchan->curr_hwdesc + 1); - } else - txstate->residue = 0; + } + dma_set_residue(txstate, residue); if (vdesc && jzchan->desc && vdesc == &jzchan->desc->vdesc && jzchan->desc->status & (JZ_DMA_DCS_AR | JZ_DMA_DCS_HLT))