Re: [PATCH v2 09/15] dmaengine: dw-axi-dmac: Support burst residue granularity

From: Vinod Koul
Date: Mon Nov 09 2020 - 04:51:22 EST


On 27-10-20, 14:38, Sia Jee Heng wrote:
> Add support for DMA_RESIDUE_GRANULARITY_BURST so that AxiDMA can report
> DMA residue.
>
> Existing AxiDMA driver only support data transfer between
> memory to memory operation, therefore reporting DMA residue
> to the DMA clients is not supported.
>
> Reporting DMA residue to the DMA clients is important as DMA clients
> shall invoke dmaengine_tx_status() to understand the number of bytes
> been transferred so that the buffer pointer can be updated accordingly.
>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> Signed-off-by: Sia Jee Heng <jee.heng.sia@xxxxxxxxx>
> ---
> .../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 44 ++++++++++++++++---
> drivers/dma/dw-axi-dmac/dw-axi-dmac.h | 2 +
> 2 files changed, 39 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> index 011cf7134f25..cd99557a716c 100644
> --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> @@ -265,14 +265,36 @@ dma_chan_tx_status(struct dma_chan *dchan, dma_cookie_t cookie,
> struct dma_tx_state *txstate)
> {
> struct axi_dma_chan *chan = dchan_to_axi_dma_chan(dchan);
> - enum dma_status ret;
> + struct virt_dma_desc *vdesc;
> + enum dma_status status;
> + u32 completed_length;
> + unsigned long flags;
> + u32 completed_blocks;
> + size_t bytes = 0;
> + u32 length;
> + u32 len;
>
> - ret = dma_cookie_status(dchan, cookie, txstate);
> + status = dma_cookie_status(dchan, cookie, txstate);

txstate can be null, so please check that as well in the below condition
and return if that is the case

--
~Vinod