diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2007-08-24 15:40:47 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 17:55:22 -0400 |
commit | 65e51098d9094c7e840b6d6291867b95538d9442 (patch) | |
tree | f14e217542b9906aeea41d607b19c686b2a766cd /drivers | |
parent | 55d8496837cf124f68656e4242a5e20eb592fd54 (diff) |
USB: reorganize urb->status use in sl811-hcd
This patch (as976) reorganizes the way sl811-hcd sets urb->status. It
now keeps the information in a local variable until the last moment.
The patch also improves the handling of faults during the status stage
of a control transfer, since it no longer needs to retain the error
information from the earlier stages.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/host/sl811-hcd.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index f0fa94148d9d..515152809d37 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c | |||
@@ -435,11 +435,8 @@ static void finish_request( | |||
435 | if (usb_pipecontrol(urb->pipe)) | 435 | if (usb_pipecontrol(urb->pipe)) |
436 | ep->nextpid = USB_PID_SETUP; | 436 | ep->nextpid = USB_PID_SETUP; |
437 | 437 | ||
438 | spin_lock(&urb->lock); | ||
439 | urb->status = status; | ||
440 | spin_unlock(&urb->lock); | ||
441 | |||
442 | usb_hcd_unlink_urb_from_ep(sl811_to_hcd(sl811), urb); | 438 | usb_hcd_unlink_urb_from_ep(sl811_to_hcd(sl811), urb); |
439 | urb->status = status; | ||
443 | spin_unlock(&sl811->lock); | 440 | spin_unlock(&sl811->lock); |
444 | usb_hcd_giveback_urb(sl811_to_hcd(sl811), urb); | 441 | usb_hcd_giveback_urb(sl811_to_hcd(sl811), urb); |
445 | spin_lock(&sl811->lock); | 442 | spin_lock(&sl811->lock); |
@@ -537,27 +534,20 @@ done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank) | |||
537 | bank + SL11H_XFERCNTREG); | 534 | bank + SL11H_XFERCNTREG); |
538 | if (len > ep->length) { | 535 | if (len > ep->length) { |
539 | len = ep->length; | 536 | len = ep->length; |
540 | urb->status = -EOVERFLOW; | 537 | urbstat = -EOVERFLOW; |
541 | } | 538 | } |
542 | urb->actual_length += len; | 539 | urb->actual_length += len; |
543 | sl811_read_buf(sl811, SL811HS_PACKET_BUF(bank == 0), | 540 | sl811_read_buf(sl811, SL811HS_PACKET_BUF(bank == 0), |
544 | buf, len); | 541 | buf, len); |
545 | usb_dotoggle(udev, ep->epnum, 0); | 542 | usb_dotoggle(udev, ep->epnum, 0); |
546 | if (urb->actual_length == urb->transfer_buffer_length | 543 | if (urbstat == -EINPROGRESS && |
547 | || len < ep->maxpacket) | 544 | (len < ep->maxpacket || |
548 | urbstat = 0; | 545 | urb->actual_length == |
549 | if (usb_pipecontrol(urb->pipe) && urbstat == 0) { | 546 | urb->transfer_buffer_length)) { |
550 | 547 | if (usb_pipecontrol(urb->pipe)) | |
551 | /* NOTE if the status stage STALLs (why?), | 548 | ep->nextpid = USB_PID_ACK; |
552 | * this reports the wrong urb status. | 549 | else |
553 | */ | 550 | urbstat = 0; |
554 | spin_lock(&urb->lock); | ||
555 | if (urb->status == -EINPROGRESS) | ||
556 | urb->status = urbstat; | ||
557 | spin_unlock(&urb->lock); | ||
558 | |||
559 | urb = NULL; | ||
560 | ep->nextpid = USB_PID_ACK; | ||
561 | } | 551 | } |
562 | break; | 552 | break; |
563 | case USB_PID_SETUP: | 553 | case USB_PID_SETUP: |
@@ -597,7 +587,7 @@ done(struct sl811 *sl811, struct sl811h_ep *ep, u8 bank) | |||
597 | bank, status, ep, urbstat); | 587 | bank, status, ep, urbstat); |
598 | } | 588 | } |
599 | 589 | ||
600 | if (urb && (urbstat != -EINPROGRESS || urb->unlinked)) | 590 | if (urbstat != -EINPROGRESS || urb->unlinked) |
601 | finish_request(sl811, ep, urb, urbstat); | 591 | finish_request(sl811, ep, urb, urbstat); |
602 | } | 592 | } |
603 | 593 | ||