On Thu, 24 Oct 2013, Peter Chen wrote: > > If the HC is deleted and the UDC is added then the wakeup settings > > should be determined by the UDC, not by the HC. The next time the > > system goes to sleep, the UDC driver should be responsible for enabling > > or disabling wakeup. > > > > I agree both of your points, but after thinking more, I doubt > that why hcd (or udc) needs to control its parent wakeup setting? > Why not let controller driver decide it? I"m not quite sure what you're asking. To start with, we are talking about two different wakeup settings: The software flag, which is controlled by userspace writing to the power/wakeup attribute or by the driver calling device_wakeup_enable(), device_wakeup_disable(), or device_set_wakeup_enable(); The physical wakeup setting in the hardware. In general, the controller driver does not control the software flag, except that the driver may initialize the flag. usb_add_hcd() always initializes the controller's flag to 1, but the driver can override it afterward. After it is initialized, the flag is controlled entirely by userspace. The physical wakeup setting is controlled by both the controller driver and the platform driver. For example, with a PCI-based EHCI controller, ehci-hub.c sets the various port wakeup flags and the PCI subsystem enables or disables PME. However this shouldn't matter, because these drivers should always tell the hardware to do what the software flag says. That is, if device_may_wakeup() is true then the hardware wakeup should be enabled; otherwise it should be disabled. Alan Stern -- 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