diff mbox

[09/32] dmaengine: jz4740: kill the tasklets upon exit

Message ID 1467730478-9696-10-git-send-email-vinod.koul@intel.com (mailing list archive)
State Accepted
Headers show

Commit Message

Vinod Koul July 5, 2016, 2:54 p.m. UTC
drivers should ensure that tasklets are killed, so that they can't be
executed after driver remove is executed, so ensure they are killed.

This driver used vchan tasklets, so those need to be killed.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/dma/dma-jz4740.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Lars-Peter Clausen July 11, 2016, 8:52 a.m. UTC | #1
On 07/05/2016 04:54 PM, Vinod Koul wrote:
> drivers should ensure that tasklets are killed, so that they can't be
> executed after driver remove is executed, so ensure they are killed.
> 
> This driver used vchan tasklets, so those need to be killed.
> 
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> Cc: Lars-Peter Clausen <lars@metafoo.de>

Acked-by: Lars-Peter Clausen <lars@metafoo.de>

Thanks.

> ---
>  drivers/dma/dma-jz4740.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/dma/dma-jz4740.c b/drivers/dma/dma-jz4740.c
> index 7638b24ce8d0..9689b36c005a 100644
> --- a/drivers/dma/dma-jz4740.c
> +++ b/drivers/dma/dma-jz4740.c
> @@ -573,12 +573,26 @@ err_unregister:
>  	return ret;
>  }
>  
> +static void jz4740_cleanup_vchan(struct dma_device *dmadev)
> +{
> +	struct jz4740_dmaengine_chan *chan, *_chan;
> +
> +	list_for_each_entry_safe(chan, _chan,
> +				&dmadev->channels, vchan.chan.device_node) {
> +		list_del(&chan->vchan.chan.device_node);
> +		tasklet_kill(&chan->vchan.task);
> +	}
> +}
> +
> +
>  static int jz4740_dma_remove(struct platform_device *pdev)
>  {
>  	struct jz4740_dma_dev *dmadev = platform_get_drvdata(pdev);
>  	int irq = platform_get_irq(pdev, 0);
>  
>  	free_irq(irq, dmadev);
> +
> +	jz4740_cleanup_vchan(&dmadev->ddev);

>  	dma_async_device_unregister(&dmadev->ddev);
>  	clk_disable_unprepare(dmadev->clk);
>  
> 

--
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/dma-jz4740.c b/drivers/dma/dma-jz4740.c
index 7638b24ce8d0..9689b36c005a 100644
--- a/drivers/dma/dma-jz4740.c
+++ b/drivers/dma/dma-jz4740.c
@@ -573,12 +573,26 @@  err_unregister:
 	return ret;
 }
 
+static void jz4740_cleanup_vchan(struct dma_device *dmadev)
+{
+	struct jz4740_dmaengine_chan *chan, *_chan;
+
+	list_for_each_entry_safe(chan, _chan,
+				&dmadev->channels, vchan.chan.device_node) {
+		list_del(&chan->vchan.chan.device_node);
+		tasklet_kill(&chan->vchan.task);
+	}
+}
+
+
 static int jz4740_dma_remove(struct platform_device *pdev)
 {
 	struct jz4740_dma_dev *dmadev = platform_get_drvdata(pdev);
 	int irq = platform_get_irq(pdev, 0);
 
 	free_irq(irq, dmadev);
+
+	jz4740_cleanup_vchan(&dmadev->ddev);
 	dma_async_device_unregister(&dmadev->ddev);
 	clk_disable_unprepare(dmadev->clk);