Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f38e35dd authored by Felipe Balbi's avatar Felipe Balbi
Browse files

usb: dwc3: gadget: split dwc3_gadget_ep_cleanup_completed_requests()



No functional changes, it just makes the code slightly easier to read.

Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 6d9d22da
Loading
Loading
Loading
Loading
+36 −24
Original line number Diff line number Diff line
@@ -2308,13 +2308,10 @@ static bool dwc3_gadget_ep_request_completed(struct dwc3_request *req)
	return req->request.actual == req->request.length;
}

static void dwc3_gadget_ep_cleanup_completed_requests(struct dwc3_ep *dep,
		const struct dwc3_event_depevt *event, int status)
static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
		const struct dwc3_event_depevt *event,
		struct dwc3_request *req, int status)
{
	struct dwc3_request	*req;
	struct dwc3_request	*tmp;

	list_for_each_entry_safe(req, tmp, &dep->started_list, list) {
	int ret;

	if (req->num_pending_sgs)
@@ -2333,14 +2330,29 @@ static void dwc3_gadget_ep_cleanup_completed_requests(struct dwc3_ep *dep,

	req->request.actual = req->request.length - req->remaining;

		if (!dwc3_gadget_ep_request_completed(req) ||
	if (!dwc3_gadget_ep_request_completed(req) &&
			req->num_pending_sgs) {
		__dwc3_gadget_kick_transfer(dep);
			break;
		goto out;
	}

	dwc3_gadget_giveback(dep, req, status);

out:
	return ret;
}

static void dwc3_gadget_ep_cleanup_completed_requests(struct dwc3_ep *dep,
		const struct dwc3_event_depevt *event, int status)
{
	struct dwc3_request	*req;
	struct dwc3_request	*tmp;

	list_for_each_entry_safe(req, tmp, &dep->started_list, list) {
		int ret;

		ret = dwc3_gadget_ep_cleanup_completed_request(dep, event,
				req, status);
		if (ret)
			break;
	}