[1/5] usb: dwc3: ep0: use _roundup_ to calculate the transfer size
diff mbox

Message ID 1433927932-32395-2-git-send-email-kishon@ti.com
State New
Headers show

Commit Message

Kishon Vijay Abraham I June 10, 2015, 9:18 a.m. UTC
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>
---
 drivers/usb/dwc3/ep0.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Felipe Balbi July 6, 2015, 7 p.m. UTC | #1
On Wed, Jun 10, 2015 at 02:48:48PM +0530, Kishon Vijay Abraham I wrote:
> 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>

doesn't apply, can you rebase on testing/next ?
Kishon Vijay Abraham I July 10, 2015, 2:59 p.m. UTC | #2
Hi Felipe,

On Tuesday 07 July 2015 12:30 AM, Felipe Balbi wrote:
> On Wed, Jun 10, 2015 at 02:48:48PM +0530, Kishon Vijay Abraham I wrote:
>> 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>
> 
> doesn't apply, can you rebase on testing/next ?

sure, will send it by early next week.

Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 8858c60..713e46a 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -812,10 +812,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)