From 9d3e776a6211bb343cb02bead140fbe7fd37905a Mon Sep 17 00:00:00 2001 From: hlb194802 Date: Fri, 26 Jan 2024 03:46:40 +0000 Subject: [PATCH] driver usb: optimize pm resume time, do resume in runtime_resume Change-Id: I89ddf31061653767387fd0745eeaaecadfc7fefd --- drivers/usb/host/xhci-plat.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 01dcfd774..a5333706a 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -488,25 +488,25 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev) * xhci_suspend() needs `do_wakeup` to know whether host is allowed * to do wakeup during suspend. */ - return xhci_suspend(xhci, device_may_wakeup(dev)); + ret = xhci_suspend(xhci, device_may_wakeup(dev)); + if (!ret) { + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + } + + return ret; } static int __maybe_unused xhci_plat_resume(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); - struct xhci_hcd *xhci = hcd_to_xhci(hcd); int ret; ret = xhci_priv_resume_quirk(hcd); if (ret) return ret; - ret = xhci_resume(xhci, 0); - if (ret) - return ret; - - pm_runtime_disable(dev); - pm_runtime_set_active(dev); + /* call xhci_suspend in xhci_plat_runtime_suspend */ pm_runtime_enable(dev); return 0;