Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3825232imm; Sat, 21 Jul 2018 04:10:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf8N+dAYazymg0q1cs3WvSAtaTlkoHaWkshAMm4WwNLuo4vnbvTH3LKtyyCgUXTL4/clOmB X-Received: by 2002:a62:1e81:: with SMTP id e123-v6mr5795377pfe.24.1532171422684; Sat, 21 Jul 2018 04:10:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532171422; cv=none; d=google.com; s=arc-20160816; b=nDJ3u5K2fhW2hL2/u9rpoteaMGtRHdDNsvG/OxmwTFbb0X72R9W89tyNsFTrmD2PRG /gkD+647qvevSOGueC7km4X2uLLNQXJXiXqKfnsj3V/Mi/2XkLzO9VgVvqvCQqakA5n0 6P5854ek7M4Gm14t+KoWUf2PzdcJjs3ENUPe/2a/SPQWDWaI44uzIf2/pB5uf29eAXI3 CHtLu8f6VJxmeYrXf1AUySPBJY4FOWzFA0DzaDQ/y/Gf5i1fbVLstA+BXCnfS+FY8D77 H5bBi9LXeD+oXIxG958rchP5+zszKRddHbF1+jeltCGJi5N8cUIugS0hAcXhkY0VC+xf jeXQ== 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=iVl1WSvk+8t2K7zaxMYo+HF2r6Mz/L8E00zMICwZlgA=; b=yVWjVBtNqULQUqBJa66ftoHUGfWmpQRggSK1JaxqU/GzBDJTgl/KlZIJ2hPb9p3+Gy 91IovmD4JYZUjTMF8mnh3RCq50aW8qroDJ0KB8JnaPpT4nOrR8vSU6ISgoL9XEn6m7a9 sGebqJ0KcoE1pfjP4OHIMYzsX+9bvD2x30fTErZevFHllUnS9cqA/N3xej5uSsr9HrCg LiE0XB9kC8sWbxO6jPG2+cVh6oLqb+bh2WSPJwciX06i47SikqI2l3jxC9CRRfs+p0bX iyoaCx5qNSaS/KoUTT+0+qf+w4QN9UolagsAHduVMTdKfXIBz/wMsK544LGXjjI5kcQ0 NNuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=KVc2fsbK; 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 16-v6si3732062pfy.169.2018.07.21.04.10.08; Sat, 21 Jul 2018 04:10:22 -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=KVc2fsbK; 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 S1728459AbeGUMAQ (ORCPT + 99 others); Sat, 21 Jul 2018 08:00:16 -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 S1727500AbeGUMAP (ORCPT ); Sat, 21 Jul 2018 08:00:15 -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 12/18] dmaengine: dma-jz4780: Simplify jz4780_dma_desc_residue() Date: Sat, 21 Jul 2018 13:06:37 +0200 Message-Id: <20180721110643.19624-13-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=1532171273; bh=iVl1WSvk+8t2K7zaxMYo+HF2r6Mz/L8E00zMICwZlgA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=KVc2fsbKNTrGMrDCplPUDu7/4X1Zdgkod027284BZ1ZR4MOLmeq01zcwLPUxP1L4TQ+Xr7MH3urUoTUpzkboObCl/7o0zQotoNI9Wlgeh1T2A5DtgDLn0FIbhpLEC3pOJt1/EcBDYCIvtewG6+QK5zRN9AaOepXebcxdCrsVuJ4= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Silsby Simple cleanup, no changes to actual logic here. Signed-off-by: Daniel Silsby Tested-by: Mathieu Malaterre --- drivers/dma/dma-jz4780.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) v2: No change v3: No change diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c index fa926de082ba..cc2a86844db4 100644 --- a/drivers/dma/dma-jz4780.c +++ b/drivers/dma/dma-jz4780.c @@ -608,22 +608,17 @@ static size_t jz4780_dma_desc_residue(struct jz4780_dma_chan *jzchan, struct jz4780_dma_desc *desc, unsigned int next_sg) { struct jz4780_dma_dev *jzdma = jz4780_dma_chan_parent(jzchan); - unsigned int residue, count; + unsigned int count = 0; unsigned int i; - residue = 0; - for (i = next_sg; i < desc->count; i++) - residue += (desc->desc[i].dtc & 0xffffff) << - jzchan->transfer_shift; + count += desc->desc[i].dtc & 0xffffff; - if (next_sg != 0) { - count = jz4780_dma_chn_readl(jzdma, jzchan->id, + if (next_sg != 0) + count += jz4780_dma_chn_readl(jzdma, jzchan->id, JZ_DMA_REG_DTC); - residue += count << jzchan->transfer_shift; - } - return residue; + return count << jzchan->transfer_shift; } static enum dma_status jz4780_dma_tx_status(struct dma_chan *chan, -- 2.11.0