On Fri, 19 Jul 2013, Ming Lei wrote: > Even we can introduce one flag of 'completing' in 'struct urb' to check if > the USB's submit is called inside its own complete(), by which we can > check if resubmission is in underrun easily. > > Consider that isoc URB's resubmission in completion handler should > cover 99% cases, I think this approach is doable. > > For other resubmission from tasklet or workque cases, either let them alone > or move the resubmission inside completion() handler, or introduce simple > helper to mark start of frame only for them. Anyway, there are very few isoc > resubmissions from non-completion handler (only two drivers found in my > urb complet() cleanup work), so it shouldn't be a big deal. > > What do you think about this approach? Why go to all this trouble? We already have the URB_ISO_ASAP flag. Trying to check the context of an URB submission strikes me as not robust at all. Who knows what tricks drivers will get up to in the future? Adding a new API seems like the cleanest solution. (Although I still think that usb_reset_endpoint() would be appropriate.) > Actually 'start of stream' should be done inside usbcore because it > is HCD-independent function, so it is better to provide the information > from usbcore and let HCD use it if HCD needs the flag. I'm not quite sure what you mean. Note that usb_reset_endpoint() _is_ a function in usbcore. But never mind. For a new API, how about void usb_new_iso_stream(struct usb_device *, struct usb_host_endpoint *); Does that look okay? 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