diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2007-08-08 11:48:02 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 17:55:10 -0400 |
commit | e9df41c5c5899259541dc928872cad4d07b82076 (patch) | |
tree | 12bb0917eeecbe62b2b5d3dc576806c7f2728550 /drivers/usb/host/ehci-hcd.c | |
parent | b0e396e3097ce4914c643bc3f0c2fe0098f551eb (diff) |
USB: make HCDs responsible for managing endpoint queues
This patch (as954) implements a suggestion of David Brownell's. Now
the host controller drivers are responsible for linking and unlinking
URBs to/from their endpoint queues. This eliminates the possiblity of
strange situations where usbcore thinks an URB is linked but the HCD
thinks it isn't. It also means HCDs no longer have to check for URBs
being dequeued before they were fully enqueued.
In addition to the core changes, this requires changing every host
controller driver and the root-hub URB handler. For the most part the
required changes are fairly small; drivers have to call
usb_hcd_link_urb_to_ep() in their urb_enqueue method,
usb_hcd_check_unlink_urb() in their urb_dequeue method, and
usb_hcd_unlink_urb_from_ep() before giving URBs back. A few HCDs make
matters more complicated by the way they split up the flow of control.
In addition some method interfaces get changed. The endpoint argument
for urb_enqueue is now redundant so it is removed. The unlink status
is required by usb_hcd_check_unlink_urb(), so it has been added to
urb_dequeue.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
CC: Olav Kongas <ok@artecdesign.ee>
CC: Tony Olech <tony.olech@elandigitalsystems.com>
CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/ehci-hcd.c')
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 35cdba10411b..db00492588b6 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -719,7 +719,6 @@ dead: | |||
719 | */ | 719 | */ |
720 | static int ehci_urb_enqueue ( | 720 | static int ehci_urb_enqueue ( |
721 | struct usb_hcd *hcd, | 721 | struct usb_hcd *hcd, |
722 | struct usb_host_endpoint *ep, | ||
723 | struct urb *urb, | 722 | struct urb *urb, |
724 | gfp_t mem_flags | 723 | gfp_t mem_flags |
725 | ) { | 724 | ) { |
@@ -734,12 +733,12 @@ static int ehci_urb_enqueue ( | |||
734 | default: | 733 | default: |
735 | if (!qh_urb_transaction (ehci, urb, &qtd_list, mem_flags)) | 734 | if (!qh_urb_transaction (ehci, urb, &qtd_list, mem_flags)) |
736 | return -ENOMEM; | 735 | return -ENOMEM; |
737 | return submit_async (ehci, ep, urb, &qtd_list, mem_flags); | 736 | return submit_async(ehci, urb, &qtd_list, mem_flags); |
738 | 737 | ||
739 | case PIPE_INTERRUPT: | 738 | case PIPE_INTERRUPT: |
740 | if (!qh_urb_transaction (ehci, urb, &qtd_list, mem_flags)) | 739 | if (!qh_urb_transaction (ehci, urb, &qtd_list, mem_flags)) |
741 | return -ENOMEM; | 740 | return -ENOMEM; |
742 | return intr_submit (ehci, ep, urb, &qtd_list, mem_flags); | 741 | return intr_submit(ehci, urb, &qtd_list, mem_flags); |
743 | 742 | ||
744 | case PIPE_ISOCHRONOUS: | 743 | case PIPE_ISOCHRONOUS: |
745 | if (urb->dev->speed == USB_SPEED_HIGH) | 744 | if (urb->dev->speed == USB_SPEED_HIGH) |
@@ -777,13 +776,18 @@ static void unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
777 | * completions normally happen asynchronously | 776 | * completions normally happen asynchronously |
778 | */ | 777 | */ |
779 | 778 | ||
780 | static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb) | 779 | static int ehci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) |
781 | { | 780 | { |
782 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 781 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
783 | struct ehci_qh *qh; | 782 | struct ehci_qh *qh; |
784 | unsigned long flags; | 783 | unsigned long flags; |
784 | int rc; | ||
785 | 785 | ||
786 | spin_lock_irqsave (&ehci->lock, flags); | 786 | spin_lock_irqsave (&ehci->lock, flags); |
787 | rc = usb_hcd_check_unlink_urb(hcd, urb, status); | ||
788 | if (rc) | ||
789 | goto done; | ||
790 | |||
787 | switch (usb_pipetype (urb->pipe)) { | 791 | switch (usb_pipetype (urb->pipe)) { |
788 | // case PIPE_CONTROL: | 792 | // case PIPE_CONTROL: |
789 | // case PIPE_BULK: | 793 | // case PIPE_BULK: |
@@ -838,7 +842,7 @@ static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb) | |||
838 | } | 842 | } |
839 | done: | 843 | done: |
840 | spin_unlock_irqrestore (&ehci->lock, flags); | 844 | spin_unlock_irqrestore (&ehci->lock, flags); |
841 | return 0; | 845 | return rc; |
842 | } | 846 | } |
843 | 847 | ||
844 | /*-------------------------------------------------------------------------*/ | 848 | /*-------------------------------------------------------------------------*/ |