On Wed, 8 Sep 2004, Jan Capek wrote:

> Attached is a patch that replaces the use of usb_unlink_urb() of the read
> URB when the device is being closed with usb_kill_urb(). The second call
> is more appropriate and recommended by urb.c. In fact, the ftdi_close()
> tries to shut down the URB's synchronously since the URB_ASYNC_UNLINK
> flag is cleared. The current version with usb_unlink_urb(), causes the
> kernel to generate a warning about this. Did I miss anything here, or is
> it right to use the usb_kill_urb()?

It is right.  In fact, you can remove the test for whether port->read_urb
is NULL; if you pass a NULL pointer to usb_kill_urb() it will simply 
return.

The one thing to look out for is if the completion handler is running at 
about the same time and tries to resubmit the URB.  When you call 
usb_kill_urb(), the resubmission will fail with -EPERM.  The completion 
handler needs to be able to handle this properly.

Alan Stern




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to