Commit bdddc253 authored by Vincent Mailhol's avatar Vincent Mailhol Committed by Greg Kroah-Hartman

usb: rework usb_maxpacket() using usb_pipe_endpoint()

Rework the body of usb_maxpacket() and just rely on the
usb_pipe_endpoint() helper function to retrieve the host endpoint
instead of doing it by hand.
Signed-off-by: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/r/20220317035514.6378-10-mailhol.vincent@wanadoo.frSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2ddf7617
...@@ -1971,13 +1971,7 @@ usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe) ...@@ -1971,13 +1971,7 @@ usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe)
static inline u16 usb_maxpacket(struct usb_device *udev, int pipe) static inline u16 usb_maxpacket(struct usb_device *udev, int pipe)
{ {
struct usb_host_endpoint *ep; struct usb_host_endpoint *ep = usb_pipe_endpoint(udev, pipe);
unsigned epnum = usb_pipeendpoint(pipe);
if (usb_pipeout(pipe))
ep = udev->ep_out[epnum];
else
ep = udev->ep_in[epnum];
if (!ep) if (!ep)
return 0; return 0;
......
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