aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/hcd.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-07-30 17:05:22 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 17:55:00 -0400
commitbdd016ba64d909329cb4bacacc8443901c00e112 (patch)
treecf20440d7d613377b5e2b4cec9764f2dc9e04928 /drivers/usb/core/hcd.c
parent5b653c79c04c6b152b8dc7d18f8c8a7f77f4b235 (diff)
USB: add ep->enable
This patch (as944) adds an explicit "enabled" field to the usb_host_endpoint structure and uses it in place of the current mechanism. This is merely a time-space tradeoff; it makes checking whether URBs may be submitted to an endpoint simpler. The existing mechanism is efficient when converting urb->pipe to an endpoint pointer, but it's not so efficient when urb->ep is used instead. As a side effect, the procedure for enabling an endpoint is now a little more complicated. The ad-hoc inline code in usb.c and hub.c for enabling ep0 is now replaced with calls to usb_enable_endpoint, which is no longer static. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/hcd.c')
-rw-r--r--drivers/usb/core/hcd.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index fb82c500caf..cc5b1d3c368 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -943,7 +943,6 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
943{ 943{
944 int status; 944 int status;
945 struct usb_hcd *hcd = bus_to_hcd(urb->dev->bus); 945 struct usb_hcd *hcd = bus_to_hcd(urb->dev->bus);
946 struct usb_host_endpoint *ep;
947 unsigned long flags; 946 unsigned long flags;
948 947
949 if (!hcd) 948 if (!hcd)
@@ -960,9 +959,7 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
960 // FIXME: verify that quiescing hc works right (RH cleans up) 959 // FIXME: verify that quiescing hc works right (RH cleans up)
961 960
962 spin_lock_irqsave(&hcd_urb_list_lock, flags); 961 spin_lock_irqsave(&hcd_urb_list_lock, flags);
963 ep = (usb_pipein(urb->pipe) ? urb->dev->ep_in : urb->dev->ep_out) 962 if (unlikely(!urb->ep->enabled))
964 [usb_pipeendpoint(urb->pipe)];
965 if (unlikely(ep != urb->ep))
966 status = -ENOENT; 963 status = -ENOENT;
967 else if (unlikely (urb->reject)) 964 else if (unlikely (urb->reject))
968 status = -EPERM; 965 status = -EPERM;