[PATCH 24/32] dmaengine: pxa_dm: explicitly freeup irq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dmaengine device should explicitly call devm_free_irq() when using
devm_reqister_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@xxxxxxxxx>
Cc: Robert Jarzmik <robert.jarzmik@xxxxxxx>
---
 drivers/dma/pxa_dma.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c
index e756a30ccba2..1a1c515e8120 100644
--- a/drivers/dma/pxa_dma.c
+++ b/drivers/dma/pxa_dma.c
@@ -1279,11 +1279,33 @@ static void pxad_free_channels(struct dma_device *dmadev)
 	}
 }
 
+static void pxad_free_irq(struct platform_device *op, struct pxad_device *pdev)
+{
+	struct pxad_phy *phy;
+	int nr_irq = 0, irq, irq0, i;
+
+	irq0 = platform_get_irq(op, 0);
+	for (i = 0; i < pdev->nr_chans; i++)
+		if (platform_get_irq(op, i) > 0)
+			nr_irq++;
+
+	for (i = 0; i < pdev->nr_chans; i++) {
+		phy = &pdev->phys[i];
+		irq = platform_get_irq(op, i);
+		if ((nr_irq > 1) && (irq > 0))
+			devm_free_irq(&op->dev, irq, phy);
+
+		if ((nr_irq == 1) && (i == 0))
+			devm_free_irq(&op->dev, irq0, pdev);
+	}
+}
+
 static int pxad_remove(struct platform_device *op)
 {
 	struct pxad_device *pdev = platform_get_drvdata(op);
 
 	pxad_cleanup_debugfs(pdev);
+	pxad_free_irq(op, pdev);
 	pxad_free_channels(&pdev->slave);
 	dma_async_device_unregister(&pdev->slave);
 	return 0;
-- 
1.9.1

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



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux