On Mon, Mar 16, 2026 at 03:32:50PM +0200, Claudiu Beznea wrote:
> From: John Madieu <john.madieu.xa@bp.renesas.com>
>
> 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>
>
> Changes in v10:
> - none, this patch is new and replaces the patch 6/8
> ("dmaengine: sh: rz-dmac: Add rz_dmac_invalidate_lmdesc()") from v9
>
> drivers/dma/sh/rz-dmac.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
> index eca62d9e9772..6bfa77844e02 100644
> --- a/drivers/dma/sh/rz-dmac.c
> +++ b/drivers/dma/sh/rz-dmac.c
> @@ -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);
> --
> 2.43.0
>