mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
[PORTCLS] Don't unnecessarily wait for lower drivers to complete power IRPs. CORE-16611
Also use PoCallDriver to forward power IRPs.
This commit is contained in:
parent
e884290d29
commit
606c912aa4
1 changed files with 16 additions and 39 deletions
|
@ -221,26 +221,17 @@ PortClsPower(
|
||||||
// get currrent stack location
|
// get currrent stack location
|
||||||
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
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
|
|
||||||
PoStartNextPowerIrp(Irp);
|
|
||||||
|
|
||||||
// complete request
|
|
||||||
Irp->IoStatus.Status = Status;
|
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
|
||||||
|
|
||||||
// done
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// get device extension
|
// get device extension
|
||||||
DeviceExtension = (PPCLASS_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
|
DeviceExtension = (PPCLASS_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
|
if (IoStack->MinorFunction != IRP_MN_SET_POWER && IoStack->MinorFunction != IRP_MN_QUERY_POWER)
|
||||||
|
{
|
||||||
|
// forward unknown requests down the stack and forget
|
||||||
|
PoStartNextPowerIrp(Irp);
|
||||||
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
|
return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp);
|
||||||
|
}
|
||||||
|
|
||||||
// get current request type
|
// get current request type
|
||||||
if (IoStack->Parameters.Power.Type == DevicePowerState)
|
if (IoStack->Parameters.Power.Type == DevicePowerState)
|
||||||
{
|
{
|
||||||
|
@ -250,8 +241,10 @@ PortClsPower(
|
||||||
// nothing has changed
|
// nothing has changed
|
||||||
if (IoStack->MinorFunction == IRP_MN_QUERY_POWER)
|
if (IoStack->MinorFunction == IRP_MN_QUERY_POWER)
|
||||||
{
|
{
|
||||||
// only forward query requests
|
// only forward query requests; we can forget about them
|
||||||
Status = PcForwardIrpSynchronous(DeviceObject, Irp);
|
PoStartNextPowerIrp(Irp);
|
||||||
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
|
return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// start next power irp
|
// start next power irp
|
||||||
|
@ -279,17 +272,9 @@ PortClsPower(
|
||||||
}
|
}
|
||||||
|
|
||||||
// only forward query requests
|
// only forward query requests
|
||||||
PcForwardIrpSynchronous(DeviceObject, Irp);
|
|
||||||
|
|
||||||
// start next power irp
|
|
||||||
PoStartNextPowerIrp(Irp);
|
PoStartNextPowerIrp(Irp);
|
||||||
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
// complete request
|
return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp);
|
||||||
Irp->IoStatus.Status = Status;
|
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
|
||||||
|
|
||||||
// done
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -371,17 +356,9 @@ PortClsPower(
|
||||||
DeviceExtension->SystemPowerState = IoStack->Parameters.Power.State.SystemState;
|
DeviceExtension->SystemPowerState = IoStack->Parameters.Power.State.SystemState;
|
||||||
|
|
||||||
// only forward query requests
|
// only forward query requests
|
||||||
Status = PcForwardIrpSynchronous(DeviceObject, Irp);
|
|
||||||
|
|
||||||
// start next power irp
|
|
||||||
PoStartNextPowerIrp(Irp);
|
PoStartNextPowerIrp(Irp);
|
||||||
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
// complete request
|
return PoCallDriver(DeviceExtension->PrevDeviceObject, Irp);
|
||||||
Irp->IoStatus.Status = Status;
|
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
|
||||||
|
|
||||||
// done
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue