On Friday, 15. June 2001 22:59, Vojtech Pavlik wrote:

[Discussion over allocating an URB]

> The 'official' way is usb_alloc_urb(). However any URB that is
> kmalloc()ed either via usb_alloc_urb(), or via kmalloc or being a part
> of a larger structure is OK and will work.
>
> Urbs on the stack or allocated via other means may or may not work on
> various architectures.

Hmmm... usb_alloc_urb() will do a  spin_lock_init(&urb->lock).
If I use another method of creating an URB, who will do the
spin_lock_init() for me? The member "lock" of the urb structure 
seems to be "internal" and not a part of the "interface" of URB, 
so all users of URBs are expected to don't know it...

Even worse: if usb_alloc_urb() is enhanced in the future to contain
more initialisation, *ALL* urbs which are used in the various drivers
need to be checked...

In dabusb.c, I have seen some statical allocated URBs inside the driver
data structures. I assume that these are not the only ones without
initialized lock....

If URBs are allocated in more than one way, it might be wise to seperate
allocation and initialisation.

By the way: is it a common agreement that dabusb.c is a reference driver
for usb devices as suggested in
"Programming Guide for Linux USB Device Drivers" at http://usb.cs.tum.edu ?

best regards
Wolfgang





_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
http://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to