On Wed, Feb 19, 2003, Greg KH <[EMAIL PROTECTED]> wrote: > On Wed, Feb 19, 2003 at 07:57:29PM -0500, Johannes Erdfelt wrote: > > > > > > Heh. No, urbs are referenced counted now. So a driver can do the > > > following just fine: > > > - usb_alloc_urb() > > > - urb data = kmalloc() > > > - usb_submit_urb() > > > - usb_free_urb() > > > > > > Then later in the completion function you free the transfer buffer. > > > When the hcd is done with the urb, the last urb_free_urb() call in the > > > hcd causes the urb to disappear. > > > > > > No worries or overhead in the usb driver to keep track of all of > > > the urbs it created, enabling very simple code. > > > > > > So I guess I do need to add module reference counting to urbs in order > > > to get this case to work properly. I'll look into it... > > > > It seems to me that this is dangerous. > > > > The only way this could work is if some other code (core, HCD) keeps > > track of the URBs and then unlinks them when disconnect processing > > happens. > > You've said that if a device is disconnected, it's urbs will eventually > timeout, right? So everything should be fine, given what I say below... > > > Otherwise, the device could be closed by the application and the driver > > unloaded only to have URBs it allocated still active only to have a > > callback made into an old modules address space. > > Hence the need to prevent such a module from being unloaded until all > urbs "owned" by it are retired.
Yes, so it does need to keep track of them, but only a count I guess. JE ------------------------------------------------------- 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