On Tue, 2017-06-13 at 15:08 +1000, Benjamin Herrenschmidt wrote: > Now, what I observe is that when the mass storage gets bound to the > UDC driver: > > - First the endpoints are properly allocated by my match callback, > ie, epautoconf is called to allocate EPs to the function. > > - But right away, composite.c calls usb_ep_autoconfig_release() > effectively releasing those 2 endpoints. I confirmed this by reverting to my old "single UDC" driver (so a more standard setup without all my hooks) and putting a WARN_ON(!ep- >claimed) in usb_ep_enable(). A kernel with g_mass_storage built-in will WARN twice at boot. The endpoints are claimed and immediately released, then the driver proceeds to use released endpoints. I'll try with a few more gadgets (I haven't dabbled with the non-legacy stuff yet but will give a try), but it looks like endpoint "allocation" is rather broken at the moment. I'm happy to try to fix it since my virtual hub needs that to be solid, but it would be good if you guys could give me a hint of what is the expected policy. My gut feeling is that this should be the responsibility of the functions. They are the ones calling epautoconf to claim the EPs in the first place (typically in their bind callback), so they should be the ones releasing them in unbind. Any reason not to do it that way ? Cheers, Ben. -- 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