https://git.reactos.org/?p=reactos.git;a=commitdiff;h=606c912aa45b84e346de14181e7fdd433d9db667
commit 606c912aa45b84e346de14181e7fdd433d9db667 Author: Thomas Faber <[email protected]> AuthorDate: Sat Feb 1 13:03:37 2020 +0100 Commit: Thomas Faber <[email protected]> CommitDate: Sat Feb 8 13:07:34 2020 +0100 [PORTCLS] Don't unnecessarily wait for lower drivers to complete power IRPs. CORE-16611 Also use PoCallDriver to forward power IRPs. --- drivers/wdm/audio/backpln/portcls/irp.cpp | 51 +++++++++---------------------- 1 file changed, 14 insertions(+), 37 deletions(-) diff --git a/drivers/wdm/audio/backpln/portcls/irp.cpp b/drivers/wdm/audio/backpln/portcls/irp.cpp index aab59ca31fc..c1708c416c6 100644 --- a/drivers/wdm/audio/backpln/portcls/irp.cpp +++ b/drivers/wdm/audio/backpln/portcls/irp.cpp @@ -221,26 +221,17 @@ PortClsPower( // get currrent stack location IoStack = IoGetCurrentIrpStackLocation(Irp); + // get device extension + DeviceExtension = (PPCLASS_DEVICE_EXTENSION) DeviceObject->DeviceExtension; + if (IoStack->MinorFunction != IRP_MN_SET_POWER && IoStack->MinorFunction != IRP_MN_QUERY_POWER) { - // just forward the request - Status = PcForwardIrpSynchronous(DeviceObject, Irp); - - // start next power irp + // forward unknown requests down the stack and forget PoStartNextPowerIrp(Irp); - - // complete request - Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - // done - return Status; + IoSkipCurrentIrpStackLocation(Irp); + return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp); } - - // get device extension - DeviceExtension = (PPCLASS_DEVICE_EXTENSION) DeviceObject->DeviceExtension; - // get current request type if (IoStack->Parameters.Power.Type == DevicePowerState) { @@ -250,8 +241,10 @@ PortClsPower( // nothing has changed if (IoStack->MinorFunction == IRP_MN_QUERY_POWER) { - // only forward query requests - Status = PcForwardIrpSynchronous(DeviceObject, Irp); + // only forward query requests; we can forget about them + PoStartNextPowerIrp(Irp); + IoSkipCurrentIrpStackLocation(Irp); + return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp); } // start next power irp @@ -279,17 +272,9 @@ PortClsPower( } // only forward query requests - PcForwardIrpSynchronous(DeviceObject, Irp); - - // start next power irp PoStartNextPowerIrp(Irp); - - // complete request - Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - // done - return Status; + IoSkipCurrentIrpStackLocation(Irp); + return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp); } else { @@ -371,17 +356,9 @@ PortClsPower( DeviceExtension->SystemPowerState = IoStack->Parameters.Power.State.SystemState; // only forward query requests - Status = PcForwardIrpSynchronous(DeviceObject, Irp); - - // start next power irp PoStartNextPowerIrp(Irp); - - // complete request - Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - // done - return Status; + IoSkipCurrentIrpStackLocation(Irp); + return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp); } } }
