On Wed, Feb 19, 2003 at 04:56:28PM -0800, David Brownell wrote: > Greg KH wrote: > >On Wed, Feb 19, 2003 at 02:21:11PM -0800, David Brownell wrote: > > > >>Greg KH wrote: > >> > >>>Hm, maybe we should mark the device gone at the beginning of this call, > >>>or right at the time we realize it's gone in the hub driver. That would > >>>keep drivers from submitting urbs from within their disconnect > >>>functions. But it would also prevent them from canceling them... Ah, > >> > >>Only because you put that check in the unlink path ... I think it'd > >>be better to mark earlier, and allow cleanup at any time (not check). > > > > > >No, some of the hcds die a horrible death if you try to call unlink on a > >urb after the device is gone :( > > You mean with urb->dev null, or what? It ought to be fine; remember > that only usb_submit_urb() would really be testing udev->present, > so I don't see how that could happen without nulling urb->dev ...
No, with urb->dev set properly. See my post on how to duplicate this. I haven't tested that on ohci to see how it works. > >>>then we don't know when the callback would have happened to be able to > >>>unload the driver safely... > >> > >>I don't see why that would matter in that routine; > >>that seems like a different discussion. > > > > > >No, you're saying that if a driver's disconnect() function has > >completed, it is now safe to unload, right? Well if the hcd driver > > Of a correctly written disconnect(), yes: because no urbs are in > flight, by definition. I think I've now proven that we don't have an easy way to determine if urbs are in flight or not :) > >>It's always been messy there, and rather than requiring the HCDs to do > >>more work, I'd much rather see them do less ... by guaranteeing that > >>those more exotic cases will never appear. > > > > > >How do we prevent that from never appearing? > > Prevent from never appearing ... leave code the way it is today! > But I hope you mean "prevent from appearing" ... ;) > > For the cases I focussed on here, changing those two lines I mentioned > to make (a) happen early enough to leave (b) be the only problem: > > - usb_unlink_urb() ignores dev->present. As I pointed out, bad things happen if you don't do this. thanks, greg k-h ------------------------------------------------------- This SF.net email is sponsored by: SlickEdit Inc. Develop an edge. The most comprehensive and flexible code editor you can use. Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial. www.slickedit.com/sourceforge _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel