From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Mathias Nyman <mathias.nyman@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
<linux-usb@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, Ikjoon Jang <ikjn@chromium.org>,
Nicolas Boichat <drinkcat@chromium.org>,
Eddie Hung <eddie.hung@mediatek.com>
Subject: [next PATCH] usb: xhci-mtk: remove bus status check
Date: Fri, 16 Apr 2021 14:48:26 +0800 [thread overview]
Message-ID: <1618555706-6810-1-git-send-email-chunfeng.yun@mediatek.com> (raw)
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
reply other threads:[~2021-04-16 6:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1618555706-6810-1-git-send-email-chunfeng.yun@mediatek.com \
--to=chunfeng.yun@mediatek.com \
--cc=drinkcat@chromium.org \
--cc=eddie.hung@mediatek.com \
--cc=gregkh@linuxfoundation.org \
--cc=ikjn@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=matthias.bgg@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).