On Fri, Jun 21, 2013 at 10:48 PM, Alan Stern <st...@rowland.harvard.edu> wrote:
>
> Come to think of it, this shouldn't be a problem.  Drivers _must_
> insure that all their URBs have completed before their disconnect
> routine returns; otherwise the completion handler could get called
> after the driver has been unloaded from memory.
>
> Currently we have no way to enforce this in usbcore, although with the
> tasklets we could enforce it.  But I don't think it is necessary.  It

One way of enforcing this I thought of is to wait for completions of all
unlinking URBs at the end of usb_hcd_flush_endpoint().

But as you said, it may not be necessary.

> would be sufficient to log a warning if the tasklet's URB list isn't
> empty when exit_giveback_urb_bh() runs.  It won't happen unless there's
> a buggy driver.
>
> Besides, even if you try to flush all the URBs on the tasklet's list at
> the end of usb_hcd_flush_endpoint(), you'll still miss the URBs which
> have been moved to the local_list in usb_giveback_urb_bh().  You'd have
> to wait until the tasklet wasn't running, and it would most likely be a
> waste of time.


Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to