diff mbox

[v2,1/2] dmaengine: at_hdmac: use tasklet_kill in teardown

Message ID 1394447948-14778-2-git-send-email-vinod.koul@intel.com (mailing list archive)
State Accepted
Delegated to: Vinod Koul
Headers show

Commit Message

Vinod Koul March 10, 2014, 10:39 a.m. UTC
As discussed in [1] the tasklet_disable is not a proper function for teardown.
The driver also uses correct method of tasklet_kill. So remove tasklet_disable

[1]: http://lwn.net/Articles/588457/

Reported-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 drivers/dma/at_hdmac.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

Comments

Nicolas Ferre March 10, 2014, 11:07 a.m. UTC | #1
On 10/03/2014 11:39, Vinod Koul :
> As discussed in [1] the tasklet_disable is not a proper function for teardown.
> The driver also uses correct method of tasklet_kill. So remove tasklet_disable
> 
> [1]: http://lwn.net/Articles/588457/
> 
> Reported-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Thanks.

> ---
>  drivers/dma/at_hdmac.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index e2c04dc..c13a3bb 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1569,7 +1569,6 @@ static int at_dma_remove(struct platform_device *pdev)
>  
>  		/* Disable interrupts */
>  		atc_disable_chan_irq(atdma, chan->chan_id);
> -		tasklet_disable(&atchan->tasklet);
>  
>  		tasklet_kill(&atchan->tasklet);
>  		list_del(&chan->device_node);
>
Thomas Gleixner March 10, 2014, 7:13 p.m. UTC | #2
On Mon, 10 Mar 2014, Vinod Koul wrote:

> As discussed in [1] the tasklet_disable is not a proper function for teardown.
> The driver also uses correct method of tasklet_kill. So remove tasklet_disable
> 
> [1]: http://lwn.net/Articles/588457/

Please add an explanation why that driver is otherwise safe.

> Reported-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> ---
>  drivers/dma/at_hdmac.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index e2c04dc..c13a3bb 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -1569,7 +1569,6 @@ static int at_dma_remove(struct platform_device *pdev)
>  
>  		/* Disable interrupts */
>  		atc_disable_chan_irq(atdma, chan->chan_id);
> -		tasklet_disable(&atchan->tasklet);
>  
>  		tasklet_kill(&atchan->tasklet);
>  		list_del(&chan->device_node);
> -- 
> 1.7.0.4
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vinod Koul March 11, 2014, 8:44 a.m. UTC | #3
On Mon, Mar 10, 2014 at 08:13:57PM +0100, Thomas Gleixner wrote:
> 
> On Mon, 10 Mar 2014, Vinod Koul wrote:
> 
> > As discussed in [1] the tasklet_disable is not a proper function for teardown.
> > The driver also uses correct method of tasklet_kill. So remove tasklet_disable
> > 
> > [1]: http://lwn.net/Articles/588457/
> 
> Please add an explanation why that driver is otherwise safe.
sure...


Adding below as changelog to this, pls let me know if you are okay with this

----

As discussed in [1] the tasklet_disable is not a proper function for teardown.
We need to ensure irq is disabled, followed by ensuring that don't schedule any
more tasklets and then its safe to use tasklet_kill().

Here in at_hdmac driver we use free_irq() before tasklet_kill(). The free_irq()
will ensure that the irq is disabled and also wait till all scheduled interrupts
are executed by invoking synchronize_irq(). So we need to only do tasklet_kill()
after invoking free_irq()

[1]: http://lwn.net/Articles/588457/
Thomas Gleixner March 11, 2014, 1:12 p.m. UTC | #4
On Tue, 11 Mar 2014, Vinod Koul wrote:

> On Mon, Mar 10, 2014 at 08:13:57PM +0100, Thomas Gleixner wrote:
> > 
> > On Mon, 10 Mar 2014, Vinod Koul wrote:
> > 
> > > As discussed in [1] the tasklet_disable is not a proper function for teardown.
> > > The driver also uses correct method of tasklet_kill. So remove tasklet_disable
> > > 
> > > [1]: http://lwn.net/Articles/588457/
> > 
> > Please add an explanation why that driver is otherwise safe.
> sure...
> 
> 
> Adding below as changelog to this, pls let me know if you are okay with this
> 
> ----
> 
> As discussed in [1] the tasklet_disable is not a proper function for teardown.
> We need to ensure irq is disabled, followed by ensuring that don't schedule any
> more tasklets and then its safe to use tasklet_kill().
> 
> Here in at_hdmac driver we use free_irq() before tasklet_kill(). The free_irq()
> will ensure that the irq is disabled and also wait till all scheduled interrupts
> are executed by invoking synchronize_irq(). So we need to only do tasklet_kill()
> after invoking free_irq()
> 
> [1]: http://lwn.net/Articles/588457/

 Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

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

Patch

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index e2c04dc..c13a3bb 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1569,7 +1569,6 @@  static int at_dma_remove(struct platform_device *pdev)
 
 		/* Disable interrupts */
 		atc_disable_chan_irq(atdma, chan->chan_id);
-		tasklet_disable(&atchan->tasklet);
 
 		tasklet_kill(&atchan->tasklet);
 		list_del(&chan->device_node);