Dave:

Could you please do a sanity check on this patch?  It looks okay to me
and it seems to work, but there's no substitute for having a
knowledgeable pair of eyeballs look at it.

The idea is that when an URB gets an error, there's no need to put all 
the TDs after the one that failed through the done list.  They can be 
removed right away, and then the URB can be given back as soon as the 
failed TD is reached.

Thanks,

Alan Stern



Index: usb-2.6/drivers/usb/host/ohci-q.c
===================================================================
--- usb-2.6.orig/drivers/usb/host/ohci-q.c
+++ usb-2.6/drivers/usb/host/ohci-q.c
@@ -795,10 +795,10 @@ static void td_done (struct ohci_hcd *oh
 
 /*-------------------------------------------------------------------------*/
 
-static inline struct td *
-ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev)
+static void ed_halted(struct ohci_hcd *ohci, struct td *td, int cc)
 {
        struct urb              *urb = td->urb;
+       urb_priv_t              *urb_priv = urb->hcpriv;
        struct ed               *ed = td->ed;
        struct list_head        *tmp = td->td_list.next;
        __hc32                  toggle = ed->hwHeadP & cpu_to_hc32 (ohci, ED_C);
@@ -810,13 +810,12 @@ ed_halted (struct ohci_hcd *ohci, struct
        wmb ();
        ed->hwHeadP &= ~cpu_to_hc32 (ohci, ED_H);
 
-       /* put any later tds from this urb onto the donelist, after 'td',
-        * order won't matter here: no errors, and nothing was transferred.
-        * also patch the ed so it looks as if those tds completed normally.
+       /* Get rid of all later tds from this urb.  We don't have
+        * to be careful: no errors and nothing was transferred.
+        * Also patch the ed so it looks as if those tds completed normally.
         */
        while (tmp != &ed->td_list) {
                struct td       *next;
-               __hc32          info;
 
                next = list_entry (tmp, struct td, td_list);
                tmp = next->td_list.next;
@@ -831,14 +830,9 @@ ed_halted (struct ohci_hcd *ohci, struct
                 * then we need to leave the control STATUS packet queued
                 * and clear ED_SKIP.
                 */
-               info = next->hwINFO;
-               info |= cpu_to_hc32 (ohci, TD_DONE);
-               info &= ~cpu_to_hc32 (ohci, TD_CC);
-               next->hwINFO = info;
-
-               next->next_dl_td = rev;
-               rev = next;
 
+               list_del(&next->td_list);
+               urb_priv->td_cnt++;
                ed->hwHeadP = next->hwNextTD | toggle;
        }
 
@@ -864,8 +858,6 @@ ed_halted (struct ohci_hcd *ohci, struct
                        hc32_to_cpu (ohci, td->hwINFO),
                        cc, cc_to_error [cc]);
        }
-
-       return rev;
 }
 
 /* replies to the request have to be on a FIFO basis so
@@ -902,7 +894,7 @@ static struct td *dl_reverse_done_list (
                 */
                if (cc != TD_CC_NOERROR
                                && (td->ed->hwHeadP & cpu_to_hc32 (ohci, ED_H)))
-                       td_rev = ed_halted (ohci, td, cc, td_rev);
+                       ed_halted(ohci, td, cc);
 
                td->next_dl_td = td_rev;
                td_rev = td;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
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