Commit a8f32817 authored by Felipe Balbi's avatar Felipe Balbi

usb: dwc3: gadget: improve ep_queue's error reporting

We shouldn't return -EBUSY, that's used only internally
when the core still has transfers in flight on a given
endpoint.

Also, combine the error reporting so that we don't have
to duplicate it.
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 89185916
...@@ -1080,10 +1080,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) ...@@ -1080,10 +1080,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
if (!usb_endpoint_xfer_isoc(dep->endpoint.desc) && if (!usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
!(dep->flags & DWC3_EP_BUSY)) { !(dep->flags & DWC3_EP_BUSY)) {
ret = __dwc3_gadget_kick_transfer(dep, 0, true); ret = __dwc3_gadget_kick_transfer(dep, 0, true);
if (ret && ret != -EBUSY) goto out;
dev_dbg(dwc->dev, "%s: failed to kick transfers\n",
dep->name);
return ret;
} }
/* /*
...@@ -1113,14 +1110,10 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) ...@@ -1113,14 +1110,10 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
} }
ret = __dwc3_gadget_kick_transfer(dep, 0, true); ret = __dwc3_gadget_kick_transfer(dep, 0, true);
if (ret && ret != -EBUSY)
dev_dbg(dwc->dev, "%s: failed to kick transfers\n",
dep->name);
if (!ret) if (!ret)
dep->flags &= ~DWC3_EP_PENDING_REQUEST; dep->flags &= ~DWC3_EP_PENDING_REQUEST;
return ret; goto out;
} }
/* /*
...@@ -1134,10 +1127,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) ...@@ -1134,10 +1127,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
WARN_ON_ONCE(!dep->resource_index); WARN_ON_ONCE(!dep->resource_index);
ret = __dwc3_gadget_kick_transfer(dep, dep->resource_index, ret = __dwc3_gadget_kick_transfer(dep, dep->resource_index,
false); false);
if (ret && ret != -EBUSY) goto out;
dev_dbg(dwc->dev, "%s: failed to kick transfers\n",
dep->name);
return ret;
} }
/* /*
...@@ -1145,14 +1135,17 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) ...@@ -1145,14 +1135,17 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
* right away, otherwise host will not know we have streams to be * right away, otherwise host will not know we have streams to be
* handled. * handled.
*/ */
if (dep->stream_capable) { if (dep->stream_capable)
ret = __dwc3_gadget_kick_transfer(dep, 0, true); ret = __dwc3_gadget_kick_transfer(dep, 0, true);
out:
if (ret && ret != -EBUSY) if (ret && ret != -EBUSY)
dev_dbg(dwc->dev, "%s: failed to kick transfers\n", dev_dbg(dwc->dev, "%s: failed to kick transfers\n",
dep->name); dep->name);
} if (ret == -EBUSY)
ret = 0;
return 0; return ret;
} }
static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request, static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment