Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1097161imm; Tue, 3 Jul 2018 05:34:50 -0700 (PDT) X-Google-Smtp-Source: AAOMgpePu7XJGgg86+Je4w0cHdso+4r/jgd0G0DjmCujIi3vGo7ngQDaBKu4t36RyZUEhMZGGwGG X-Received: by 2002:a62:8b87:: with SMTP id e7-v6mr17309684pfl.133.1530621290106; Tue, 03 Jul 2018 05:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530621290; cv=none; d=google.com; s=arc-20160816; b=WUdYaL3jRYNCGL/DcUpuzZmdgV+CSrCem6Nv9l+1ObZonUshjbOXj1stSoOtVbIKQt aZYGfQ08KuZmeohMJPelF9d2NBDKrr7b2wqzlGBVseeD2FrEBhRaM4DbALuyTsp8cZ/o Dm4PXkOGwC7chXEr3OncIAJF2S503Ou9Q7HVyI6zV0ZkAeSt+UpKVVAQUvd+GVjfKbe2 PQgEJiikRiJ794oFqCK/XkfvTy1wlu6LVppHszWisF9L8Xa8E0eWt/Q/PLtMYl2JKSBB QFHnujdx66jq3aZIDtK5tHDIDq3LH2/e2dsw+8FXn15KlMV92UGf16w2rUEEr34ItMvG 6PTA== 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=9/6JpqsNrbpcWfS0o27b2rGFCQEIjnQIZBWkgANlJ6A=; b=XSow2kq7/9wcbpqLHml3WqHyaQrO1ile5w1I8xDqMYCKdLUUPYweFryQa7WQNxvSrQ ceYTjq1aZm/dNHsFPj/BAhIKdlaPK8oQYRm81sYIeDI+aITYW5ZW4kAiNL6Eow/bYpi9 J2pooKJtpRkT6uKQ7tvi2cmbu/xNaJZLR9GaZ9LKCfKU9d/PT2TVoFnypzOadiw8NHua ZLAz1WlYUS58crvtcBUKmipySyl/oCqbiwt1taVNlg2KUL2UwsFZrh7jeNaM5nH/Ysk2 beqfV/waTDsW/FRcRkxceViDdV/q6l7bQTEh3hmNXxZTMjT727DQl9ae4bRHELWbdtOu rT7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=X5EPHHlD; 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 u11-v6si983752plq.456.2018.07.03.05.34.35; Tue, 03 Jul 2018 05:34:50 -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=X5EPHHlD; 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 S932487AbeGCMdd (ORCPT + 99 others); Tue, 3 Jul 2018 08:33:33 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:50094 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932191AbeGCMco (ORCPT ); Tue, 3 Jul 2018 08:32:44 -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 , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org Subject: [PATCH 12/14] dmaengine: dma-jz4780: Use dma_set_residue() Date: Tue, 3 Jul 2018 14:32:12 +0200 Message-Id: <20180703123214.23090-13-paul@crapouillou.net> In-Reply-To: <20180703123214.23090-1-paul@crapouillou.net> References: <20180703123214.23090-1-paul@crapouillou.net> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1530621162; bh=9/6JpqsNrbpcWfS0o27b2rGFCQEIjnQIZBWkgANlJ6A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=X5EPHHlDS03UOL7PNQLZa/fzx+Lq5pFnjWdyT4rJHsiQRgKvjZTbZSsM3sJSpnySC0M5Fo2mPCZz9P+bv9zeQIrde7ODS48IJ9V/3f2n6woeGMLLOYW68v2XXvZoeLvYOR0JBsBqKa9AR1IiF+EmF5HN/xKK4twxFgT9rcyOSxg= 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 --- drivers/dma/dma-jz4780.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c index 690b853977b2..084b7a46a68d 100644 --- a/drivers/dma/dma-jz4780.c +++ b/drivers/dma/dma-jz4780.c @@ -633,6 +633,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)) @@ -643,13 +644,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.18.0