linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [next PATCH] usb: xhci-mtk: remove bus status check
@ 2021-04-16  6:48 Chunfeng Yun
  0 siblings, 0 replies; only message in thread
From: Chunfeng Yun @ 2021-04-16  6:48 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, linux-kernel, Ikjoon Jang, Nicolas Boichat,
	Eddie Hung

PM will take care of the status of child device, so no need
check each port anymore.

Suggested-by: Ikjoon Jang <ikjn@chromium.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/host/xhci-mtk.c | 43 ++-----------------------------------
 1 file changed, 2 insertions(+), 41 deletions(-)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index d4c455eecb8d..1fdeb315a124 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -654,42 +654,6 @@ static int __maybe_unused xhci_mtk_resume(struct device *dev)
 	return ret;
 }
 
-static int check_rhub_status(struct xhci_hcd *xhci, struct xhci_hub *rhub)
-{
-	u32 suspended_ports;
-	u32 status;
-	int num_ports;
-	int i;
-
-	num_ports = rhub->num_ports;
-	suspended_ports = rhub->bus_state.suspended_ports;
-	for (i = 0; i < num_ports; i++) {
-		if (!(suspended_ports & BIT(i))) {
-			status = readl(rhub->ports[i]->addr);
-			if (status & PORT_CONNECT)
-				return -EBUSY;
-		}
-	}
-
-	return 0;
-}
-
-/*
- * check the bus whether it could suspend or not
- * the bus will suspend if the downstream ports are already suspended,
- * or no devices connected.
- */
-static int check_bus_status(struct xhci_hcd *xhci)
-{
-	int ret;
-
-	ret = check_rhub_status(xhci, &xhci->usb3_rhub);
-	if (ret)
-		return ret;
-
-	return check_rhub_status(xhci, &xhci->usb2_rhub);
-}
-
 static int __maybe_unused xhci_mtk_runtime_suspend(struct device *dev)
 {
 	struct xhci_hcd_mtk  *mtk = dev_get_drvdata(dev);
@@ -699,11 +663,8 @@ static int __maybe_unused xhci_mtk_runtime_suspend(struct device *dev)
 	if (xhci->xhc_state)
 		return -ESHUTDOWN;
 
-	if (device_may_wakeup(dev)) {
-		ret = check_bus_status(xhci);
-		if (!ret)
-			ret = xhci_mtk_suspend(dev);
-	}
+	if (device_may_wakeup(dev))
+		ret = xhci_mtk_suspend(dev);
 
 	/* -EBUSY: let PM automatically reschedule another autosuspend */
 	return ret ? -EBUSY : 0;
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-16  7:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16  6:48 [next PATCH] usb: xhci-mtk: remove bus status check Chunfeng Yun

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).