Re: [PATCH] dma: pl330: assign a new cookie when restarting tx descriptors in cyclic mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2012-05-03 at 17:50 -0700, Thomas Abraham wrote:
> The cookie of completed transfer descriptors are marked as zero. In case of
> cyclic transfers, a new cookie needs to be assigned to the transfer descriptors
> which are picked up from the work_list list before they are re-enabled for
> transfer. This prevents hitting BUG_ON in dma_cookie_complete function when
> transfer descriptors are recycled from the work_list list.
> 
> Signed-off-by: Thomas Abraham <thomas.abraham@xxxxxxxxxx>
> ---
>  drivers/dma/pl330.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> index 2ee6e23..7f8f422 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -2265,6 +2265,7 @@ static inline void handle_cyclic_desc_list(struct list_head *list)
>  		dma_async_tx_callback callback;
>  
>  		/* Change status to reload it */
> +		dma_cookie_assign(&desc->txd);
>  		desc->status = PREP;
>  		pch = desc->pchan;
>  		callback = desc->txd.callback;
Nope, this doesn't seem correct to me for two reasons:
1. client doesnt know this new descriptor, so how will it keep track
2. What does marking cyclic descriptor complete mean... Nothing IMO

So it is better *NOT* to mark the descriptor complete.
And below is a better fix this for you, Please test.

----------

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 2ee6e23..fa3fb21 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2322,7 +2322,8 @@ static void pl330_tasklet(unsigned long data)
 	/* Pick up ripe tomatoes */
 	list_for_each_entry_safe(desc, _dt, &pch->work_list, node)
 		if (desc->status == DONE) {
-			dma_cookie_complete(&desc->txd);
+			if (pch->cyclic)
+				dma_cookie_complete(&desc->txd);
 			list_move_tail(&desc->node, &list);
 		}
 

-- 
~Vinod

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux