Skip to contentSkip to conversation

iommu/rockchip: Free irqs in shutdown handler

PATCH New Heiko Stuebner 4 participants 5 messages Aug 27, 2018 – Sep 25, 2018

Subsystems (2)
lore
Share & tools
lore

Heiko Stuebner

author maintainer
#0 lore raw

PATCH 1/1 iommu/rockchip: Free irqs in shutdown handler

In the iommu's shutdown handler we disable runtime-pm which could result in the irq-handler running unclocked and since commit
3fc7c5c0cff3 ("iommu/rockchip: Handle errors returned from PM framework")
we warn about that fact.

This can cause warnings on shutdown on some Rockchip machines, so free the irqs in the shutdown handler before we disable runtime-pm.

Fixes 3fc7c5c0cff3 ("iommu/rockchip: Handle errors returned from PM framework")
---
 drivers/iommu/rockchip-iommu.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/iommu/rockchip-iommu.c +6 -0
index 258115b10fa9..ad3e2b97469e 100644
@@ -1241,6 +1241,12 @@ static int rk_iommu_probe(struct platform_device *pdev)
 
 static void rk_iommu_shutdown(struct platform_device *pdev)
 {
+	struct rk_iommu *iommu = platform_get_drvdata(pdev);
+	int i = 0, irq;
+
+	while ((irq = platform_get_irq(pdev, i++)) != -ENXIO)
+		devm_free_irq(iommu->dev, irq, iommu);
+
 	pm_runtime_force_suspend(&pdev->dev);
 }
 
Signature · 1 line
2.17.0
#1 lore raw

PATCH 1/1 iommu/rockchip: Free irqs in shutdown handler

Heiko,

Thanks for the patch
Missatge de Heiko Stuebner <[email protected]> del dia dl., 27 d?ag. 2018 a les 12:57:

Quoted 34 lines

In the iommu's shutdown handler we disable runtime-pm which could result in the irq-handler running unclocked and since commit
3fc7c5c0cff3 ("iommu/rockchip: Handle errors returned from PM framework")
we warn about that fact.

This can cause warnings on shutdown on some Rockchip machines, so free the irqs in the shutdown handler before we disable runtime-pm.

Fixes 3fc7c5c0cff3 ("iommu/rockchip: Handle errors returned from PM framework")
---
 drivers/iommu/rockchip-iommu.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/iommu/rockchip-iommu.c +6 -1
index 258115b10fa9..ad3e2b97469e 100644
@@ -1241,6 +1241,12 @@ static int rk_iommu_probe(struct platform_device *pdev)
 
 static void rk_iommu_shutdown(struct platform_device *pdev)
 {
+       struct rk_iommu *iommu = platform_get_drvdata(pdev);
+       int i = 0, irq;
+
+       while ((irq = platform_get_irq(pdev, i++)) != -ENXIO)
+               devm_free_irq(iommu->dev, irq, iommu);
+
        pm_runtime_force_suspend(&pdev->dev);
 }
 
--
Quoted 2 lines

2.17.0

After this patch the WARNING is gone on my Samsung Chromebook Plus.

Quoted 5 lines

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#2 lore raw

PATCH 1/1 iommu/rockchip: Free irqs in shutdown handler

In reply to Heiko Stuebner

Hi Heiko,

Quoted 23 lines · Heiko Stuebner

In the iommu's shutdown handler we disable runtime-pm which could result in the irq-handler running unclocked and since commit
3fc7c5c0cff3 ("iommu/rockchip: Handle errors returned from PM framework")
we warn about that fact.

This can cause warnings on shutdown on some Rockchip machines, so free the irqs in the shutdown handler before we disable runtime-pm.

Fixes 3fc7c5c0cff3 ("iommu/rockchip: Handle errors returned from PM framework")
---
 drivers/iommu/rockchip-iommu.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/iommu/rockchip-iommu.c +0 -0
index 258115b10fa9..ad3e2b97469e 100644
@@ -1241,6 +1241,12 @@ static int rk_iommu_probe(struct platform_device *pdev)
 
 static void rk_iommu_shutdown(struct platform_device *pdev)

drivers/iommu/rockchip-iommu.c static int rk_iommu_probe(struct platform_device *pdev) · line 1252

Quoted 10 lines
drivers/iommu/rockchip-iommu.c +6 -0
 {
+	struct rk_iommu *iommu = platform_get_drvdata(pdev);
+	int i = 0, irq;
+
+	while ((irq = platform_get_irq(pdev, i++)) != -ENXIO)
+		devm_free_irq(iommu->dev, irq, iommu);
+
 	pm_runtime_force_suspend(&pdev->dev);
 }
 

Looks OK to me. I don't think there is a point in using devm_irq* anymore in this driver, but that's a separate issue.

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#3 lore raw

PATCH 1/1 iommu/rockchip: Free irqs in shutdown handler

In reply to Heiko Stuebner
Quoted 36 lines · Heiko Stuebner

In the iommu's shutdown handler we disable runtime-pm which could result in the irq-handler running unclocked and since commit
3fc7c5c0cff3 ("iommu/rockchip: Handle errors returned from PM framework")
we warn about that fact.

This can cause warnings on shutdown on some Rockchip machines, so free the irqs in the shutdown handler before we disable runtime-pm.

Fixes 3fc7c5c0cff3 ("iommu/rockchip: Handle errors returned from PM framework")
---
 drivers/iommu/rockchip-iommu.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/iommu/rockchip-iommu.c +6 -0
index 258115b10fa9..ad3e2b97469e 100644
@@ -1241,6 +1241,12 @@ static int rk_iommu_probe(struct platform_device *pdev)
 
 static void rk_iommu_shutdown(struct platform_device *pdev)
 {
+	struct rk_iommu *iommu = platform_get_drvdata(pdev);
+	int i = 0, irq;
+
+	while ((irq = platform_get_irq(pdev, i++)) != -ENXIO)
+		devm_free_irq(iommu->dev, irq, iommu);
+
 	pm_runtime_force_suspend(&pdev->dev);
 }
 
Signature · 1 line
2.17.0
	M.
Signature · 1 line
Jazz is not dead, it just smell funny.
maintainer
#4 lore raw

PATCH 1/1 iommu/rockchip: Free irqs in shutdown handler

In reply to Heiko Stuebner
Quoted 8 lines · Heiko Stuebner

In the iommu's shutdown handler we disable runtime-pm which could result in the irq-handler running unclocked and since commit
3fc7c5c0cff3 ("iommu/rockchip: Handle errors returned from PM framework")
we warn about that fact.

This can cause warnings on shutdown on some Rockchip machines, so free the irqs in the shutdown handler before we disable runtime-pm.

Quoted 6 lines
Fixes 3fc7c5c0cff3 ("iommu/rockchip: Handle errors returned from PM framework")
---
 drivers/iommu/rockchip-iommu.c | 6 ++++++
 1 file changed, 6 insertions(+)

Applied for v4.19, thanks Heiko.