dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: ti: k3-udma: Fix delayed_work usage for tx drain workaround
@ 2020-05-20 11:22 Peter Ujfalusi
  2020-06-17 13:55 ` Vinod Koul
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Ujfalusi @ 2020-05-20 11:22 UTC (permalink / raw)
  To: vkoul; +Cc: dmaengine, dan.j.williams, tomi.valkeinen

INIT_DELAYED_WORK_ONSTACK() must be used with on-stack delayed work, which
is not the case here.
Use normal delayed_work for the channels instead.

Fixes: 25dcb5dd7b7c ("dmaengine: ti: New driver for K3 UDMA")
Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/dma/ti/k3-udma.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index c91e2dc1bb72..87554e093a3b 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -1906,8 +1906,6 @@ static int udma_alloc_chan_resources(struct dma_chan *chan)
 
 	udma_reset_rings(uc);
 
-	INIT_DELAYED_WORK_ONSTACK(&uc->tx_drain.work,
-				  udma_check_tx_completion);
 	return 0;
 
 err_irq_free:
@@ -3019,7 +3017,6 @@ static void udma_free_chan_resources(struct dma_chan *chan)
 	}
 
 	cancel_delayed_work_sync(&uc->tx_drain.work);
-	destroy_delayed_work_on_stack(&uc->tx_drain.work);
 
 	if (uc->irq_num_ring > 0) {
 		free_irq(uc->irq_num_ring, uc);
@@ -3711,6 +3708,7 @@ static int udma_probe(struct platform_device *pdev)
 		tasklet_init(&uc->vc.task, udma_vchan_complete,
 			     (unsigned long)&uc->vc);
 		init_completion(&uc->teardown_completed);
+		INIT_DELAYED_WORK(&uc->tx_drain.work, udma_check_tx_completion);
 	}
 
 	ret = dma_async_device_register(&ud->ddev);
-- 
Peter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: ti: k3-udma: Fix delayed_work usage for tx drain workaround
  2020-05-20 11:22 [PATCH] dmaengine: ti: k3-udma: Fix delayed_work usage for tx drain workaround Peter Ujfalusi
@ 2020-06-17 13:55 ` Vinod Koul
  2020-06-18 11:36   ` Peter Ujfalusi
  0 siblings, 1 reply; 3+ messages in thread
From: Vinod Koul @ 2020-06-17 13:55 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: dmaengine, dan.j.williams, tomi.valkeinen

On 20-05-20, 14:22, Peter Ujfalusi wrote:
> INIT_DELAYED_WORK_ONSTACK() must be used with on-stack delayed work, which
> is not the case here.
> Use normal delayed_work for the channels instead.
> 
> Fixes: 25dcb5dd7b7c ("dmaengine: ti: New driver for K3 UDMA")

Is this a fix or an optimization?

> Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

No sob!

> ---
>  drivers/dma/ti/k3-udma.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
> index c91e2dc1bb72..87554e093a3b 100644
> --- a/drivers/dma/ti/k3-udma.c
> +++ b/drivers/dma/ti/k3-udma.c
> @@ -1906,8 +1906,6 @@ static int udma_alloc_chan_resources(struct dma_chan *chan)
>  
>  	udma_reset_rings(uc);
>  
> -	INIT_DELAYED_WORK_ONSTACK(&uc->tx_drain.work,
> -				  udma_check_tx_completion);
>  	return 0;
>  
>  err_irq_free:
> @@ -3019,7 +3017,6 @@ static void udma_free_chan_resources(struct dma_chan *chan)
>  	}
>  
>  	cancel_delayed_work_sync(&uc->tx_drain.work);
> -	destroy_delayed_work_on_stack(&uc->tx_drain.work);
>  
>  	if (uc->irq_num_ring > 0) {
>  		free_irq(uc->irq_num_ring, uc);
> @@ -3711,6 +3708,7 @@ static int udma_probe(struct platform_device *pdev)
>  		tasklet_init(&uc->vc.task, udma_vchan_complete,
>  			     (unsigned long)&uc->vc);
>  		init_completion(&uc->teardown_completed);
> +		INIT_DELAYED_WORK(&uc->tx_drain.work, udma_check_tx_completion);
>  	}
>  
>  	ret = dma_async_device_register(&ud->ddev);
> -- 
> Peter
> 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

-- 
~Vinod

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: ti: k3-udma: Fix delayed_work usage for tx drain workaround
  2020-06-17 13:55 ` Vinod Koul
@ 2020-06-18 11:36   ` Peter Ujfalusi
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Ujfalusi @ 2020-06-18 11:36 UTC (permalink / raw)
  To: Vinod Koul; +Cc: dmaengine, dan.j.williams, tomi.valkeinen



On 17/06/2020 16.55, Vinod Koul wrote:
> On 20-05-20, 14:22, Peter Ujfalusi wrote:
>> INIT_DELAYED_WORK_ONSTACK() must be used with on-stack delayed work, which
>> is not the case here.
>> Use normal delayed_work for the channels instead.
>>
>> Fixes: 25dcb5dd7b7c ("dmaengine: ti: New driver for K3 UDMA")
> 
> Is this a fix or an optimization?

It is a fix.

>> Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> 
> No sob!

Oops. I'll resend in a second

> 
>> ---
>>  drivers/dma/ti/k3-udma.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
>> index c91e2dc1bb72..87554e093a3b 100644
>> --- a/drivers/dma/ti/k3-udma.c
>> +++ b/drivers/dma/ti/k3-udma.c
>> @@ -1906,8 +1906,6 @@ static int udma_alloc_chan_resources(struct dma_chan *chan)
>>  
>>  	udma_reset_rings(uc);
>>  
>> -	INIT_DELAYED_WORK_ONSTACK(&uc->tx_drain.work,
>> -				  udma_check_tx_completion);
>>  	return 0;
>>  
>>  err_irq_free:
>> @@ -3019,7 +3017,6 @@ static void udma_free_chan_resources(struct dma_chan *chan)
>>  	}
>>  
>>  	cancel_delayed_work_sync(&uc->tx_drain.work);
>> -	destroy_delayed_work_on_stack(&uc->tx_drain.work);
>>  
>>  	if (uc->irq_num_ring > 0) {
>>  		free_irq(uc->irq_num_ring, uc);
>> @@ -3711,6 +3708,7 @@ static int udma_probe(struct platform_device *pdev)
>>  		tasklet_init(&uc->vc.task, udma_vchan_complete,
>>  			     (unsigned long)&uc->vc);
>>  		init_completion(&uc->teardown_completed);
>> +		INIT_DELAYED_WORK(&uc->tx_drain.work, udma_check_tx_completion);
>>  	}
>>  
>>  	ret = dma_async_device_register(&ud->ddev);
>> -- 
>> Peter
>>
>> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
>> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-18 11:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 11:22 [PATCH] dmaengine: ti: k3-udma: Fix delayed_work usage for tx drain workaround Peter Ujfalusi
2020-06-17 13:55 ` Vinod Koul
2020-06-18 11:36   ` Peter Ujfalusi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).