On Wed, 20 Feb 2013, Sarah Sharp wrote: > The second paragraph sounds right, but the message isn't actually about > ep->enabled. I think it's about how the USB core manages the > usb_device's ep_in and ep_out arrays. > > When usb_reset_and_verify_device() is called, it goes through port > initialization (including resetting the device). At that point, all > endpoints (except the default control endpoint) are marked as disabled > by the xHCI host, and both the host and driver drop any bandwidth > resources allocated to non-default endpoints. > > Then usb_reset_and_verify_device() attempts to reinstate the old > configuration and alt settings. usb_hcd_alloc_bandwidth() gets called > with udev->actconfig, so that the configuration and all alt setting 0 > interfaces are restored. That calls into the xHCI driver to drop any > endpoints in the udev->ep_out[] or udev->ep_in[] arrays. I think that's > what triggers the warning. That's right. > The USB core still keeps the old > usb_host_endpoint structure pointers after the device has been reset. > > The function usb_disable_interface() clears out the ep_out and ep_in > arrays, but that isn't called by usb_reset_and_verify_device() until > after the configuration has been re-installed in the xHCI host. It's > called just before attempting to re-install the old alt settings. I'm > not sure why the code is written that way. Perhaps the USB core needs > those endpoints to stick around because of later error paths? Alan? usb_reset_and_verify_device doesn't disable endpoints before the reset and re-enable them afterward because until xHCI appeared, there was no reason to do so. It would just have been a waste of time and space; other host controllers don't care whether endpoints are enabled or not when they aren't actively in use. This is a symptom of a more general problem. Until xHCI, the USB stack's requirements for managing endpoints were based mostly on what EHCI needs. As a result they weren't a very good match for xHCI's requirements, and we never really tried to straighten out the mess. I have to agree; it would be cleaner to disable all the non-default endpoints before calling hub_port_init. > We could just remove the warning. It was mostly put in to help me debug > the new bandwidth allocation code, and just in case there was a host > controller who accidentially mis-managed the endpoint context state. No objection. 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