dmaengine: mmp_pdma: explicitly freeup irq
authorVinod Koul <vinod.koul@intel.com>
Mon, 4 Jul 2016 09:45:26 +0000 (15:15 +0530)
committerVinod Koul <vinod.koul@intel.com>
Sat, 16 Jul 2016 14:49:03 +0000 (20:19 +0530)
dmaengine device should explicitly call devm_free_irq() when using
devm_request_irq().

The irq is still ON when devices remove is executed and irq should be
quiesced before remove is completed.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
drivers/dma/mmp_pdma.c

index 56f1fd68b6205af0de5c6f55687305c42de0f1e9..f4b25fb0d0402668bafad206b4576bcf808005cb 100644 (file)
@@ -931,6 +931,25 @@ static void dma_do_tasklet(unsigned long data)
 static int mmp_pdma_remove(struct platform_device *op)
 {
        struct mmp_pdma_device *pdev = platform_get_drvdata(op);
+       struct mmp_pdma_phy *phy;
+       int i, irq = 0, irq_num = 0;
+
+
+       for (i = 0; i < pdev->dma_channels; i++) {
+               if (platform_get_irq(op, i) > 0)
+                       irq_num++;
+       }
+
+       if (irq_num != pdev->dma_channels) {
+               irq = platform_get_irq(op, 0);
+               devm_free_irq(&op->dev, irq, pdev);
+       } else {
+               for (i = 0; i < pdev->dma_channels; i++) {
+                       phy = &pdev->phy[i];
+                       irq = platform_get_irq(op, i);
+                       devm_free_irq(&op->dev, irq, phy);
+               }
+       }
 
        dma_async_device_unregister(&pdev->device);
        return 0;