aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-q.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-08-08 11:48:02 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 17:55:10 -0400
commite9df41c5c5899259541dc928872cad4d07b82076 (patch)
tree12bb0917eeecbe62b2b5d3dc576806c7f2728550 /drivers/usb/host/ehci-q.c
parentb0e396e3097ce4914c643bc3f0c2fe0098f551eb (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-q.c')
-rw-r--r--drivers/usb/host/ehci-q.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 140bfa423e07..1da2de4d34ed 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -262,6 +262,7 @@ __acquires(ehci->lock)
262#endif 262#endif
263 263
264 /* complete() can reenter this HCD */ 264 /* complete() can reenter this HCD */
265 usb_hcd_unlink_urb_from_ep(ehci_to_hcd(ehci), urb);
265 spin_unlock (&ehci->lock); 266 spin_unlock (&ehci->lock);
266 usb_hcd_giveback_urb (ehci_to_hcd(ehci), urb); 267 usb_hcd_giveback_urb (ehci_to_hcd(ehci), urb);
267 spin_lock (&ehci->lock); 268 spin_lock (&ehci->lock);
@@ -913,7 +914,6 @@ static struct ehci_qh *qh_append_tds (
913static int 914static int
914submit_async ( 915submit_async (
915 struct ehci_hcd *ehci, 916 struct ehci_hcd *ehci,
916 struct usb_host_endpoint *ep,
917 struct urb *urb, 917 struct urb *urb,
918 struct list_head *qtd_list, 918 struct list_head *qtd_list,
919 gfp_t mem_flags 919 gfp_t mem_flags
@@ -922,10 +922,10 @@ submit_async (
922 int epnum; 922 int epnum;
923 unsigned long flags; 923 unsigned long flags;
924 struct ehci_qh *qh = NULL; 924 struct ehci_qh *qh = NULL;
925 int rc = 0; 925 int rc;
926 926
927 qtd = list_entry (qtd_list->next, struct ehci_qtd, qtd_list); 927 qtd = list_entry (qtd_list->next, struct ehci_qtd, qtd_list);
928 epnum = ep->desc.bEndpointAddress; 928 epnum = urb->ep->desc.bEndpointAddress;
929 929
930#ifdef EHCI_URB_TRACE 930#ifdef EHCI_URB_TRACE
931 ehci_dbg (ehci, 931 ehci_dbg (ehci,
@@ -933,7 +933,7 @@ submit_async (
933 __FUNCTION__, urb->dev->devpath, urb, 933 __FUNCTION__, urb->dev->devpath, urb,
934 epnum & 0x0f, (epnum & USB_DIR_IN) ? "in" : "out", 934 epnum & 0x0f, (epnum & USB_DIR_IN) ? "in" : "out",
935 urb->transfer_buffer_length, 935 urb->transfer_buffer_length,
936 qtd, ep->hcpriv); 936 qtd, urb->ep->hcpriv);
937#endif 937#endif
938 938
939 spin_lock_irqsave (&ehci->lock, flags); 939 spin_lock_irqsave (&ehci->lock, flags);
@@ -942,9 +942,13 @@ submit_async (
942 rc = -ESHUTDOWN; 942 rc = -ESHUTDOWN;
943 goto done; 943 goto done;
944 } 944 }
945 rc = usb_hcd_link_urb_to_ep(ehci_to_hcd(ehci), urb);
946 if (unlikely(rc))
947 goto done;
945 948
946 qh = qh_append_tds (ehci, urb, qtd_list, epnum, &ep->hcpriv); 949 qh = qh_append_tds(ehci, urb, qtd_list, epnum, &urb->ep->hcpriv);
947 if (unlikely(qh == NULL)) { 950 if (unlikely(qh == NULL)) {
951 usb_hcd_unlink_urb_from_ep(ehci_to_hcd(ehci), urb);
948 rc = -ENOMEM; 952 rc = -ENOMEM;
949 goto done; 953 goto done;
950 } 954 }