Skip to content

Commit

Permalink
usb: dwc3: ep0: use _roundup_ to calculate the transfer size
Browse files Browse the repository at this point in the history
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: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Kishon Vijay Abraham I authored and Felipe Balbi committed Jul 30, 2015
1 parent b2fb5b1 commit 2e5464d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/usb/dwc3/ep0.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,10 +816,8 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
length = trb->size & DWC3_TRB_SIZE_MASK;

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

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

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

0 comments on commit 2e5464d

Please sign in to comment.