Commit 8d7c39d3e8ad43dab3158220f3347186e6f1aa66

Authored by Stephen Warren
Committed by Marek Vasut
1 parent d7beeb9358

usb: ci_udc: don't assume QTDs are adjacent when transmitting ZLPs

Fix ci_ep_submit_next_request()'s ZLP transmission code to explicitly
call ci_get_qtd() to find the address of the other QTD to use. This
will allow us to correctly align each QTD individually in the future,
which may involve leaving a gap between the QTDs.

Signed-off-by: Stephen Warren <swarren@nvidia.com>

Showing 1 changed file with 4 additions and 3 deletions Side-by-side Diff

drivers/usb/gadget/ci_udc.c
... ... @@ -404,10 +404,11 @@
404 404 * only 1 is used at a time since either an IN or an OUT but
405 405 * not both is queued. For an IN transaction, item currently
406 406 * points at the second of these items, so we know that we
407   - * can use (item - 1) to transmit the extra zero-length packet
  407 + * can use the other to transmit the extra zero-length packet.
408 408 */
409   - item->next = (unsigned)(item - 1);
410   - item--;
  409 + struct ept_queue_item *other_item = ci_get_qtd(num, 0);
  410 + item->next = (unsigned)other_item;
  411 + item = other_item;
411 412 item->info = INFO_ACTIVE;
412 413 }
413 414