> Maybe only call usb_hcd_end_port_resume() if xhci_irq() detected the device-initiated > resume. i.e. set a value to resume_done[portnum] and called usb_hcd_start_port_resume() > something like: > > @@ -1088,6 +1088,8 @@ static void xhci_get_usb2_port_status(struct xhci_port *port, u32 *status, > if (link_state == XDEV_U2) > *status |= USB_PORT_STAT_L1; > if (link_state == XDEV_U0) { > + if (bus_state->resume_done[portnum]) > + usb_hcd_end_port_resume(&port->rhub->hcd->self, portnum); > bus_state->resume_done[portnum] = 0; > clear_bit(portnum, &bus_state->resuming_ports); This looks good. I can submit a new version based on this. > Also xhci_bus_resume() only resumes ports that were forcefully suspended to U3 in xhci_bus_suspend(). > Could be worth checking why that device wasn't already in U3 when suspend reached xhci_bus_suspend(). It happens when we trigger USB device-initiated resume to bring system out of system suspend state. For example, we can connect an USB2 external hub on root port and put system into suspend state. The USB2 external hub (the port it connects to) is in U3 after xhci_bus_suspend(). Once we connect a USB device to downstream port of the USB2 external hub, the hub will trigger device initiated resume to wake up the system. During system resume, XHCI controller will report the USB2 external hub is in RESUME state. Thanks, Henry