Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1097709imm; Tue, 3 Jul 2018 05:35:25 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcevlMb8UWJjMqT4fQSQhc/8fEJByrhuP+UGgtSvafMFqdhjAKVF6kFTzxzaWqeiOsDtU0o X-Received: by 2002:a65:4b07:: with SMTP id r7-v6mr13161964pgq.150.1530621325356; Tue, 03 Jul 2018 05:35:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530621325; cv=none; d=google.com; s=arc-20160816; b=zIAelvNBhyL++9m9i1UlU8nx8dhX78h2bKyfAL744ByBf33Hsa+6Akm0ll7p5Ykdvg 7F5WIt1APZnTi+67mxccVGQrarmYZ2Y1Ue+AnXw/8T6CHFuMnSySiTnkm6AjP3gF8jRL AUPTMmt2bb3R0f0qgMG7wac6QlIhfjhHoKKNzfMs8hUxjyhYoxg/5WwGjvcqrhpwCvU4 3JWuCTUh9wvzjomW1bLWQBA/yLU6Z0Sn1zpmjVTT5WYaJQK1MYyuAnvsmt6bxVq8YFeR 468ORSwL9FVs9sbMZcpNWvpGeU27+EZog2BZB3w6Y/ruhOvkvO3PAm9J5y6LrfLLXTvj 09aQ== 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=enkQAEhOU5uNiPVbgK7vMWl7oouDaqOl2/Xy8HlDqpM=; b=I+AIiyEw2eP5KxDDQAZqjegV29jy+p/ZZWRLS5/zBXlXVPJY3QMJoz3bGOjJsoe7ES FYcTim6NdrmWr6Ram/LR4fgO2YCAWSR2sGVd46qYFpwwOZHEJ9KC0oODna4/UQdcGY5q 419+eWuqslwmqokYQqSrHm5uPqtcoQ9jAIbTlV7XBv3PXfezVMKCYeqDAB/9UG7jqs6S yUaiVDHp9DO9WdQWNo93rzKNVmwscPrSq7+jZcBwchZs2I03R60haGClcWZJ3bwZa1Oc bgFeOBLXl9vvgnEHuY6GPRKRTOTHN8P+cpExpr86e7fk8rYKKi+8TanbyFOdp7KN6S63 usUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=nyjY6e6E; 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 87-v6si1051845pfi.60.2018.07.03.05.35.10; Tue, 03 Jul 2018 05:35:25 -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=nyjY6e6E; 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 S932236AbeGCMcp (ORCPT + 99 others); Tue, 3 Jul 2018 08:32:45 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:49726 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932181AbeGCMcn (ORCPT ); Tue, 3 Jul 2018 08:32:43 -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 11/14] dmaengine: dma-jz4780: Further residue status fix Date: Tue, 3 Jul 2018 14:32:11 +0200 Message-Id: <20180703123214.23090-12-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=1530621161; bh=enkQAEhOU5uNiPVbgK7vMWl7oouDaqOl2/Xy8HlDqpM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=nyjY6e6Ej1girbg211tllekja9eKNp2bLJzTNNLkvrVOE/JEpOn8A2OIfVYp15mrhDYYYCMdlf0ELUNe38Ez7c3bsIdO5Zr3BrrTcW+0wZNhzG7A+JVnIbYaEeqbYvsTaGywCQrXANQzBADE2aLEm0/AdHD3keFyQW3ycrGAqUM= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Silsby Func jz4780_dma_desc_residue() expects the index to the next hw descriptor as its last parameter. Caller func jz4780_dma_tx_status(), however, applied modulus before passing it. When the current hw descriptor was last in the list, the index passed became zero. The resulting excess of reported residue especially caused problems with cyclic DMA transfer clients, i.e. ALSA AIC audio output, which rely on this for determining current DMA location within buffer. Combined with the recent and related residue-reporting fixes, spurious ALSA audio underruns on jz4770 hardware are now fixed. Signed-off-by: Daniel Silsby --- drivers/dma/dma-jz4780.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c index 64270d53ba57..690b853977b2 100644 --- a/drivers/dma/dma-jz4780.c +++ b/drivers/dma/dma-jz4780.c @@ -647,7 +647,7 @@ static enum dma_status jz4780_dma_tx_status(struct dma_chan *chan, to_jz4780_dma_desc(vdesc), 0); } else if (cookie == jzchan->desc->vdesc.tx.cookie) { txstate->residue = jz4780_dma_desc_residue(jzchan, jzchan->desc, - (jzchan->curr_hwdesc + 1) % jzchan->desc->count); + jzchan->curr_hwdesc + 1); } else txstate->residue = 0; -- 2.18.0