summaryrefslogtreecommitdiffstats
path: root/drivers/dma/dma-axi-dmac.c
diff options
context:
space:
mode:
authorPaul Cercueil <paul@crapouillou.net>2023-12-15 14:13:09 +0100
committerVinod Koul <vkoul@kernel.org>2023-12-21 21:39:56 +0530
commita2ab7045389feab1c26ebab105a8ad6bce74a4a7 (patch)
tree136cf027ed67d42405debcaddc079b2021b83bb1 /drivers/dma/dma-axi-dmac.c
parent71e7d3cb6e55ae2eadcdb178f9243dc18499d369 (diff)
downloadlinux-a2ab7045389feab1c26ebab105a8ad6bce74a4a7.tar.gz
linux-a2ab7045389feab1c26ebab105a8ad6bce74a4a7.tar.bz2
linux-a2ab7045389feab1c26ebab105a8ad6bce74a4a7.zip
dmaengine: axi-dmac: Small code cleanup
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 <paul@crapouillou.net> Link: https://lore.kernel.org/r/20231215131313.23840-2-paul@crapouillou.net Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma/dma-axi-dmac.c')
-rw-r--r--drivers/dma/dma-axi-dmac.c5
1 files changed, 1 insertions, 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(struct axi_dmac_chan *chan,
segment_size = ((segment_size - 1) | chan->length_align_mask) + 1;
for (i = 0; i < num_periods; i++) {
- len = period_len;
-
- while (len > segment_size) {
+ for (len = period_len; len > segment_size; sg++) {
if (direction == DMA_DEV_TO_MEM)
sg->dest_addr = addr;
else
sg->src_addr = addr;
sg->x_len = segment_size;
sg->y_len = 1;
- sg++;
addr += segment_size;
len -= segment_size;
}