Skip to content

Commit a34da7e

Browse files
larsclausenvinodkoul
authored andcommitted
dmaengine: altera-msgdma: Correctly handle descriptor callbacks
DMA clients can provide one of two types of callbacks. For this reason dmaengine drivers should not directly invoke `callback`, but always use dmaengine_desc_callback_invoke(). This makes sure that both types of callbacks are handled correctly. The altera-msgdma driver currently doesn't do this and only handles the `callback` type callback. If the client used the `callback_result` type callback it will not be called. Fix this by switching to `dmaengine_desc_callback_valid()` and `dmaengine_desc_callback_invoke()`. Signed-off-by: Lars-Peter Clausen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent d191a9a commit a34da7e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/dma/altera-msgdma.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -585,16 +585,14 @@ static void msgdma_chan_desc_cleanup(struct msgdma_device *mdev)
585585
struct msgdma_sw_desc *desc, *next;
586586

587587
list_for_each_entry_safe(desc, next, &mdev->done_list, node) {
588-
dma_async_tx_callback callback;
589-
void *callback_param;
588+
struct dmaengine_desc_callback cb;
590589

591590
list_del(&desc->node);
592591

593-
callback = desc->async_tx.callback;
594-
callback_param = desc->async_tx.callback_param;
595-
if (callback) {
592+
dmaengine_desc_get_callback(&desc->async_tx, &cb);
593+
if (dmaengine_desc_callback_valid(&cb)) {
596594
spin_unlock(&mdev->lock);
597-
callback(callback_param);
595+
dmaengine_desc_callback_invoke(&cb, NULL);
598596
spin_lock(&mdev->lock);
599597
}
600598

0 commit comments

Comments
 (0)