2005/9/12, Alan Stern <[EMAIL PROTECTED]>:
> No, it means there's a mistake in urb_unlink.  It should not release
> the bandwidth reservation.  Even if the HCD calls claim_bandwidth again
> after giveback_urb returns, there's still a period of time while the
> completion routine is running during which the bandwidth information is
> wrong.

ok I guess it will be fixed when bandwidth rework will start.
 
> 
> You should return 0.  That just means your driver knows that the URB has
> been dequeued; it doesn't mean you've already called giveback_urb.
> 
> In fact, you should always return 0.  (The dequeue method really should be
> declared as returning void, not int.)  However, your _enqueue_ routine
> should check urb->status and return an error if it isn't equal to
> -EINPROGRESS.  This can happen if a second thread tries to unlink an URB
> before the first thread has finished submitting it:
> 
>         Thread 1                        Thread 2
>         --------                        --------
>         Calls usb_submit_urb
>         -> hcd_submit_urb
>         Sets urb->status = -EINPROGRESS
>         Gets as far as the
>           spin_unlock_irqrestore line
>                                         Calls usb_unlink_urb
>                                         -> hcd_unlink_urb
>                                         sets urb->status to -ENOENT or
>                                           -EDISCONN
>                                         -> your dequeue routine
>                                         Nothing to do: not yet queued
>         -> your enqueue routine
>         Return an error; already unlinked
>           since urb->status != -EINPROGRESS
> 
> To be fair, you don't _have_ to do things this way.  It would be equally
> valid to have both your enqueue and dequeue routines return 0 in this
> situation.  But then your enqueue routine would have to know that it
> shouldn't fully queue the URB; it should set things up so that at the next
> interrupt the URB will be sent to giveback_urb.  That's a bit more work.
> 

Thanks for these usefull explanations ! I have another question ;)
urb->error_count is documented (in kernel code)as follows: "Returns
the number of ISO transfers that reported errors." For not ISO
transfers can I use it for my own purposes ?

Thanks again
-- 
               Franck


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to