From 65666555cadc83af7693f7d68b65bfc91cd0b042 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Tue, 14 Feb 2012 19:04:23 +0000 Subject: [PATCH] [USBEHCI] [USBOHCI] - Do not queue a work item twice svn path=/trunk/; revision=55594 --- reactos/drivers/usb/usbehci/hardware.cpp | 34 ++++++++++++++---------- reactos/drivers/usb/usbohci/hardware.cpp | 26 ++++++++++-------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/reactos/drivers/usb/usbehci/hardware.cpp b/reactos/drivers/usb/usbehci/hardware.cpp index ecc89515b09..8ee24e99e2f 100644 --- a/reactos/drivers/usb/usbehci/hardware.cpp +++ b/reactos/drivers/usb/usbehci/hardware.cpp @@ -1377,7 +1377,7 @@ EhciDefferedRoutine( 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 @@ EhciDefferedRoutine( 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,28 +1492,34 @@ EhciDefferedRoutine( continue; } } + + // + // work to do + // + QueueSCEWorkItem = TRUE; } else { DPRINT1("Device disconnected on port %d\n", i); - } - // - // is there a status change callback - // - if (This->m_SCECallBack != NULL) - { // - // queue work item for processing + // work to do // - ExQueueWorkItem(&This->m_StatusChangeWorkItem, DelayedWorkQueue); + QueueSCEWorkItem = TRUE; } - - // - // 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; } diff --git a/reactos/drivers/usb/usbohci/hardware.cpp b/reactos/drivers/usb/usbohci/hardware.cpp index 4bf6ccf6b49..8b30b5ca4ee 100644 --- a/reactos/drivers/usb/usbohci/hardware.cpp +++ b/reactos/drivers/usb/usbohci/hardware.cpp @@ -1589,7 +1589,7 @@ OhciDefferedRoutine( { CUSBHardwareDevice *This; ULONG CStatus, Index, PortStatus; - ULONG DoneHead; + ULONG DoneHead, QueueSCEWorkItem; // // get parameters @@ -1612,6 +1612,7 @@ OhciDefferedRoutine( // // device connected, lets check which port // + QueueSCEWorkItem = FALSE; for(Index = 0; Index < This->m_NumberOfPorts; Index++) { // @@ -1648,20 +1649,23 @@ OhciDefferedRoutine( } // - // 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 -- 2.17.1