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

Commit 8673b853 authored by Mayank Rana's avatar Mayank Rana
Browse files

usb: gadget: diag: Use controller's driver ZLP support on IN endpoint



Currently usb diag function driver is explicitly queueing ZLP request
when size of buffer (i.e. req->legth) is equal to endpoint's maxpacket
size (i.e. ep->maxpacket). USB controller driver does support ZLP
functionality if req->zero is set to true. Hence use this functionality
and remove explicitly queueing ZLP request from USB diag driver.

Change-Id: I224474c6e07b9153da56fafc04d5d04abb8e246b
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 13ce0881
Loading
Loading
Loading
Loading
+3 −15
Original line number Diff line number Diff line
@@ -307,21 +307,8 @@ static void diag_write_complete(struct usb_ep *ep,

	ctxt->dpkts_tolaptop_pending--;

	if (!req->status) {
		if ((req->length >= ep->maxpacket) &&
				((req->length % ep->maxpacket) == 0)) {
			ctxt->dpkts_tolaptop_pending++;
			req->length = 0;
			d_req->actual = req->actual;
			d_req->status = req->status;
			/* Queue zero length packet */
			if (!usb_ep_queue(ctxt->in, req, GFP_ATOMIC))
				return;
			ctxt->dpkts_tolaptop_pending--;
		} else {
	if (!req->status)
		ctxt->dpkts_tolaptop++;
		}
	}

	spin_lock_irqsave(&ctxt->lock, flags);
	list_add_tail(&req->list, &ctxt->write_pool);
@@ -481,6 +468,7 @@ int usb_diag_alloc_req(struct usb_diag_ch *ch, int n_write, int n_read)
			goto fail;
		kmemleak_not_leak(req);
		req->complete = diag_write_complete;
		req->zero = true;
		list_add_tail(&req->list, &ctxt->write_pool);
	}