From ac350411c7402d3a25a7bddfdd3c489a3f372fd8 Mon Sep 17 00:00:00 2001 From: Li Jun Date: Wed, 13 Feb 2019 14:26:13 +0800 Subject: [PATCH] MLK-20909 usb: dwc3: gadget: use usb_endpoint_maxp for req length As endpoint.maxpackt is set at init for super speed, we can't use it for USB2 connection, we need use the right max packet length according to connection speed. Signed-off-by: Li Jun (cherry picked from commit 9c6bb3684649b4ae6f0275b5ad3799ea5c8f32df) --- drivers/usb/dwc3/gadget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index e3c46b2..2727126 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -968,8 +968,8 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) * so HACK the request length */ if (dep->direction == 0 && - req->request.length < dep->endpoint.maxpacket) - req->request.length = dep->endpoint.maxpacket; + req->request.length < usb_endpoint_maxp(dep->endpoint.desc)) + req->request.length = usb_endpoint_maxp(dep->endpoint.desc); /* * We only add to our list of requests now and -- 1.9.1