> > It's probably nothing, but this line in ohci-q.c in td_submit_urb raised
> > an eyebrow:
> > 
> > urb_priv->ed->hwHeadP &= ~cpu_to_hc32 (ohci, ED_C);
> > 
> > There is a comment "resetting toggle is meaningless if the endpoint is
> > active" above this code. While that's true, I wouldn't expect this
> > operation to be atomic. What happens if the HC is updating headP during
> > this block? 

It's not allowed to be active at that point.  The flag being
tested is set only by usb_clear_halt() ... for OHCI and any
other HCD managing toggle in hardware, the software flag which
must have been set before that condition triggers (and that
statement executes) is only used to say "reset this endpoint's
toggle, whatever it may be".


> > I would think the driver could potentially overwrite it with 
> > the old value.
> 
> I would think the same thing.

If the endpoint is active, the driver calling usb_clear_halt()
has made a major goof and trashed the endpoint state ... since
it wasn't halted!

 
> In fact, the whole reason for that section of code is mysterious.  The
> comment implies that it's not supposed to apply to bulk or interrupt
> endpoints,

The comment means that the "real" toggles are handled in hardware
for those two endpoint types.  It's managed by hand for control
transfers, restarting with each transfer (and ISTR not using that
bit to do so); and of course ISO doesn't toggle.


> and isochronous endpoints don't use toggles anyway.  Resetting 
> the toggle at the start of a control transfer makes sense -- but the code
> doesn't test to see if it's dealing with a control endpoint or if the
> endpoint is currently running.

See above.

- Dave

-------------------------------------------------------------------------
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

Reply via email to