Skip to content

Commit

Permalink
Auto hibernation: remove redundant pmset_default_mode checks in the w…
Browse files Browse the repository at this point in the history
…hile loop.
  • Loading branch information
leon9078 committed Apr 15, 2024
1 parent 512ddbb commit bb9555e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions HibernationFixup/kern_hbfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ IOReturn HBFX::X86PlatformPlugin_sleepPolicyHandler(void * target, IOPMSystemSle
if (callbackHBFX->sleepPhase > kIOPMSleepPhase0)
{
callbackHBFX->sleepServiceWake = false;
if (pmset_default_mode && standby_delay != 0 && !callbackHBFX->wakeCalendarSet && callbackHBFX->sleepPhase > kIOPMSleepPhase0)
if (standby_delay != 0 && !callbackHBFX->wakeCalendarSet && callbackHBFX->sleepPhase > kIOPMSleepPhase0)
callbackHBFX->explicitlyCallSetMaintenanceWakeCalendar();
}
break;
Expand All @@ -389,7 +389,7 @@ IOReturn HBFX::X86PlatformPlugin_sleepPolicyHandler(void * target, IOPMSystemSle
if (callbackHBFX->sleepPhase > kIOPMSleepPhase0)
{
callbackHBFX->sleepServiceWake = false;
if (pmset_default_mode && standby_delay != 0 && !callbackHBFX->wakeCalendarSet && callbackHBFX->sleepPhase > kIOPMSleepPhase0)
if (standby_delay != 0 && !callbackHBFX->wakeCalendarSet && callbackHBFX->sleepPhase > kIOPMSleepPhase0)
callbackHBFX->explicitlyCallSetMaintenanceWakeCalendar();
}
break;
Expand Down Expand Up @@ -425,15 +425,15 @@ IOReturn HBFX::X86PlatformPlugin_sleepPolicyHandler(void * target, IOPMSystemSle
if (callbackHBFX->sleepPhase > kIOPMSleepPhase0)
{
callbackHBFX->sleepServiceWake = false;
if (pmset_default_mode && standby_delay != 0 && !callbackHBFX->wakeCalendarSet && callbackHBFX->sleepPhase > kIOPMSleepPhase0)
if (standby_delay != 0 && !callbackHBFX->wakeCalendarSet && callbackHBFX->sleepPhase > kIOPMSleepPhase0)
callbackHBFX->explicitlyCallSetMaintenanceWakeCalendar();
}
break;
}

if (callbackHBFX->sleepPhase > kIOPMSleepPhase0)
{
if (pmset_default_mode && standby_delay != 0 && !forceHibernate && !callbackHBFX->wakeCalendarSet && !callbackHBFX->sleepServiceWake)
if (standby_delay != 0 && !forceHibernate && !callbackHBFX->wakeCalendarSet && !callbackHBFX->sleepServiceWake)
callbackHBFX->explicitlyCallSetMaintenanceWakeCalendar();
}

Expand All @@ -445,7 +445,7 @@ IOReturn HBFX::X86PlatformPlugin_sleepPolicyHandler(void * target, IOPMSystemSle
#endif

bool doNotOverrideWakeUpTime = (ADDPR(hbfx_config).autoHibernateMode & Configuration::DoNotOverrideWakeUpTime);
bool setupHibernate = (forceHibernate || !callbackHBFX->wakeCalendarSet || callbackHBFX->sleepServiceWake || (pmset_default_mode && standby_delay == 0));
bool setupHibernate = (forceHibernate || !callbackHBFX->wakeCalendarSet || callbackHBFX->sleepServiceWake || standby_delay == 0);
if (setupHibernate && doNotOverrideWakeUpTime && !forceHibernate)
{
if (vars->standbyTimer != 0)
Expand Down

0 comments on commit bb9555e

Please sign in to comment.