]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dmaengine: sh: rz-dmac: Use rz_lmdesc_setup() to invalidate descriptors
authorJohn Madieu <john.madieu.xa@bp.renesas.com>
Mon, 16 Mar 2026 13:32:50 +0000 (15:32 +0200)
committerVinod Koul <vkoul@kernel.org>
Tue, 17 Mar 2026 10:42:11 +0000 (16:12 +0530)
rz_lmdesc_setup() invalidates DMA descriptors more comprehensively.
It resets the base, head, and tail pointers of the descriptor list and
clears the descriptor headers and their NXLA pointers. Use
rz_lmdesc_setup() instead of open-coding parts of its logic.

Signed-off-by: John Madieu <john.madieu.xa@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260316133252.240348-7-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/sh/rz-dmac.c

index eca62d9e9772a20b289580b70867e20e7394b6d9..6bfa77844e02a3b257544a7c2a4de3d9f32b0da5 100644 (file)
@@ -460,15 +460,12 @@ static void rz_dmac_free_chan_resources(struct dma_chan *chan)
 {
        struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
        struct rz_dmac *dmac = to_rz_dmac(chan->device);
-       struct rz_lmdesc *lmdesc = channel->lmdesc.base;
        struct rz_dmac_desc *desc, *_desc;
        unsigned long flags;
-       unsigned int i;
 
        spin_lock_irqsave(&channel->vc.lock, flags);
 
-       for (i = 0; i < DMAC_NR_LMDESC; i++)
-               lmdesc[i].header = 0;
+       rz_lmdesc_setup(channel, channel->lmdesc.base);
 
        rz_dmac_disable_hw(channel);
        list_splice_tail_init(&channel->ld_active, &channel->ld_free);
@@ -560,15 +557,12 @@ rz_dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
 static int rz_dmac_terminate_all(struct dma_chan *chan)
 {
        struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
-       struct rz_lmdesc *lmdesc = channel->lmdesc.base;
        unsigned long flags;
-       unsigned int i;
        LIST_HEAD(head);
 
        spin_lock_irqsave(&channel->vc.lock, flags);
        rz_dmac_disable_hw(channel);
-       for (i = 0; i < DMAC_NR_LMDESC; i++)
-               lmdesc[i].header = 0;
+       rz_lmdesc_setup(channel, channel->lmdesc.base);
 
        list_splice_tail_init(&channel->ld_active, &channel->ld_free);
        list_splice_tail_init(&channel->ld_queue, &channel->ld_free);