From: Frank Li <Frank.li@nxp.com>
To: "Nuno Sá" <nuno.sa@analog.com>
Cc: dmaengine@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>,
Vinod Koul <vkoul@kernel.org>
Subject: Re: [PATCH 3/5] dma: dma-axi-dmac: add helper for getting next desc
Date: Wed, 25 Feb 2026 11:54:20 -0500 [thread overview]
Message-ID: <aZ8pPDsJKC0YeSlx@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260127-axi-dac-cyclic-support-v1-3-b32daca4b3c7@analog.com>
On Tue, Jan 27, 2026 at 02:28:24PM +0000, Nuno Sá wrote:
> Add a new helper for getting the next valid struct axi_dmac_desc. This
> will be extended in follow up patches to support to gracefully terminate
> cyclic transfers.
>
> Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> ---
> drivers/dma/dma-axi-dmac.c | 33 +++++++++++++++++++++++----------
> 1 file changed, 23 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c
> index b083b6176593..3984236717a6 100644
> --- a/drivers/dma/dma-axi-dmac.c
> +++ b/drivers/dma/dma-axi-dmac.c
> @@ -227,10 +227,29 @@ static bool axi_dmac_check_addr(struct axi_dmac_chan *chan, dma_addr_t addr)
> return true;
> }
>
> +static struct axi_dmac_desc *axi_dmac_get_next_desc(struct axi_dmac *dmac,
> + struct axi_dmac_chan *chan)
Nit: if need respin,
static struct axi_dmac_desc *
axi_dmac_get_next_desc(struct axi_dmac *dmac, struct axi_dmac_chan *chan)
This is also fine.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> +{
> + struct virt_dma_desc *vdesc;
> + struct axi_dmac_desc *desc;
> +
> + if (chan->next_desc)
> + return chan->next_desc;
> +
> + vdesc = vchan_next_desc(&chan->vchan);
> + if (!vdesc)
> + return NULL;
> +
> + list_move_tail(&vdesc->node, &chan->active_descs);
> + desc = to_axi_dmac_desc(vdesc);
> + chan->next_desc = desc;
> +
> + return desc;
> +}
> +
> static void axi_dmac_start_transfer(struct axi_dmac_chan *chan)
> {
> struct axi_dmac *dmac = chan_to_axi_dmac(chan);
> - struct virt_dma_desc *vdesc;
> struct axi_dmac_desc *desc;
> struct axi_dmac_sg *sg;
> unsigned int flags = 0;
> @@ -240,16 +259,10 @@ static void axi_dmac_start_transfer(struct axi_dmac_chan *chan)
> if (val) /* Queue is full, wait for the next SOT IRQ */
> return;
>
> - desc = chan->next_desc;
> + desc = axi_dmac_get_next_desc(dmac, chan);
> + if (!desc)
> + return;
>
> - if (!desc) {
> - vdesc = vchan_next_desc(&chan->vchan);
> - if (!vdesc)
> - return;
> - list_move_tail(&vdesc->node, &chan->active_descs);
> - desc = to_axi_dmac_desc(vdesc);
> - chan->next_desc = desc;
> - }
> sg = &desc->sg[desc->num_submitted];
>
> /* Already queued in cyclic mode. Wait for it to finish */
>
> --
> 2.52.0
>
next prev parent reply other threads:[~2026-02-25 16:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 14:28 [PATCH 0/5] dma: dma-axi-dmac: Add cyclic transfer support and graceful termination Nuno Sá via B4 Relay
2026-01-27 14:28 ` [PATCH 1/5] dmaengine: Document cyclic transfer for dmaengine_prep_peripheral_dma_vec() Nuno Sá via B4 Relay
2026-02-25 16:50 ` Frank Li
2026-01-27 14:28 ` [PATCH 2/5] dma: dma-axi-dmac: add cyclic transfers in .device_prep_peripheral_dma_vec() Nuno Sá via B4 Relay
2026-02-25 16:51 ` Frank Li
2026-01-27 14:28 ` [PATCH 3/5] dma: dma-axi-dmac: add helper for getting next desc Nuno Sá via B4 Relay
2026-02-25 16:54 ` Frank Li [this message]
2026-01-27 14:28 ` [PATCH 4/5] dma: dma-axi-dmac: Gracefully terminate SW cyclic transfers Nuno Sá via B4 Relay
2026-02-25 16:57 ` Frank Li
2026-02-26 9:35 ` Nuno Sá
2026-01-27 14:28 ` [PATCH 5/5] dma: dma-axi-dmac: gracefully terminate HW " Nuno Sá via B4 Relay
2026-02-27 2:17 ` [PATCH 0/5] dma: dma-axi-dmac: Add cyclic transfer support and graceful termination Vinod Koul
2026-02-27 12:41 ` Nuno Sá
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=aZ8pPDsJKC0YeSlx@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=dmaengine@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=nuno.sa@analog.com \
--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