summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2015-07-27 12:25:28 +0530
committerFelipe Balbi <balbi@ti.com>2015-07-30 11:43:34 -0500
commit2e5464da4e7dc55e1751d2beb3e6e78f35020756 (patch)
tree9c986cb519d8fadc3f3fd3f2e7eeca8af84f804a /drivers/usb/dwc3
parentb2fb5b1a0f50d3ebc12342c8d8dead245e9c9d4e (diff)
downloadlinux-2e5464da4e7dc55e1751d2beb3e6e78f35020756.tar.bz2
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: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/ep0.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 06ecd1e6871c..672d55a6d598 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -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)