mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
b18a23495f
commit
fe54b058de
3 changed files with 10 additions and 4 deletions
|
|
@ -226,8 +226,7 @@ int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
|
|||
struct urb *urb;
|
||||
struct usb_host_endpoint *ep;
|
||||
|
||||
ep = (usb_pipein(pipe) ? usb_dev->ep_in : usb_dev->ep_out)
|
||||
[usb_pipeendpoint(pipe)];
|
||||
ep = usb_pipe_endpoint(usb_dev, pipe);
|
||||
if (!ep || len < 0)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
|
|||
|
|
@ -308,8 +308,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
|
|||
* will be required to set urb->ep directly and we will eliminate
|
||||
* urb->pipe.
|
||||
*/
|
||||
ep = (usb_pipein(urb->pipe) ? dev->ep_in : dev->ep_out)
|
||||
[usb_pipeendpoint(urb->pipe)];
|
||||
ep = usb_pipe_endpoint(dev, urb->pipe);
|
||||
if (!ep)
|
||||
return -ENOENT;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue