aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-q.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-08-21 15:40:36 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 17:55:19 -0400
commiteb23105462304fd35571fd0cab1de7aec79a9ec5 (patch)
tree3579e74b3f1a6e68d42de01c122d206447454d4b /drivers/usb/host/ehci-q.c
parentb0d9efba3ec53468984aecef8eeaf079089f2e5a (diff)
USB: add urb->unlinked field
This patch (as970) adds a new urb->unlinked field, which is used to store the status of unlinked URBs since we can't use urb->status for that purpose any more. To help simplify the HCDs, usbcore will check urb->unlinked before calling the completion handler; if the value is set it will automatically override the status reported by the HCD. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: David Brownell <david-b@pacbell.net> CC: Olav Kongas <ok@artecdesign.ee> CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> CC: Tony Olech <tony.olech@elandigitalsystems.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/ehci-q.c')
-rw-r--r--drivers/usb/host/ehci-q.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index e80b5c417d74..a8f5408c161d 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -151,7 +151,7 @@ static void qtd_copy_status (
151 urb->actual_length += length - QTD_LENGTH (token); 151 urb->actual_length += length - QTD_LENGTH (token);
152 152
153 /* don't modify error codes */ 153 /* don't modify error codes */
154 if (unlikely (urb->status != -EINPROGRESS)) 154 if (unlikely(urb->unlinked))
155 return; 155 return;
156 156
157 /* force cleanup after short read; not always an error */ 157 /* force cleanup after short read; not always an error */
@@ -232,21 +232,14 @@ __acquires(ehci->lock)
232 } 232 }
233 233
234 spin_lock (&urb->lock); 234 spin_lock (&urb->lock);
235 switch (urb->status) { 235 if (unlikely(urb->unlinked)) {
236 case -EINPROGRESS: /* success */ 236 COUNT(ehci->stats.unlink);
237 urb->status = 0; 237 } else {
238 default: /* fault */ 238 if (likely(urb->status == -EINPROGRESS ||
239 COUNT (ehci->stats.complete); 239 (urb->status == -EREMOTEIO &&
240 break; 240 !(urb->transfer_flags & URB_SHORT_NOT_OK))))
241 case -EREMOTEIO: /* fault or normal */
242 if (!(urb->transfer_flags & URB_SHORT_NOT_OK))
243 urb->status = 0; 241 urb->status = 0;
244 COUNT (ehci->stats.complete); 242 COUNT(ehci->stats.complete);
245 break;
246 case -ECONNRESET: /* canceled */
247 case -ENOENT:
248 COUNT (ehci->stats.unlink);
249 break;
250 } 243 }
251 spin_unlock (&urb->lock); 244 spin_unlock (&urb->lock);
252 245
@@ -364,7 +357,8 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
364 * for the urb faulted (including short read) or 357 * for the urb faulted (including short read) or
365 * its urb was canceled. we may patch qh or qtds. 358 * its urb was canceled. we may patch qh or qtds.
366 */ 359 */
367 if (likely (urb->status == -EINPROGRESS)) 360 if (likely(urb->status == -EINPROGRESS &&
361 !urb->unlinked))
368 continue; 362 continue;
369 363
370 /* issue status after short control reads */ 364 /* issue status after short control reads */
@@ -395,7 +389,8 @@ halt:
395 spin_lock (&urb->lock); 389 spin_lock (&urb->lock);
396 qtd_copy_status (ehci, urb, qtd->length, token); 390 qtd_copy_status (ehci, urb, qtd->length, token);
397 if (unlikely(urb->status == -EREMOTEIO)) { 391 if (unlikely(urb->status == -EREMOTEIO)) {
398 do_status = usb_pipecontrol(urb->pipe); 392 do_status = (!urb->unlinked &&
393 usb_pipecontrol(urb->pipe));
399 urb->status = 0; 394 urb->status = 0;
400 } 395 }
401 spin_unlock (&urb->lock); 396 spin_unlock (&urb->lock);