diff options
author | Endre Kollar <taxy443@gmail.com> | 2010-07-27 12:39:45 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-07-27 11:08:31 -0700 |
commit | ab30f12d4ef11cc92fa9a657bf0c9b9951f24011 (patch) | |
tree | 85712a04acb43b2d16b759f6d3e658dbfce08791 /drivers/staging/usbip | |
parent | aa5873e96271611ae55586f65e49ea1fab90cb88 (diff) |
Staging: usbip: simplify get_ep_from_epnum
usb_device->ep_in/out includes the necessary endpoints, search is not needed.
Signed-off-by: Endre Kollar <taxy443@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/usbip')
-rw-r--r-- | drivers/staging/usbip/stub_rx.c | 46 |
1 files changed, 4 insertions, 42 deletions
diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c index 5972ae70e381..c6022602749e 100644 --- a/drivers/staging/usbip/stub_rx.c +++ b/drivers/staging/usbip/stub_rx.c @@ -362,54 +362,16 @@ static struct stub_priv *stub_priv_alloc(struct stub_device *sdev, return priv; } - -static struct usb_host_endpoint *get_ep_from_epnum(struct usb_device *udev, - int epnum0) -{ - struct usb_host_config *config; - int i = 0, j = 0; - struct usb_host_endpoint *ep = NULL; - int epnum; - int found = 0; - - if (epnum0 == 0) - return &udev->ep0; - - config = udev->actconfig; - if (!config) - return NULL; - - for (i = 0; i < config->desc.bNumInterfaces; i++) { - struct usb_host_interface *setting; - - setting = config->interface[i]->cur_altsetting; - - for (j = 0; j < setting->desc.bNumEndpoints; j++) { - ep = &setting->endpoint[j]; - epnum = (ep->desc.bEndpointAddress & 0x7f); - - if (epnum == epnum0) { - /* usbip_uinfo("found epnum %d\n", epnum0);*/ - found = 1; - break; - } - } - } - - if (found) - return ep; - else - return NULL; -} - - static int get_pipe(struct stub_device *sdev, int epnum, int dir) { struct usb_device *udev = interface_to_usbdev(sdev->interface); struct usb_host_endpoint *ep; struct usb_endpoint_descriptor *epd = NULL; - ep = get_ep_from_epnum(udev, epnum); + if (dir == USBIP_DIR_IN) + ep = udev->ep_in[epnum & 0x7f]; + else + ep = udev->ep_out[epnum & 0x7f]; if (!ep) { dev_err(&sdev->interface->dev, "no such endpoint?, %d\n", epnum); |