On Sat, 7 Jul 2007, Oliver Neukum wrote: > > That's a real problem. During initial enumeration the usb_device > > hasn't been registered yet, so the ep_device hasn't been created. > > > > One possibility is to add yet another allocator: > > > > struct urb *usb_alloc_ep0_urb(struct usb_device *udev, size_t alloc_length, > > gfp_t mem_flags); > > Very well. Given the call chain this means changing the API of the > usb_*_msg() calls to pass in an URB.
Don't change the existing API. Make usb_control_msg() allocate an URB and a setup packet buffer, and add a new intermediate routine which takes them as arguments. Then code using a preallocated URB can call the intermediate routine directly. > If I do that I'll preallocate an URB > per device for usbcore's calls to ep0 to make sure we won't face ENOMEM > in some very awkward situations. Just be sure that the core owns the device lock before trying to use the preallocated URB. Lots of places in the hub driver could benefit from this. (But not the port_suspend and port_resume parts, since they don't hold the hub's device lock. They might not even hold the lock of the device being suspended or resumed.) Alan Stern ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel