On Fri, Jul 19, 2013 at 5:06 PM, Clemens Ladisch <clemens@xxxxxxxxxx> wrote: > Ming Lei wrote: >> On Fri, Jul 19, 2013 at 1:44 AM, Clemens Ladisch <clemens@xxxxxxxxxx> wrote: >>> In any case, there must be _some_ mechanism to explicitly restart >>> a stream. I do not really care if this is some URB flag or some >>> function call. >> >> Thought about the problem further, looks there is one simple >> approach for detecting underrun in case of empty queue: >> >> if (list_empty (&stream->td_list)) { >> if (running from hcd interrupt or tasklet context) >> underrun >> else >> new stream >> } > > Why shouldn't a driver start a stream in an interrupt/tasklet, It should, but actually one driver won't do this because generally usb_set_interface() is required before starting stream. If stream is started in another non-isoc URB complete(), this approach can cover this situation easily. But do you have examples in which one isoc stream is started in another isoc URB's complete()? Anyway we need to consider current drivers' implementation. > or delay URB resubmission to a workqueue? Yes, it is possible, and the isoc URBs can be resubmitted in tasklet too, but it isn't a big deal: - they have worked well for long time in the underrun situation before switching to tasklet, so we needn't worry about the change introduced by switching URB->complete() to tasklet. or - change the resubmission into complete() since there are very few such usage(I only found two drivers which resubmit isoc URBs in tasklet when I was doing urb complete() cleanup work) Thanks, -- Ming Lei -- 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