Rework the body of usb_maxpacket() in order not to reinvent the wheel and just rely on the usb_pipe_endpoint() helper function instead. Signed-off-by: Vincent Mailhol <mailhol.vincent@xxxxxxxxxx> --- include/linux/usb.h | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/include/linux/usb.h b/include/linux/usb.h index 8127782aa7a1..653d34ff0999 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -1971,19 +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]; - - if (!ep) - return 0; - - /* NOTE: only 0x07ff bits are for packet size... */ - return usb_endpoint_maxp(&ep->desc); + return usb_endpoint_maxp(&usb_pipe_endpoint(udev, pipe)->desc); } /* translate USB error codes to codes user space understands */ -- 2.34.1