From nobody Sat Dec 27 22:51:50 2025 Received: from aposti.net (aposti.net [89.234.176.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96DFF2D791; Fri, 15 Dec 2023 13:14:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crapouillou.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=crapouillou.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b="Srd2SsiP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1702646029; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=21xrIJTonl2JSPX53jr10oHQ64LwYtc2R0VBvZ9/BIs=; b=Srd2SsiPVhfJfsyWju8h+Dm7x5+BPCtFQl+HxHQbQDmI+PE4bBDNFI8XEZ/F00eK+WVL0E 1WRaVjqdmk26n/7H3E5q1RbKKjB/g34lRMRLvxcKJPC2sqozzM8vmaANDeLiVdaMqTPdyM /RQRKKg/IfZopXUG219fOc6KrlKNbXY= From: Paul Cercueil To: Vinod Koul Cc: Lars-Peter Clausen , =?UTF-8?q?Nuno=20S=C3=A1?= , Michael Hennerich , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v2 1/5] dmaengine: axi-dmac: Small code cleanup Date: Fri, 15 Dec 2023 14:13:09 +0100 Message-ID: <20231215131313.23840-2-paul@crapouillou.net> In-Reply-To: <20231215131313.23840-1-paul@crapouillou.net> References: <20231215131313.23840-1-paul@crapouillou.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam: Yes Content-Type: text/plain; charset="utf-8" Use a for() loop instead of a while() loop in axi_dmac_fill_linear_sg(). This makes the code leaner and cleaner overall, and does not introduce any functional change. Signed-off-by: Paul Cercueil --- v2: Improve commit message --- drivers/dma/dma-axi-dmac.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c index 2457a420c13d..760940b21eab 100644 --- a/drivers/dma/dma-axi-dmac.c +++ b/drivers/dma/dma-axi-dmac.c @@ -508,16 +508,13 @@ static struct axi_dmac_sg *axi_dmac_fill_linear_sg(st= ruct axi_dmac_chan *chan, segment_size =3D ((segment_size - 1) | chan->length_align_mask) + 1; =20 for (i =3D 0; i < num_periods; i++) { - len =3D period_len; - - while (len > segment_size) { + for (len =3D period_len; len > segment_size; sg++) { if (direction =3D=3D DMA_DEV_TO_MEM) sg->dest_addr =3D addr; else sg->src_addr =3D addr; sg->x_len =3D segment_size; sg->y_len =3D 1; - sg++; addr +=3D segment_size; len -=3D segment_size; } --=20 2.42.0