diff mbox series

dmaengine: ti: k3-udma: Fix delayed_work usage for tx drain workaround

Message ID 20200520112233.26807-1-peter.ujfalusi@ti.com (mailing list archive)
State Changes Requested
Headers show
Series dmaengine: ti: k3-udma: Fix delayed_work usage for tx drain workaround | expand

Commit Message

Peter Ujfalusi May 20, 2020, 11:22 a.m. UTC
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(-)

Comments

Vinod Koul June 17, 2020, 1:55 p.m. UTC | #1
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
Peter Ujfalusi June 18, 2020, 11:36 a.m. UTC | #2
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
diff mbox series

Patch

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);