dmaengine: jz4780: Kill tasklets before unregistering the device
authorAlex Smith <alex.smith@imgtec.com>
Fri, 24 Jul 2015 16:24:27 +0000 (17:24 +0100)
committerVinod Koul <vinod.koul@intel.com>
Tue, 18 Aug 2015 16:58:50 +0000 (22:28 +0530)
Tasklets may have been scheduled as a result of an earlier interrupt
that could still be running. Kill them before unregistering the
device.

Signed-off-by: Alex Smith <alex.smith@imgtec.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Cc: dmaengine@vger.kernel.org
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/dma-jz4780.c

index d6cae6cb5b7affe50bebc63de0c40aa3251b914f..dade7c47ff18451d23fc416c88768f6e12e457ec 100644 (file)
@@ -866,9 +866,15 @@ err_free_irq:
 static int jz4780_dma_remove(struct platform_device *pdev)
 {
        struct jz4780_dma_dev *jzdma = platform_get_drvdata(pdev);
 static int jz4780_dma_remove(struct platform_device *pdev)
 {
        struct jz4780_dma_dev *jzdma = platform_get_drvdata(pdev);
+       int i;
 
        of_dma_controller_free(pdev->dev.of_node);
 
        of_dma_controller_free(pdev->dev.of_node);
+
        free_irq(jzdma->irq, jzdma);
        free_irq(jzdma->irq, jzdma);
+
+       for (i = 0; i < JZ_DMA_NR_CHANNELS; i++)
+               tasklet_kill(&jzdma->chan[i].vchan.task);
+
        dma_async_device_unregister(&jzdma->dma_device);
        return 0;
 }
        dma_async_device_unregister(&jzdma->dma_device);
        return 0;
 }