Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4814526yba; Tue, 30 Apr 2019 04:58:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzivOT/lpdymAeZANNTRdPwri0XBZ3Kf63O44V4MVxQlnX3XaGooBUKtwOq2XHrY2odm1iU X-Received: by 2002:a62:ed16:: with SMTP id u22mr69119564pfh.47.1556625519317; Tue, 30 Apr 2019 04:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556625519; cv=none; d=google.com; s=arc-20160816; b=CHx+BxIeEXexb99O7Ql0IT9ICvjEEwMG1htmWlPUHjXybvQmrKZjFIhb2UTzRD3SZX Zzvg+M6RMZBJ7X6l//06wA2tZK7hDxGUUTAwI5pWBc9mQLnwqEStnZPp1j9zbhWBfOKw tXzHrKicl0aY14coUShENQR19eHcDt9zla7qKD3rvDncRcgjJpRlqhJGHInnvZJt6X/s X6lOj6RJ4FzcsK2jZYPi8sBbdYDt436BL9qgwVd5vC5XEqthnb7t3rBeOSAEzPV8795h UqKlsMfe1JEXdJYnxUQz6YBOm+jyitKVIpIb6mr2PbgLVLra9xhnlKdJR6Mf/i15jW1X bb6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2SGqTn2UhPlgxZN0F8WzyL1zND2pA3RGANyvfgEQHOo=; b=Xwk319BxD0Rdcsf/+6teUV+ITz6ubZINixZpFfpW8CFL5fwm5U9judce4nT0t6CpEq pqUxg473ndYA9RGkVm6EXztg1u5BQJQ53NLT/mgxmQ73BJszhwxPwrtizMmzBTw7KxER 6LGqIQ8SAygvzOwnqnJWlI/JyPEIg68/EqkXKL4WPE76+PECKEjMkWgV81yl9hKlf+XM KkTej6DesUaRMww8CTdon7dYOj+pmOsBAEk86J3P+rpkokX2ZZ3ajGC5K9SaROZ5O/da +0t2HV0kqE5/rfKqQIckwZ+p4+inxWTC8RczT5UgnPW/FVZ4Ch/Djr6CD7lc16goWuC1 nxYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=H1mvM+qU; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d37si35532763plb.401.2019.04.30.04.58.24; Tue, 30 Apr 2019 04:58:39 -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=@kernel.org header.s=default header.b=H1mvM+qU; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730989AbfD3LtY (ORCPT + 99 others); Tue, 30 Apr 2019 07:49:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:35840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730981AbfD3LtU (ORCPT ); Tue, 30 Apr 2019 07:49:20 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9F9F62054F; Tue, 30 Apr 2019 11:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556624960; bh=z4ydPLtY8MXkZKPPSyu9HaRyKC1lHY5AqFb3OYwMQOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H1mvM+qUYs7TFwWq1iSsIYjKZNyJs+8Okb3DCUITQXUD12mOWwQKT3yitQRPsB39N PPDEfMTeCWGKPSItemA8D7TH8HFr/Nzdl2qP0O2LjOIa++Ph50Zf5jK1xPDZsljmTK xiimN6EhtmT8h0KTM2MeyW/+Lq9auJK28TVmw8zk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dirk Behme , Achim Dahlhoff , Hiroyuki Yokoyama , Yao Lihua , Yoshihiro Shimoda , Laurent Pinchart , Vinod Koul Subject: [PATCH 5.0 37/89] dmaengine: sh: rcar-dmac: With cyclic DMA residue 0 is valid Date: Tue, 30 Apr 2019 13:38:28 +0200 Message-Id: <20190430113611.581847201@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190430113609.741196396@linuxfoundation.org> References: <20190430113609.741196396@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dirk Behme commit 907bd68a2edc491849e2fdcfe52c4596627bca94 upstream. Having a cyclic DMA, a residue 0 is not an indication of a completed DMA. In case of cyclic DMA make sure that dma_set_residue() is called and with this a residue of 0 is forwarded correctly to the caller. Fixes: 3544d2878817 ("dmaengine: rcar-dmac: use result of updated get_residue in tx_status") Signed-off-by: Dirk Behme Signed-off-by: Achim Dahlhoff Signed-off-by: Hiroyuki Yokoyama Signed-off-by: Yao Lihua Reviewed-by: Yoshihiro Shimoda Reviewed-by: Laurent Pinchart Cc: # v4.8+ Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/dma/sh/rcar-dmac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -1368,6 +1368,7 @@ static enum dma_status rcar_dmac_tx_stat enum dma_status status; unsigned long flags; unsigned int residue; + bool cyclic; status = dma_cookie_status(chan, cookie, txstate); if (status == DMA_COMPLETE || !txstate) @@ -1375,10 +1376,11 @@ static enum dma_status rcar_dmac_tx_stat spin_lock_irqsave(&rchan->lock, flags); residue = rcar_dmac_chan_get_residue(rchan, cookie); + cyclic = rchan->desc.running ? rchan->desc.running->cyclic : false; spin_unlock_irqrestore(&rchan->lock, flags); /* if there's no residue, the cookie is complete */ - if (!residue) + if (!residue && !cyclic) return DMA_COMPLETE; dma_set_residue(txstate, residue);