Commit 64e01080 authored by Felipe Balbi's avatar Felipe Balbi

usb: dwc3: gadget: simplify __dwc3_gadget_ep_queue()

There is more possibility for sharing code if we just realise that now
__dwc3_gadget_kic_transfer() knows to break out early if there are no
TRBs left.
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent ccb94ebf
...@@ -1290,7 +1290,6 @@ static void dwc3_gadget_start_isoc(struct dwc3 *dwc, ...@@ -1290,7 +1290,6 @@ static void dwc3_gadget_start_isoc(struct dwc3 *dwc,
static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
{ {
struct dwc3 *dwc = dep->dwc; struct dwc3 *dwc = dep->dwc;
int ret = 0;
if (!dep->endpoint.desc) { if (!dep->endpoint.desc) {
dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n", dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n",
...@@ -1337,24 +1336,14 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) ...@@ -1337,24 +1336,14 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
} }
if ((dep->flags & DWC3_EP_BUSY) && if ((dep->flags & DWC3_EP_BUSY) &&
!(dep->flags & DWC3_EP_MISSED_ISOC)) { !(dep->flags & DWC3_EP_MISSED_ISOC))
WARN_ON_ONCE(!dep->resource_index); goto out;
ret = __dwc3_gadget_kick_transfer(dep,
dep->resource_index);
}
goto out;
}
if (!dwc3_calc_trbs_left(dep))
return 0; return 0;
}
ret = __dwc3_gadget_kick_transfer(dep, 0);
out: out:
if (ret == -EBUSY) return __dwc3_gadget_kick_transfer(dep, 0);
ret = 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