diff options
author | Igor Kotrasinski <i.kotrasinsk@samsung.com> | 2015-09-15 16:55:31 +0200 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-09-21 14:42:36 -0500 |
commit | e42bd6a54b97e2a39b5004deac66a0fcd6ebbe75 (patch) | |
tree | ab00000e596530e458e386eb2c9ae1d863d8e4af /drivers/usb/gadget/udc/dummy_hcd.c | |
parent | 5dda5be9d501084e8a6242e6dbeb8eea1daf01c8 (diff) | |
download | op-kernel-dev-e42bd6a54b97e2a39b5004deac66a0fcd6ebbe75.zip op-kernel-dev-e42bd6a54b97e2a39b5004deac66a0fcd6ebbe75.tar.gz |
usb: gadget: dummy_hcd: fix rescan logic for transfer
transfer() schedules a rescan for transfers larger than
maxpacket, which is wrong for transfers that are multiples
of maxpacket.
Rewrite to fix and clarify packet multiple / remainder
transfer logic.
Signed-off-by: Igor Kotrasinski <i.kotrasinsk@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/udc/dummy_hcd.c')
-rw-r--r-- | drivers/usb/gadget/udc/dummy_hcd.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c index 69a0b3f..ab7e015 100644 --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c @@ -1385,12 +1385,15 @@ top: if (len == 0) break; - /* use an extra pass for the final short packet */ - if (len > ep->ep.maxpacket) { - rescan = 1; - len -= (len % ep->ep.maxpacket); + /* send multiple of maxpacket first, then remainder */ + if (len >= ep->ep.maxpacket) { + is_short = 0; + if (len % ep->ep.maxpacket) + rescan = 1; + len -= len % ep->ep.maxpacket; + } else { + is_short = 1; } - is_short = (len % ep->ep.maxpacket) != 0; len = dummy_perform_transfer(urb, req, len); |