Author: janderwald Date: Tue Feb 14 19:04:23 2012 New Revision: 55594
URL: http://svn.reactos.org/svn/reactos?rev=55594&view=rev Log: [USBEHCI] [USBOHCI] - Do not queue a work item twice
Modified: trunk/reactos/drivers/usb/usbehci/hardware.cpp trunk/reactos/drivers/usb/usbohci/hardware.cpp
Modified: trunk/reactos/drivers/usb/usbehci/hardware.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/hardwar... ============================================================================== --- trunk/reactos/drivers/usb/usbehci/hardware.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbehci/hardware.cpp [iso-8859-1] Tue Feb 14 19:04:23 2012 @@ -1377,7 +1377,7 @@ IN PVOID SystemArgument2) { CUSBHardwareDevice *This; - ULONG CStatus, PortStatus, PortCount, i, ShouldRingDoorBell; + ULONG CStatus, PortStatus, PortCount, i, ShouldRingDoorBell, QueueSCEWorkItem; NTSTATUS Status = STATUS_SUCCESS; EHCI_USBCMD_CONTENT UsbCmd;
@@ -1462,10 +1462,10 @@ This->GetDeviceDetails(NULL, NULL, &PortCount, NULL); if (CStatus & EHCI_STS_PCD) { + QueueSCEWorkItem = FALSE; for (i = 0; i < PortCount; i++) { PortStatus = This->EHCI_READ_REGISTER_ULONG(EHCI_PORTSC + (4 * i)); - // // Device connected or removed // @@ -1492,27 +1492,33 @@ continue; } } + + // + // work to do + // + QueueSCEWorkItem = TRUE; } else { DPRINT1("Device disconnected on port %d\n", i); + + // + // work to do + // + QueueSCEWorkItem = TRUE; } - - // - // is there a status change callback - // - if (This->m_SCECallBack != NULL) - { - // - // queue work item for processing - // - ExQueueWorkItem(&This->m_StatusChangeWorkItem, DelayedWorkQueue); - } - - // - // FIXME: This needs to be saved somewhere - // } + } + + // + // is there a status change callback and a high speed device connected / disconnected + // + if (QueueSCEWorkItem && This->m_SCECallBack != NULL) + { + // + // queue work item for processing + // + ExQueueWorkItem(&This->m_StatusChangeWorkItem, DelayedWorkQueue); } } return;
Modified: trunk/reactos/drivers/usb/usbohci/hardware.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbohci/hardwar... ============================================================================== --- trunk/reactos/drivers/usb/usbohci/hardware.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbohci/hardware.cpp [iso-8859-1] Tue Feb 14 19:04:23 2012 @@ -1589,7 +1589,7 @@ { CUSBHardwareDevice *This; ULONG CStatus, Index, PortStatus; - ULONG DoneHead; + ULONG DoneHead, QueueSCEWorkItem;
// // get parameters @@ -1612,6 +1612,7 @@ // // device connected, lets check which port // + QueueSCEWorkItem = FALSE; for(Index = 0; Index < This->m_NumberOfPorts; Index++) { // @@ -1648,20 +1649,23 @@ }
// - // is there a status change callback + // work to do // - if (This->m_SCECallBack != NULL) - { - // - // queue work item for processing - // - ExQueueWorkItem(&This->m_StatusChangeWorkItem, DelayedWorkQueue); - } + QueueSCEWorkItem = TRUE; } } - } - - + + // + // is there a status change callback and a device connected / disconnected + // + if (QueueSCEWorkItem && This->m_SCECallBack != NULL) + { + // + // queue work item for processing + // + ExQueueWorkItem(&This->m_StatusChangeWorkItem, DelayedWorkQueue); + } + } }
VOID