From d6aab69a0145267ac90a8469e905abfddc44d3de Mon Sep 17 00:00:00 2001 From: Udipto Goswami Date: Tue, 11 May 2021 22:36:13 +0530 Subject: [PATCH] usb: xhci: Avoid calling wakeup_enable without set_wakeup_capable Commit 6076cdc39559 ("usb: host: Disable system wakeup if remote wakeup is not required")has introduced a check in xhci_plat_probe where if device_may_wakeup is set for the parent device, then device_wakeup_enable is called on xhci-plat, but calling device_wakeup_enable without device_set_wakeup_capable is useless. Now when xhci_plat_suspend is called the xhci_suspend will check for device_may_wakeup and here the result will be FALSE. In xhci suspend the do_wakeup is checked, if FALSE then it will try to call xhci_disable_port_wake_on_bits where it will try to do a readl operation. This will lead the core to hang since xhci is already suspended and we tried to do a readl. Fix this by replacing device_wakeup_enable with device_init_wakeup. This will set the do_wakeup to be true and therefore avoid calling xhci_disable_port_wake_on_bits and bail out when checked for HCD_HW_ACCESSIBLE. Change-Id: Id3fad841ebe07b777dc229ced36364ad31e6d81d Signed-off-by: Udipto Goswami --- drivers/usb/host/xhci-plat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 9f2f37226075..46041f07c939 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -276,7 +276,7 @@ static int xhci_plat_probe(struct platform_device *pdev) } if (device_may_wakeup(sysdev)) - device_wakeup_enable(hcd->self.controller); + device_init_wakeup(hcd->self.controller, 1); xhci->main_hcd = hcd; xhci->shared_hcd = __usb_create_hcd(driver, sysdev, &pdev->dev,