Commit 6e8fe43b authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

USB: avoid the donelist after an error in ohci-hcd

This patch (as972) changes ohci-hcd so that after an error occurs, the
remaining TDs for the URB will be skipped over entirely instead of
going through the donelist.  This enables the driver to give back the
URB as soon as the error is detected, avoiding the need to store the
error status in urb->status.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1f5a3d0f
...@@ -783,10 +783,10 @@ static void td_done (struct ohci_hcd *ohci, struct urb *urb, struct td *td) ...@@ -783,10 +783,10 @@ static void td_done (struct ohci_hcd *ohci, struct urb *urb, struct td *td)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static inline struct td * static void ed_halted(struct ohci_hcd *ohci, struct td *td, int cc)
ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev)
{ {
struct urb *urb = td->urb; struct urb *urb = td->urb;
urb_priv_t *urb_priv = urb->hcpriv;
struct ed *ed = td->ed; struct ed *ed = td->ed;
struct list_head *tmp = td->td_list.next; struct list_head *tmp = td->td_list.next;
__hc32 toggle = ed->hwHeadP & cpu_to_hc32 (ohci, ED_C); __hc32 toggle = ed->hwHeadP & cpu_to_hc32 (ohci, ED_C);
...@@ -798,13 +798,12 @@ ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev) ...@@ -798,13 +798,12 @@ ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev)
wmb (); wmb ();
ed->hwHeadP &= ~cpu_to_hc32 (ohci, ED_H); ed->hwHeadP &= ~cpu_to_hc32 (ohci, ED_H);
/* put any later tds from this urb onto the donelist, after 'td', /* Get rid of all later tds from this urb. We don't have
* order won't matter here: no errors, and nothing was transferred. * to be careful: no errors and nothing was transferred.
* also patch the ed so it looks as if those tds completed normally. * Also patch the ed so it looks as if those tds completed normally.
*/ */
while (tmp != &ed->td_list) { while (tmp != &ed->td_list) {
struct td *next; struct td *next;
__hc32 info;
next = list_entry (tmp, struct td, td_list); next = list_entry (tmp, struct td, td_list);
tmp = next->td_list.next; tmp = next->td_list.next;
...@@ -819,14 +818,9 @@ ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev) ...@@ -819,14 +818,9 @@ ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev)
* then we need to leave the control STATUS packet queued * then we need to leave the control STATUS packet queued
* and clear ED_SKIP. * 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; ed->hwHeadP = next->hwNextTD | toggle;
} }
...@@ -852,8 +846,6 @@ ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev) ...@@ -852,8 +846,6 @@ ed_halted (struct ohci_hcd *ohci, struct td *td, int cc, struct td *rev)
hc32_to_cpu (ohci, td->hwINFO), hc32_to_cpu (ohci, td->hwINFO),
cc, cc_to_error [cc]); cc, cc_to_error [cc]);
} }
return rev;
} }
/* replies to the request have to be on a FIFO basis so /* replies to the request have to be on a FIFO basis so
...@@ -890,7 +882,7 @@ static struct td *dl_reverse_done_list (struct ohci_hcd *ohci) ...@@ -890,7 +882,7 @@ static struct td *dl_reverse_done_list (struct ohci_hcd *ohci)
*/ */
if (cc != TD_CC_NOERROR if (cc != TD_CC_NOERROR
&& (td->ed->hwHeadP & cpu_to_hc32 (ohci, ED_H))) && (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->next_dl_td = td_rev;
td_rev = td; td_rev = td;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment