On Mon, Mar 06, 2017 at 04:01:36PM +0100, Johan Hovold wrote: > On Mon, Mar 06, 2017 at 02:14:51PM +0100, Oliver Neukum wrote: > > Am Montag, den 06.03.2017, 12:27 +0100 schrieb Johan Hovold: > > > On Mon, Mar 06, 2017 at 10:54:44AM +0100, Oliver Neukum wrote: > > > > True, but again not specific to serial drivers. DVB-T will face > > > > the same issues. > > > > > > Certainly, and I should have elaborated a bit more on the > > > differences here. For USB-serial endpoint-resources are allocated > > > only after subdriver probe returns, while for most (all) other USB > > > driver this would need to be done in the USB probe callback > > > directly. In that case, checking before probe might be too soon (fw > > > download, altsetting) and checking after would be too late (endpoint > > > resources would already need to have been setup). > > > > Now that argues for usbserial to trigger the check itself, but not for > > the code doing the check living in usbserial. In other words put > > > > struct usb_serial_endpoints and find_endpoints into usbcore and > > call it from usbserial. Add a flag to tell usbcore to not check > > this by itself and you are done. (With some generic name changes) > > > > That way everybody can use it almost for free. > > An idea would be to always construct the endpoint-data struct (as a > member of usb_interface) when setting an alternate setting (or always > keep it around in usb_host_interface), and provide minimal constraints > per usb_driver which core verified before probe unless a flag is set. > > Would the overhead for this be acceptable? I guess some more memory > would be required for control and isochronous endpoints too. A variant would be to always store the endpoint-type counts in struct usb_host_interface. That's often all that's needed to do the sanity checks (including the cdc-acm case) and only adds 7 bytes per altsetting. Then a find_endpoints helper can be added to partition the endpoints of a given altsetting. Johan -- 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