The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Anton D. Stavinskii" <stavinsky@gmail.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	inochiama@gmail.com, "Anton D. Stavinskii" <stavinsky@gmail.com>
Subject: [PATCH] dmaengine: cv1800b-dmamux: fix channel allocation order
Date: Wed, 10 Dec 2025 23:30:12 +0400	[thread overview]
Message-ID: <20251210193011.567210-2-stavinsky@gmail.com> (raw)

The dmamux builds the free_maps list using llist_add(), which inserts
new nodes at the head. Using increasing channel indices causes the
first allocation to use DMA channel 7 while the DMA engine hands out
channel 0, leading to mismatched routing.

Reverse the channel index order so the first allocation gets channel 0.

Fixes: db7d07b5add4d ("dmaengine: add driver for Sophgo CV18XX/SG200X dmamux")
Signed-off-by: Anton D. Stavinskii <stavinsky@gmail.com>
---
 drivers/dma/cv1800b-dmamux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/cv1800b-dmamux.c b/drivers/dma/cv1800b-dmamux.c
index e900d6595617..825e1614051d 100644
--- a/drivers/dma/cv1800b-dmamux.c
+++ b/drivers/dma/cv1800b-dmamux.c
@@ -214,7 +214,7 @@ static int cv1800_dmamux_probe(struct platform_device *pdev)
 		}
 
 		init_llist_node(&tmp->node);
-		tmp->channel = i;
+		tmp->channel = MAX_DMA_CH_ID - i;
 		llist_add(&tmp->node, &data->free_maps);
 	}
 
-- 
2.43.0


             reply	other threads:[~2025-12-10 19:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10 19:30 Anton D. Stavinskii [this message]
2025-12-12  2:12 ` [PATCH] dmaengine: cv1800b-dmamux: fix channel allocation order Inochi Amaoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251210193011.567210-2-stavinsky@gmail.com \
    --to=stavinsky@gmail.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=inochiama@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox