Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3824581imm; Sat, 21 Jul 2018 04:09:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf6QyfE6WyQYmtdDTXD64R5Rn5N/50HguXEkDdTKlwpQ+Ey+HbE+NF4m/KTQ6fFzutFitr9 X-Received: by 2002:a63:5c7:: with SMTP id 190-v6mr5144492pgf.385.1532171375994; Sat, 21 Jul 2018 04:09:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532171375; cv=none; d=google.com; s=arc-20160816; b=VSx/UBKRH2sLga5fawWF7Fi4vOB+8PkhR2dXLIZUtDFaQbrjMivGQuf0mBJsyH9rgd MgRLDXsC+1xJrmYKx9p3lI6rYFdsq+Ybc0csa7e3QbRMrAlU1x5wnWx/Hq7PTOfiSW+p IKGs9CfLODEsyx1R0ugjrFSQNuGPsvRmncMBtoqJQ3YvA9ZNRg+TEGdhPOEM0X3B0O4A 0HE08UjrRys6YR5o6zYrC1FOlqJce1f7ZzpzVEDvm7ZfEg8oncRzqZvxSjmKTXEdeaGT jlvdxC6TPahTSUEQ/W6FCbbrmm9SFdCvrayIQ47o1qFvXVmrpJ91+W40PJIhD7jV1SHY jA6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=3ZNA5tKC0PGvEG0Z0j7s7lQNO20AqvUdxucu4hPPzyY=; b=FrujyZxOsq/5mU8nSU2QWUEBj3+Vyb7W3o6A/wbz8uJoTbynYnMXA3+rENJRoQVSc/ GdIrQN1HpDrLPMjKQEOLktw3+8Doq909kTEvhinzgVtvM/Tf+x4fk+JEK50qqr2tNeV0 aIWqq9BM2ATiNV281kFgCaJPQOrL/Da/IXTGAwtiq7cRug+8nC7yUPje/f7wcqrKXkCA dyQL5TOE0kcIaMo3WXNNp6+roJxdr6lz2/konokelB/oVLl++Ad+0wTUn1yXnxDNsJq1 RPyLqu9lq0X9sWb0fvugs2ie/kbTmnoAVGJUC069wWyEF4c1S+vshPrjEGxsuPXmly/4 Z8Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=vd3TBKm0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1-v6si3825400pga.71.2018.07.21.04.09.21; Sat, 21 Jul 2018 04:09:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=vd3TBKm0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728857AbeGUMAU (ORCPT + 99 others); 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)) -- 2.11.0