On Sun, Feb 23, 2003 at 12:36:02AM +0100, Duncan Sands wrote: > > The philosophy is often called "programming by contract". > > > > And the contract is: usbcore agrees to work with your driver > > and do everything right, if your driver agrees to do a few > > specific things. One of those specific things is never using > > the device after you return from disconnect(), either directly > > (as you're doing here) or indirectly (urb still pending, say). > > > > If you break such programming contracts, bad things happen; > > that's part of why the contract exists. There are lots of > > components interacting, relying on contracts to be followed, > > and if they aren't ... it's impractical to guarantee that > > all the failure modes will always be benign. > > Pity this contract is undocumented.
And flat wrong. For 2.5, your driver can use the struct usb_device for as long as it wants to, provided it got a reference to it in the first place with usb_get_dev(). It makes driver writing a hell of a lot easer, just take a look at all of the nasty lock mess I took out of the usb-serial core because of this. For 2.4, I want to backport these changes to the core to also ensure that "this contract" is not needed. But I haven't had the time to do so yet. Again, patches gleefully accepted :) 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