From 25abad6a0584c3c08e2859738d23cbc53597179d Mon Sep 17 00:00:00 2001 From: Felipe Balbi Date: Tue, 14 Aug 2018 10:41:19 +0300 Subject: usb: dwc3: gadget: return errors from __dwc3_gadget_start_isoc() Sometimes, errors happen when kicking transfers from __dwc3_gadget_start_isoc(). In those cases, we need to pass along the error so gadget driver can make informed decisions. Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/gadget.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index a61bc9928a1a..7e0f8ff5946d 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1308,7 +1308,7 @@ static int __dwc3_gadget_get_frame(struct dwc3 *dwc) * Synopsys STAR 9001202023: Wrong microframe number for isochronous IN * endpoints. */ -static void dwc3_gadget_start_isoc_quirk(struct dwc3_ep *dep) +static int dwc3_gadget_start_isoc_quirk(struct dwc3_ep *dep) { int cmd_status = 0; bool test0; @@ -1338,7 +1338,7 @@ static void dwc3_gadget_start_isoc_quirk(struct dwc3_ep *dep) if (cmd_status && cmd_status != -EAGAIN) { dep->start_cmd_status = 0; dep->combo_num = 0; - return; + return 0; } /* Store the first test status */ @@ -1353,7 +1353,7 @@ static void dwc3_gadget_start_isoc_quirk(struct dwc3_ep *dep) */ if (cmd_status == 0) { dwc3_stop_active_transfer(dep, true); - return; + return 0; } } @@ -1378,10 +1378,10 @@ static void dwc3_gadget_start_isoc_quirk(struct dwc3_ep *dep) dep->start_cmd_status = 0; dep->combo_num = 0; - __dwc3_gadget_kick_transfer(dep); + return __dwc3_gadget_kick_transfer(dep); } -static void __dwc3_gadget_start_isoc(struct dwc3_ep *dep) +static int __dwc3_gadget_start_isoc(struct dwc3_ep *dep) { struct dwc3 *dwc = dep->dwc; @@ -1389,7 +1389,7 @@ static void __dwc3_gadget_start_isoc(struct dwc3_ep *dep) dev_info(dep->dwc->dev, "%s: ran out of requests\n", dep->name); dep->flags |= DWC3_EP_PENDING_REQUEST; - return; + return -EAGAIN; } if (!dwc->dis_start_transfer_quirk && dwc3_is_usb31(dwc) && @@ -1398,14 +1398,12 @@ static void __dwc3_gadget_start_isoc(struct dwc3_ep *dep) dwc->version_type >= DWC31_VERSIONTYPE_EA01 && dwc->version_type <= DWC31_VERSIONTYPE_EA06))) { - if (dwc->gadget.speed <= USB_SPEED_HIGH && dep->direction) { - dwc3_gadget_start_isoc_quirk(dep); - return; - } + if (dwc->gadget.speed <= USB_SPEED_HIGH && dep->direction) + return dwc3_gadget_start_isoc_quirk(dep); } dep->frame_number = DWC3_ALIGN_FRAME(dep); - __dwc3_gadget_kick_transfer(dep); + return __dwc3_gadget_kick_transfer(dep); } static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) @@ -1446,8 +1444,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) if ((dep->flags & DWC3_EP_PENDING_REQUEST)) { if (!(dep->flags & DWC3_EP_TRANSFER_STARTED)) { - __dwc3_gadget_start_isoc(dep); - return 0; + return __dwc3_gadget_start_isoc(dep); } } } @@ -2513,7 +2510,7 @@ static void dwc3_gadget_endpoint_transfer_not_ready(struct dwc3_ep *dep, const struct dwc3_event_depevt *event) { dwc3_gadget_endpoint_frame_from_event(dep, event); - __dwc3_gadget_start_isoc(dep); + (void) __dwc3_gadget_start_isoc(dep); } static void dwc3_endpoint_interrupt(struct dwc3 *dwc, -- cgit v1.2.3