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

Commit 2e5464da authored by Kishon Vijay Abraham I's avatar Kishon Vijay Abraham I Committed by Felipe Balbi
Browse files

usb: dwc3: ep0: use _roundup_ to calculate the transfer size



No functional change. Used _roundup_ macro to calculate the transfer
size aligned to maxpacket in  dwc3_ep0_complete_data. It also makes it
similar to how transfer size is calculated in __dwc3_ep0_do_control_data.

Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent b2fb5b1a
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -816,10 +816,8 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
	length = trb->size & DWC3_TRB_SIZE_MASK;
	length = trb->size & DWC3_TRB_SIZE_MASK;


	if (dwc->ep0_bounced) {
	if (dwc->ep0_bounced) {
		unsigned transfer_size = ur->length;
		unsigned maxp = ep0->endpoint.maxpacket;
		unsigned maxp = ep0->endpoint.maxpacket;

		unsigned transfer_size = roundup(ur->length, maxp);
		transfer_size += (maxp - (transfer_size % maxp));


		/* Maximum of DWC3_EP0_BOUNCE_SIZE can only be received */
		/* Maximum of DWC3_EP0_BOUNCE_SIZE can only be received */
		if (transfer_size > DWC3_EP0_BOUNCE_SIZE)
		if (transfer_size > DWC3_EP0_BOUNCE_SIZE)