Re: changing URB allocation API

Oliver Neukum <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Am Freitag, 6. Juli 2007 schrieb Alan Stern:
> On Fri, 6 Jul 2007, Oliver Neukum wrote:
> 
> > Hi,
> > 
> > I tried switching our allocation APIs to:
> > 
> > struct urb *usb_alloc_urb(struct usb_host_endpoint *ep, size_t alloc_length, gfp_t mem_flags);
> > struct urb *usb_alloc_iso_urb(struct usb_host_endpoint *ep, unsigned int iso_packets, gfp_t mem_flags);
> > 
> > Unfortunately during initialisation ep->ep_dev turns out to be NULL.
> > Should I change the allocator or the initialisation?
> 
> 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. 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.

> This could have an additional extra use, since it could leave space for 
> the setup packet at the end of the URB (rounded up to the next cache 
> line).

That collides with the HCD allocating the URB, or it means also changing
the HCD interface and adding a method just for this.

	Regards
		Oliver

-------------------------------------------------------------------------
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/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.