History

usbfs: Add ep_to_host_endpoint helper function

Hans de Goede committed 13 years ago

Commit 2fec32b1 parent 948cd8c1 file · +11 −7Browse files

Unified · Split

drivers/usb/core/devio.c+11−7
@@ -769,6 +769,15 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, · 768 unmodified lines
769769 return ret;
770770 }
771771
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+
772781 static int match_devt(struct device *dev, void *data)
773782 {
774783 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, · 455 unmodified lines
12301239 if (ret)
12311240 return ret;
12321241 }
1233− if ((uurb->endpoint & USB_ENDPOINT_DIR_MASK) != 0) {
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− }
1242+ ep = ep_to_host_endpoint(ps->dev, uurb->endpoint);
12401243 if (!ep)
12411244 return -ENOENT;
1245+ is_in = (uurb->endpoint & USB_ENDPOINT_DIR_MASK) != 0;
12421246
12431247 u = 0;
12441248 switch(uurb->type) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t