diff options
-rw-r--r-- | drivers/usb/core/message.c | 3 | ||||
-rw-r--r-- | drivers/usb/core/urb.c | 3 | ||||
-rw-r--r-- | include/linux/usb.h | 8 |
3 files changed, 10 insertions, 4 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 79d1cdf4a635..d8329eb47d4f 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -226,8 +226,7 @@ int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, | |||
226 | struct urb *urb; | 226 | struct urb *urb; |
227 | struct usb_host_endpoint *ep; | 227 | struct usb_host_endpoint *ep; |
228 | 228 | ||
229 | ep = (usb_pipein(pipe) ? usb_dev->ep_in : usb_dev->ep_out) | 229 | ep = usb_pipe_endpoint(usb_dev, pipe); |
230 | [usb_pipeendpoint(pipe)]; | ||
231 | if (!ep || len < 0) | 230 | if (!ep || len < 0) |
232 | return -EINVAL; | 231 | return -EINVAL; |
233 | 232 | ||
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index a760e46871c5..7c0555548ac8 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -308,8 +308,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
308 | * will be required to set urb->ep directly and we will eliminate | 308 | * will be required to set urb->ep directly and we will eliminate |
309 | * urb->pipe. | 309 | * urb->pipe. |
310 | */ | 310 | */ |
311 | ep = (usb_pipein(urb->pipe) ? dev->ep_in : dev->ep_out) | 311 | ep = usb_pipe_endpoint(dev, urb->pipe); |
312 | [usb_pipeendpoint(urb->pipe)]; | ||
313 | if (!ep) | 312 | if (!ep) |
314 | return -ENOENT; | 313 | return -ENOENT; |
315 | 314 | ||
diff --git a/include/linux/usb.h b/include/linux/usb.h index 1eb4762d9ea8..fd7d61e58198 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -1552,6 +1552,14 @@ static inline unsigned int __create_pipe(struct usb_device *dev, | |||
1552 | #define usb_rcvintpipe(dev,endpoint) \ | 1552 | #define usb_rcvintpipe(dev,endpoint) \ |
1553 | ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) | 1553 | ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) |
1554 | 1554 | ||
1555 | static inline struct usb_host_endpoint * | ||
1556 | usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe) | ||
1557 | { | ||
1558 | struct usb_host_endpoint **eps; | ||
1559 | eps = usb_pipein(pipe) ? dev->ep_in : dev->ep_out; | ||
1560 | return eps[usb_pipeendpoint(pipe)]; | ||
1561 | } | ||
1562 | |||
1555 | /*-------------------------------------------------------------------------*/ | 1563 | /*-------------------------------------------------------------------------*/ |
1556 | 1564 | ||
1557 | static inline __u16 | 1565 | static inline __u16 |