Alan, You were right, I think I have asked wrong question, so I changed the subject as well. >How does this happen? ehci-hcd doesn't use the rh_timer. It sets >hcd->poll_rh to 0. Actually the rh_timer is enabled by ehci_irq to process remote wakeup, it's scheduled for 20ms delay. /* remote wakeup [4.3.1] */ if (status & STS_PCD) { ...... mod_timer(&hcd->rh_timer, ehci->reset_done[i]); } > if (!HC_IS_RUNNING(hcd->state)) > return 0; >That should prevent the routine from accessing any controller registers if it is >called after the root hub has been suspended. You were right, the if statement should be sufficient. But in my code I had this if statement commented out for a reason. So the question I really should have asked is how to deal with the following situation: Time0: Suspend one port - selective suspend. By calling ehci_control with typeReq=SetPortFeature and wValue=USB_PORT_FEAT_SUSPEND; Time1: Remote wakeup from device triggers an STS_PCD interrupt , handled by ehci_irq; Time2: The ISR falls into if (status & STS_PCD), at this moment EHCI is still running (global suspend is expected to come shortly after selective suspend), so usb_hcd_resume_root_hub doesn't get called; Time3: In the while loop, since PORT_RESUME is set for the port being waked up, rh_timer is set to fire 20ms later; Time4: At the end of ehci_irq, usb_hcd_poll_rh_status is called, nothing happens here because ehci_hub_status_data returns 0, reason being time_after_eq(jiffies, ehci->reset_done) is false as ehci->reset_done has been set to 20ms later in Time3; Time5: EHCI is halted - global suspend scheduled by the host driver. Time between Time0 and Time5 is about 20ms; Time6: rh_timer fires. Time between Time3 and Time6 is 20ms (set in ehci_irq). rh_timer_func -> usb_hcd_poll_rh_status -> ehci_hub_status_data. Still nothing happens this time because ehci_hub_status_data returns 0 again as it falls into the first if statement if (!HC_IS_RUNNING(hcd->state)) (EHCI has been halted in Time5, so hcd->state is SUSPENDED now). The consequence is that the remote wakeup gets lost, the host doesn't resume the bus as expected. Thanks, Fei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html