I noticed that some cases where USB produced lots of TT messages
were clearly wrong, since the transactions completed cleanly
(with a stall) and the TT buffer cleanup is only supposed to
be needed when a CSPLIT transaction fails (for control or bulk).

This patch makes the TT buffer cleanup happen only in the rarer
cases where there was an error that might really need it.

Please merge to Linus' tree.

- Dave

--- 1.50/drivers/usb/host/ehci-q.c      Mon Jun 16 11:00:43 2003
+++ edited/drivers/usb/host/ehci-q.c    Mon Jul 28 17:27:47 2003
@@ -161,16 +161,18 @@
                                usb_endpoint_halt (urb->dev,
                                        usb_pipeendpoint (pipe),
                                        usb_pipeout (pipe));
-                       if (urb->dev->tt && !usb_pipeint (pipe)) {
+
+               /* if async CSPLIT failed, try cleaning out the TT buffer */
+               } else if (urb->dev->tt && !usb_pipeint (urb->pipe)
+                               && QTD_CERR(token) == 0) {
 #ifdef DEBUG
-                               struct usb_device *tt = urb->dev->tt->hub;
-                               dbg ("clear tt %s-%s p%d buffer, a%d ep%d",
-                                       tt->bus->bus_name, tt->devpath,
-                                       urb->dev->ttport, urb->dev->devnum,
-                                       usb_pipeendpoint (pipe));
+                       struct usb_device *tt = urb->dev->tt->hub;
+                       dev_dbg (&tt->dev,
+                               "clear tt buffer port %d, a%d ep%d t%08x\n",
+                               urb->dev->ttport, urb->dev->devnum,
+                               usb_pipeendpoint (urb->pipe), token);
 #endif /* DEBUG */
-                               usb_hub_tt_clear_buffer (urb->dev, pipe);
-                       }
+                       usb_hub_tt_clear_buffer (urb->dev, urb->pipe);
                }
        }
 }

Reply via email to