USB: ehci: qh_completions cleanup and bugfix
commit4f6676274fb6303a8e8100d086ea8c2c00c0d8e3
authorDavid Brownell <david-b@pacbell.net>
Sat, 12 Apr 2008 15:32:05 +0000 (12 08:32 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Apr 2008 04:16:53 +0000 (24 21:16 -0700)
treec59746300f9a343e13bf102c063c372e34f809d4
parentc6dbf554bc8a79c9caab3dbf891a33c19068f646
USB: ehci: qh_completions cleanup and bugfix

Simplify processing of completed qtds, and correct handling of short
reads, by removing two state variables:

 - "qtd_status" wasn't needed.  The current URB's status is either
   OK (-EINPROGRESS) or some fault status.  Once a fault appears,
   the queue halts and any later QTDs are immediately removed, so
   no temporary status is needed.  (Or for typical short reads,
   it's not treated as a fault, so no queue halt is needed.)

 - "do_status" was erroneous.  Because of how the queue is set up,
   short control reads can (and should!) be treated like full size
   reads, and cleaned up the usual way.  The status stage will be
   executed transparently, and usbcore handles the choice of whether
   to report this status as unexected.

The "do_status" problem caused a rather perplexing timing-dependent
problem with usbtest case 10.  Sometimes it would make the controller
skip a dozen transactions while (wrongly) trying to clean up after a
short transfer.  Fortunately, removing a dcache contention issue made
this become trivial to reproduce (on one test rig), so enough clues
finally presented themselves ... I think this has been around for a
very long time, but was worsened by recent urb->status changes.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/ehci-q.c