diff mbox

[05/32] dmaengine: edma: kill the tasklets upon exit

Message ID 1467730478-9696-6-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: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/dma/edma.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Peter Ujfalusi July 5, 2016, 7:59 p.m. UTC | #1
On 07/05/2016 05: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.

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> 
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
>  drivers/dma/edma.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
> index dffbd4bb0d8b..3d277fa76c1a 100644
> --- a/drivers/dma/edma.c
> +++ b/drivers/dma/edma.c
> @@ -2393,6 +2393,17 @@ err_reg1:
>  	return ret;
>  }
>  
> +static void edma_cleanupp_vchan(struct dma_device *dmadev)
> +{
> +	struct edma_chan *echan, *_echan;
> +
> +	list_for_each_entry_safe(echan, _echan,
> +			&dmadev->channels, vchan.chan.device_node) {
> +		list_del(&echan->vchan.chan.device_node);
> +		tasklet_kill(&echan->vchan.task);
> +	}
> +}
> +
>  static int edma_remove(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
> @@ -2401,6 +2412,8 @@ static int edma_remove(struct platform_device *pdev)
>  	devm_free_irq(dev, ecc->ccint, ecc);
>  	devm_free_irq(dev, ecc->ccerrint, ecc);
>  
> +	edma_cleanupp_vchan(&ecc->dma_slave);
> +
>  	if (dev->of_node)
>  		of_dma_controller_free(dev->of_node);
>  	dma_async_device_unregister(&ecc->dma_slave);
>
diff mbox

Patch

diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index dffbd4bb0d8b..3d277fa76c1a 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -2393,6 +2393,17 @@  err_reg1:
 	return ret;
 }
 
+static void edma_cleanupp_vchan(struct dma_device *dmadev)
+{
+	struct edma_chan *echan, *_echan;
+
+	list_for_each_entry_safe(echan, _echan,
+			&dmadev->channels, vchan.chan.device_node) {
+		list_del(&echan->vchan.chan.device_node);
+		tasklet_kill(&echan->vchan.task);
+	}
+}
+
 static int edma_remove(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -2401,6 +2412,8 @@  static int edma_remove(struct platform_device *pdev)
 	devm_free_irq(dev, ecc->ccint, ecc);
 	devm_free_irq(dev, ecc->ccerrint, ecc);
 
+	edma_cleanupp_vchan(&ecc->dma_slave);
+
 	if (dev->of_node)
 		of_dma_controller_free(dev->of_node);
 	dma_async_device_unregister(&ecc->dma_slave);