Commit 2fec32b0 authored by Hans de Goede's avatar Hans de Goede Committed by Sarah Sharp

usbfs: Add ep_to_host_endpoint helper function

Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
parent 948cd8c1
...@@ -769,6 +769,15 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, ...@@ -769,6 +769,15 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype,
return ret; return ret;
} }
static struct usb_host_endpoint *ep_to_host_endpoint(struct usb_device *dev,
unsigned char ep)
{
if (ep & USB_ENDPOINT_DIR_MASK)
return dev->ep_in[ep & USB_ENDPOINT_NUMBER_MASK];
else
return dev->ep_out[ep & USB_ENDPOINT_NUMBER_MASK];
}
static int match_devt(struct device *dev, void *data) static int match_devt(struct device *dev, void *data)
{ {
return dev->devt == (dev_t) (unsigned long) data; 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,15 +1239,10 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
if (ret) if (ret)
return ret; return ret;
} }
if ((uurb->endpoint & USB_ENDPOINT_DIR_MASK) != 0) { ep = ep_to_host_endpoint(ps->dev, uurb->endpoint);
is_in = 1;
ep = ps->dev->ep_in[uurb->endpoint & USB_ENDPOINT_NUMBER_MASK];
} else {
is_in = 0;
ep = ps->dev->ep_out[uurb->endpoint & USB_ENDPOINT_NUMBER_MASK];
}
if (!ep) if (!ep)
return -ENOENT; return -ENOENT;
is_in = (uurb->endpoint & USB_ENDPOINT_DIR_MASK) != 0;
u = 0; u = 0;
switch(uurb->type) { switch(uurb->type) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment