mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 02:19:51 +00:00
usb: xhci-mtk: remove bus status check
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> Link: https://lore.kernel.org/r/1618555706-6810-1-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ca0584c40a
commit
5951b7c20f
1 changed files with 2 additions and 41 deletions
|
@ -665,42 +665,6 @@ static int __maybe_unused xhci_mtk_resume(struct device *dev)
|
||||||
return ret;
|
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)
|
static int __maybe_unused xhci_mtk_runtime_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
|
struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
|
||||||
|
@ -710,11 +674,8 @@ static int __maybe_unused xhci_mtk_runtime_suspend(struct device *dev)
|
||||||
if (xhci->xhc_state)
|
if (xhci->xhc_state)
|
||||||
return -ESHUTDOWN;
|
return -ESHUTDOWN;
|
||||||
|
|
||||||
if (device_may_wakeup(dev)) {
|
if (device_may_wakeup(dev))
|
||||||
ret = check_bus_status(xhci);
|
ret = xhci_mtk_suspend(dev);
|
||||||
if (!ret)
|
|
||||||
ret = xhci_mtk_suspend(dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -EBUSY: let PM automatically reschedule another autosuspend */
|
/* -EBUSY: let PM automatically reschedule another autosuspend */
|
||||||
return ret ? -EBUSY : 0;
|
return ret ? -EBUSY : 0;
|
||||||
|
|
Loading…
Reference in a new issue