Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: dw-edma: Set status for callback_result

DMA Engine has support for the callback_result which provides
the status of the request and the residue. This helps in
determining the correct status of the request and in
efficient resource management of the request.
The 'callback_result' method is preferred over the deprecated
'callback' method.

Signed-off-by: Devendra K Verma <devverma@amd.com>
Link: https://lore.kernel.org/r/20250821121505.318179-1-devverma@amd.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Devendra K Verma and committed by
Vinod Koul
5e742de9 a33e3b66

+22
+22
drivers/dma/dw-edma/dw-edma-core.c
··· 584 584 return dw_edma_device_transfer(&xfer); 585 585 } 586 586 587 + static void dw_hdma_set_callback_result(struct virt_dma_desc *vd, 588 + enum dmaengine_tx_result result) 589 + { 590 + u32 residue = 0; 591 + struct dw_edma_desc *desc; 592 + struct dmaengine_result *res; 593 + 594 + if (!vd->tx.callback_result) 595 + return; 596 + 597 + desc = vd2dw_edma_desc(vd); 598 + if (desc) 599 + residue = desc->alloc_sz - desc->xfer_sz; 600 + 601 + res = &vd->tx_result; 602 + res->result = result; 603 + res->residue = residue; 604 + } 605 + 587 606 static void dw_edma_done_interrupt(struct dw_edma_chan *chan) 588 607 { 589 608 struct dw_edma_desc *desc; ··· 616 597 case EDMA_REQ_NONE: 617 598 desc = vd2dw_edma_desc(vd); 618 599 if (!desc->chunks_alloc) { 600 + dw_hdma_set_callback_result(vd, 601 + DMA_TRANS_NOERROR); 619 602 list_del(&vd->node); 620 603 vchan_cookie_complete(vd); 621 604 } ··· 654 633 spin_lock_irqsave(&chan->vc.lock, flags); 655 634 vd = vchan_next_desc(&chan->vc); 656 635 if (vd) { 636 + dw_hdma_set_callback_result(vd, DMA_TRANS_ABORTED); 657 637 list_del(&vd->node); 658 638 vchan_cookie_complete(vd); 659 639 }