https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5e15ba48b9ea8460a0929…
commit 5e15ba48b9ea8460a0929e4c2092c3137b1d811d
Author: Vadim Galyant <vgal(a)rambler.ru>
AuthorDate: Wed Nov 29 03:30:46 2017 +0900
Commit: Amine Khaldi <amine.khaldi(a)reactos.org>
CommitDate: Sun Jan 21 19:35:41 2018 +0100
[USBPORT] Add support for transaction translators in USBPORT_RemoveDevice().
---
drivers/usb/usbport/device.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/drivers/usb/usbport/device.c b/drivers/usb/usbport/device.c
index 7ba54f594e..ec6dbc33b3 100644
--- a/drivers/usb/usbport/device.c
+++ b/drivers/usb/usbport/device.c
@@ -1564,6 +1564,9 @@ USBPORT_RemoveDevice(IN PDEVICE_OBJECT FdoDevice,
IN ULONG Flags)
{
PUSBPORT_DEVICE_EXTENSION FdoExtension;
+ PUSB2_TT_EXTENSION TtExtension;
+ ULONG ix;
+ KIRQL OldIrql;
DPRINT("USBPORT_RemoveDevice: DeviceHandle - %p, Flags - %x\n",
DeviceHandle,
@@ -1623,6 +1626,37 @@ USBPORT_RemoveDevice(IN PDEVICE_OBJECT FdoDevice,
USBPORT_FreeUsbAddress(FdoDevice, DeviceHandle->DeviceAddress);
}
+ DPRINT("USBPORT_RemoveDevice: DeviceHandle->TtList.Flink - %p\n",
DeviceHandle->TtList.Flink);
+
+ while (!IsListEmpty(&DeviceHandle->TtList))
+ {
+ TtExtension = CONTAINING_RECORD(DeviceHandle->TtList.Flink,
+ USB2_TT_EXTENSION,
+ Link);
+
+ RemoveHeadList(&DeviceHandle->TtList);
+
+ DPRINT("USBPORT_RemoveDevice: TtExtension - %p\n", TtExtension);
+
+ KeAcquireSpinLock(&FdoExtension->TtSpinLock, &OldIrql);
+
+ TtExtension->Flags |= USB2_TT_EXTENSION_FLAG_DELETED;
+
+ if (IsListEmpty(&TtExtension->EndpointList))
+ {
+ USBPORT_UpdateAllocatedBwTt(TtExtension);
+
+ for (ix = 0; ix < USB2_FRAMES; ix++)
+ {
+ FdoExtension->Bandwidth[ix] += TtExtension->MaxBandwidth;
+ }
+
+ ExFreePool(TtExtension);
+ }
+
+ KeReleaseSpinLock(&FdoExtension->TtSpinLock, OldIrql);
+ }
+
KeReleaseSemaphore(&FdoExtension->DeviceSemaphore,
LOW_REALTIME_PRIORITY,
1,