
27 Jul
2012
27 Jul
'12
4:07 p.m.
Dear Benoît Thébaudeau,
[...]
@@ -229,8 +230,23 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer, le16_to_cpu(req->value), le16_to_cpu(req->value), le16_to_cpu(req->index));
- if (req != NULL) /* SETUP + ACK */
qtd_count += 1 + 1;
- if (length > 0 || req == NULL) { /* buffer */
if ((uint32_t)buffer & 4095) /* page-unaligned */
qtd_count += DIV_ROUND_UP(((uint32_t)buffer & 4095) +
length, (QT_BUFFER_CNT - 1) * 4096);
else /* page-aligned */
qtd_count += DIV_ROUND_UP(length, QT_BUFFER_CNT * 4096);
- }
Ok, now I almost see it.
- qtd = memalign(USB_DMA_MINALIGN, qtd_count * sizeof(struct qTD));
- if (qtd == NULL) {
printf("unable to allocate TDs\n");
return -1;
- }
- memset(qh, 0, sizeof(struct QH));
- memset(qtd, 0, 3 * sizeof(*qtd));
memset(qtd, 0, qtd_count * sizeof(*qtd));
toggle = usb_gettoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe));
[...]
I'm cool with the rest, I'll think about the calculation a bit though, since I'm not certain about it right away and let you know. Will you be submitting the series again or shall I just merge 3/5 and 4/5, apply this one and be done with it?
Best regards, Marek Vasut