From 9bc8951dc9b5a74d90e009ecf6946f4908cb3ad5 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 11 May 2009 23:37:30 +0000 Subject: [PATCH] * Simplify the way fragmented transfers are resubmited. * This also paves the way for a different way to handle transfer freeing. * Also fixes that errors in reappending would previously not be propagated to the caller. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30712 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/busses/usb/uhci.cpp | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/add-ons/kernel/busses/usb/uhci.cpp b/src/add-ons/kernel/busses/usb/uhci.cpp index 44afc4d079..44cf613e2e 100644 --- a/src/add-ons/kernel/busses/usb/uhci.cpp +++ b/src/add-ons/kernel/busses/usb/uhci.cpp @@ -1361,31 +1361,20 @@ UHCI::FinishTransfers() TRACE("still %ld bytes left on transfer\n", transfer->transfer->VectorLength()); + Transfer *resubmit = transfer->transfer; + // free the used descriptors transfer->queue->RemoveTransfer(transfer->transfer_queue); FreeDescriptorChain(transfer->first_descriptor); // resubmit the advanced transfer so the rest // of the buffers are transmitted over the bus - transfer->transfer->PrepareKernelAccess(); - status_t result = CreateFilledTransfer(transfer->transfer, - &transfer->first_descriptor, - &transfer->transfer_queue); - transfer->data_descriptor = transfer->first_descriptor; - if (result == B_OK && Lock()) { - // reappend the transfer - if (fLastTransfer) - fLastTransfer->link = transfer; - if (!fFirstTransfer) - fFirstTransfer = transfer; + resubmit->PrepareKernelAccess(); + if (SubmitTransfer(resubmit) != B_OK) + resubmit->Finished(B_ERROR, 0); - fLastTransfer = transfer; - Unlock(); - - transfer->queue->AppendTransfer(transfer->transfer_queue); - transfer = next; - continue; - } + transfer = next; + continue; } // the transfer is done, but we already set the