Skip to content

Commit c42a5da

Browse files
committed
OnD0Exit: Close EC handle before sleep
When suspending (D0 exit) close the handle to the EC driver so that we open it again after resume and get a fresh one. Because if the EC driver restarts during sleep, we cannot keep using the old handle pointing to the unloaded driver. This change just closes it, re-opening is already handled in OnTimerExpire when the device wakes. This fixes the HLK "DF - Sleep with IO during (Reliability)" test failure. Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 9d48c55 commit c42a5da

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

FrameworkSensors/Device.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,13 @@ OnD0Exit(
479479
goto Exit;
480480
}
481481

482+
// Close EC handle before sleep to avoid stale handles after wake.
483+
// The handle will be re-acquired in OnTimerExpire when the device wakes.
484+
if (pDevice->m_CrosEcHandle != INVALID_HANDLE_VALUE) {
485+
CloseHandle(pDevice->m_CrosEcHandle);
486+
pDevice->m_CrosEcHandle = INVALID_HANDLE_VALUE;
487+
}
488+
482489
pDevice->m_PoweredOn = FALSE;
483490
InitPropVariantFromUInt32(SensorState_Idle,
484491
&(pDevice->m_pProperties->List[SENSOR_COMMON_PROPERTY_STATE].Value));

0 commit comments

Comments
 (0)