--- zzzz-none-000/linux-3.10.107/drivers/usb/host/uhci-pci.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/usb/host/uhci-pci.c 2021-02-04 17:41:59.000000000 +0000 @@ -166,6 +166,8 @@ #ifdef CONFIG_PM +static int uhci_pci_resume(struct usb_hcd *hcd, bool hibernated); + static int uhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) { struct uhci_hcd *uhci = hcd_to_uhci(hcd); @@ -178,12 +180,6 @@ if (!HCD_HW_ACCESSIBLE(hcd) || uhci->dead) goto done_okay; /* Already suspended or dead */ - if (uhci->rh_state > UHCI_RH_SUSPENDED) { - dev_warn(uhci_dev(uhci), "Root hub isn't suspended!\n"); - rc = -EBUSY; - goto done; - }; - /* All PCI host controllers are required to disable IRQ generation * at the source, so we must turn off PIRQ. */ @@ -199,8 +195,15 @@ done_okay: clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); -done: spin_unlock_irq(&uhci->lock); + + synchronize_irq(hcd->irq); + + /* Check for race with a wakeup request */ + if (do_wakeup && HCD_WAKEUP_PENDING(hcd)) { + uhci_pci_resume(hcd, false); + rc = -EBUSY; + } return rc; } @@ -280,7 +283,7 @@ .hub_control = uhci_hub_control, }; -static DEFINE_PCI_DEVICE_TABLE(uhci_pci_ids) = { { +static const struct pci_device_id uhci_pci_ids[] = { { /* handle any USB UHCI controller */ PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_UHCI, ~0), .driver_data = (unsigned long) &uhci_driver, @@ -303,3 +306,5 @@ }, #endif }; + +MODULE_SOFTDEP("pre: ehci_pci");