]> git.baikalelectronics.ru Git - kernel.git/commitdiff
usb: rework usb_maxpacket() using usb_pipe_endpoint()
authorVincent Mailhol <mailhol.vincent@wanadoo.fr>
Thu, 17 Mar 2022 03:55:14 +0000 (12:55 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Apr 2022 08:33:53 +0000 (10:33 +0200)
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: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/r/20220317035514.6378-10-mailhol.vincent@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/usb.h

index 8127782aa7a17c47d76c37fb3c06f2ce3aa81fea..60bee864d8977759ce531aea55d534edeaa8e2a3 100644 (file)
@@ -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)
 {
-       struct usb_host_endpoint        *ep;
-       unsigned                        epnum = usb_pipeendpoint(pipe);
-
-       if (usb_pipeout(pipe))
-               ep = udev->ep_out[epnum];
-       else
-               ep = udev->ep_in[epnum];
+       struct usb_host_endpoint *ep = usb_pipe_endpoint(udev, pipe);
 
        if (!ep)
                return 0;