diff mbox series

[v4,9/9] usb: rework usb_maxpacket() using usb_pipe_endpoint()

Message ID 20220317035514.6378-10-mailhol.vincent@wanadoo.fr
State New
Headers show
Series usb: rework usb_maxpacket() and remove its third argument | expand

Commit Message

Vincent MAILHOL March 17, 2022, 3:55 a.m. UTC
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>
---
 include/linux/usb.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/include/linux/usb.h b/include/linux/usb.h
index 8127782aa7a1..60bee864d897 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -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;