Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3824659imm; Sat, 21 Jul 2018 04:09:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpehG0L8LpOQyIOOydmAxbNGh3QtiJZBhmdPpPoXayd5I/VoJkxOT7Rw8UpC1X1D9FjEj2w0 X-Received: by 2002:a63:b256:: with SMTP id t22-v6mr5442753pgo.101.1532171382608; Sat, 21 Jul 2018 04:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532171382; cv=none; d=google.com; s=arc-20160816; b=tDsXbehFnDk4l7ZCZY1K6MswHXsJzIQR1L/eHoigQxm1NO/9Xs5J7j+XLjANcuAVEF 4AoGD/Z/gTdiy9mXzV2b8hXxD9IPp0ELg0hATdBZfL57myEWYDcwawd39gMRvEA7Dren BpnMg5+Z2ROrL12BU5UCh3QH+L0B+lOy/ImpVaxSRkiANFmoOJ9JPBpJ8tKi5aO6Dmfg /YnjwzARS7W8f+OILM+EfHwklDZ0BNWu+TJptvCF2q+sKIgKIXowngXNsrIqPZngefsF 4AGy0uu/Scb0zQIBpGUAPK0+ux48LY7h96ERTD4KfYeYMIi9CiXigKhe63+IbRowrmqH UipQ== 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=/0Nvi7h+/eP8+juxL81xPTv6C/Ou8c5tXG+5O0XKn64=; b=y14tQ3jVeW8cknrCePifHXRh0bnh2Xn+wf+vn/jxiIr6BL2TISzaJl2UcnHfMdKM+E nU4kNOvqpiga6bK5ONYqLmnBOjt5+BmgoYjLPB58N5WhF281btsRX+ujbWNBVB79Qffv puHbVbgFgQPyZ7Jp244A23K2kD+QvbiEoTgRzp4hGXccCOeheAoTWquS4kMqx7gK/RKA HOOk4urqpyrsmu1/YzZS8FgZv4YDyuTItd2lFFeVuDMv3lrbx6aEq7x70m1Wf6LRzSQd 5w+5gMH8QfdQeFR44/nATgpiwAnwTphasTFBkTZjvP8gwfjO8DmMyWVlVYnjlf+MJRo/ pUbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=ERuJ5fIM; 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 1-v6si3511722plu.282.2018.07.21.04.09.28; Sat, 21 Jul 2018 04:09:42 -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=ERuJ5fIM; 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 S1728712AbeGUMAU (ORCPT + 99 others); Sat, 21 Jul 2018 08:00:20 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:43548 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727500AbeGUMAS (ORCPT ); Sat, 21 Jul 2018 08:00:18 -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 14/18] dmaengine: dma-jz4780: Further residue status fix Date: Sat, 21 Jul 2018 13:06:39 +0200 Message-Id: <20180721110643.19624-15-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=1532171276; bh=/0Nvi7h+/eP8+juxL81xPTv6C/Ou8c5tXG+5O0XKn64=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=ERuJ5fIM95RUei144DuEp3RhSFrnaGOpOsgZa+pR/071GZ2zGtu0OEvN1Rd9wJvtjd9dm8lTnmlcwZHp5WPVL6+vyc9D+3/+z5nwALp6UopT84Wi7IEkMlJyMGiaC9gaap6NaAgWxLsuQqbG5cQBROWIHolW0Zjv/toPenbTJsY= 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 Tested-by: Mathieu Malaterre --- drivers/dma/dma-jz4780.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) v2: No change v3: No change diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c index 78849131c81d..b9db539a5b34 100644 --- a/drivers/dma/dma-jz4780.c +++ b/drivers/dma/dma-jz4780.c @@ -651,7 +651,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.11.0