diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-10-09 11:19:30 -0400 |
---|---|---|
committer | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2014-03-04 18:38:05 -0500 |
commit | 2fec32b06e374642802f7fb4f5350317cd14732b (patch) | |
tree | c5530d73c3f9eb780b2df104e5db14166d2d6960 | |
parent | 948cd8c18c466fdcbe707bb2a42a148796bfccdd (diff) |
usbfs: Add ep_to_host_endpoint helper function
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
-rw-r--r-- | drivers/usb/core/devio.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index d7571a63181d..502974b4deb5 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -769,6 +769,15 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, | |||
769 | return ret; | 769 | return ret; |
770 | } | 770 | } |
771 | 771 | ||
772 | static struct usb_host_endpoint *ep_to_host_endpoint(struct usb_device *dev, | ||
773 | unsigned char ep) | ||
774 | { | ||
775 | if (ep & USB_ENDPOINT_DIR_MASK) | ||
776 | return dev->ep_in[ep & USB_ENDPOINT_NUMBER_MASK]; | ||
777 | else | ||
778 | return dev->ep_out[ep & USB_ENDPOINT_NUMBER_MASK]; | ||
779 | } | ||
780 | |||
772 | static int match_devt(struct device *dev, void *data) | 781 | static int match_devt(struct device *dev, void *data) |
773 | { | 782 | { |
774 | return dev->devt == (dev_t) (unsigned long) data; | 783 | return dev->devt == (dev_t) (unsigned long) data; |
@@ -1230,15 +1239,10 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1230 | if (ret) | 1239 | if (ret) |
1231 | return ret; | 1240 | return ret; |
1232 | } | 1241 | } |
1233 | if ((uurb->endpoint & USB_ENDPOINT_DIR_MASK) != 0) { | 1242 | ep = ep_to_host_endpoint(ps->dev, uurb->endpoint); |
1234 | is_in = 1; | ||
1235 | ep = ps->dev->ep_in[uurb->endpoint & USB_ENDPOINT_NUMBER_MASK]; | ||
1236 | } else { | ||
1237 | is_in = 0; | ||
1238 | ep = ps->dev->ep_out[uurb->endpoint & USB_ENDPOINT_NUMBER_MASK]; | ||
1239 | } | ||
1240 | if (!ep) | 1243 | if (!ep) |
1241 | return -ENOENT; | 1244 | return -ENOENT; |
1245 | is_in = (uurb->endpoint & USB_ENDPOINT_DIR_MASK) != 0; | ||
1242 | 1246 | ||
1243 | u = 0; | 1247 | u = 0; |
1244 | switch(uurb->type) { | 1248 | switch(uurb->type) { |