diff options
author | Matthew Wilcox <willy@linux.intel.com> | 2010-04-30 15:11:29 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-20 16:21:41 -0400 |
commit | fe54b058de9d1df5fef9e2a559651f4b7c9f04b1 (patch) | |
tree | 9ed1f427416478e8832f5ca67c17bd8433a87630 /include/linux/usb.h | |
parent | b18a23495fd4492081a61373fc3ef9f5c59e094a (diff) |
USB: Add a usb_pipe_endpoint() convenience function
Converting a pipe number to a struct usb_host_endpoint pointer is a little
messy. Introduce a new convenience function to hide the mess.
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r-- | include/linux/usb.h | 8 |
1 files changed, 8 insertions, 0 deletions
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 |