linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: host: xhci-mtk: avoid runtime suspend when removing hcd
@ 2020-05-29  4:29 Macpaul Lin
  2020-05-29  4:32 ` [PATCH v2] " Macpaul Lin
  2020-06-03 11:47 ` [PATCH] " Mathias Nyman
  0 siblings, 2 replies; 9+ messages in thread
From: Macpaul Lin @ 2020-05-29  4:29 UTC (permalink / raw)
  To: Chunfeng Yun, Mathias Nyman, Greg Kroah-Hartman, Matthias Brugger
  Cc: Mediatek WSD Upstream, Macpaul Lin, Macpaul Lin, linux-kernel,
	linux-arm-kernel, linux-usb, linux-mediatek

When runtime suspend was enabled, runtime suspend might happened
when xhci is removing hcd. This might cause kernel panic when hcd
has been freed but runtime pm suspend related handle need to
reference it.

Change-Id: I70a5dc8006207caeecbac6955ce8e5345dcc70e6
Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
---
 drivers/usb/host/xhci-mtk.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index bfbdb3c..641d24e 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -587,6 +587,9 @@ static int xhci_mtk_remove(struct platform_device *dev)
 	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
 	struct usb_hcd  *shared_hcd = xhci->shared_hcd;
 
+	pm_runtime_put_sync(&dev->dev);
+	pm_runtime_disable(&dev->dev);
+
 	usb_remove_hcd(shared_hcd);
 	xhci->shared_hcd = NULL;
 	device_init_wakeup(&dev->dev, false);
@@ -597,8 +600,6 @@ static int xhci_mtk_remove(struct platform_device *dev)
 	xhci_mtk_sch_exit(mtk);
 	xhci_mtk_clks_disable(mtk);
 	xhci_mtk_ldos_disable(mtk);
-	pm_runtime_put_sync(&dev->dev);
-	pm_runtime_disable(&dev->dev);
 
 	return 0;
 }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-06-04  9:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29  4:29 [PATCH] usb: host: xhci-mtk: avoid runtime suspend when removing hcd Macpaul Lin
2020-05-29  4:32 ` [PATCH v2] " Macpaul Lin
2020-06-03  8:43   ` Chunfeng Yun
2020-06-03 11:47 ` [PATCH] " Mathias Nyman
2020-06-03 13:01   ` Macpaul Lin
2020-06-03 13:09   ` [PATCH v3] " Macpaul Lin
2020-06-03 17:33     ` Sergei Shtylyov
2020-06-04  3:01     ` [PATCH v4] " Macpaul Lin
2020-06-04  9:14       ` Mathias Nyman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).