Skip to content

Commit d3ddfab

Browse files
Olivier Dautricourtvinodkoul
authored andcommitted
dmaengine: altera-msgdma: cleanup after completing all descriptors
msgdma_chan_desc_cleanup iterates the done list for each completed descriptor while we need to do it once after all descriptors are completed. This fixes a Sparse warning because we first take the lock in msgdma_tasklet. - Move locking to msgdma_chan_desc_cleanup. - Move call to msgdma_chan_desc_cleanup outside of the critical section of msgdma_tasklet. Inspired by: commit 16ed0ef ("dmaengine: zynqmp_dma: cleanup after completing all descriptors") Signed-off-by: Olivier Dautricourt <[email protected]> Tested-by: Olivier Dautricourt <[email protected]> Suggested-by: Eric Schwarz <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 261d3a8 commit d3ddfab

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/dma/altera-msgdma.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ static void msgdma_chan_desc_cleanup(struct msgdma_device *mdev)
585585
struct msgdma_sw_desc *desc, *next;
586586
unsigned long irqflags;
587587

588+
spin_lock_irqsave(&mdev->lock, irqflags);
589+
588590
list_for_each_entry_safe(desc, next, &mdev->done_list, node) {
589591
struct dmaengine_desc_callback cb;
590592

@@ -600,6 +602,8 @@ static void msgdma_chan_desc_cleanup(struct msgdma_device *mdev)
600602
/* Run any dependencies, then free the descriptor */
601603
msgdma_free_descriptor(mdev, desc);
602604
}
605+
606+
spin_unlock_irqrestore(&mdev->lock, irqflags);
603607
}
604608

605609
/**
@@ -714,10 +718,11 @@ static void msgdma_tasklet(struct tasklet_struct *t)
714718
}
715719

716720
msgdma_complete_descriptor(mdev);
717-
msgdma_chan_desc_cleanup(mdev);
718721
}
719722

720723
spin_unlock_irqrestore(&mdev->lock, flags);
724+
725+
msgdma_chan_desc_cleanup(mdev);
721726
}
722727

723728
/**

0 commit comments

Comments
 (0)