diff options
Diffstat (limited to 'common/extpower_gpio.c')
-rw-r--r-- | common/extpower_gpio.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/common/extpower_gpio.c b/common/extpower_gpio.c index 218905f91d..4643b245de 100644 --- a/common/extpower_gpio.c +++ b/common/extpower_gpio.c @@ -17,19 +17,22 @@ int extpower_is_present(void) } /** - * Handle notification of external power change; forward it to host. + * Deferred function to handle external power change */ -static void extpower_changed(void) +static void extpower_deferred(void) { + hook_notify(HOOK_AC_CHANGE); + + /* Forward notification to host */ if (extpower_is_present()) host_set_single_event(EC_HOST_EVENT_AC_CONNECTED); else host_set_single_event(EC_HOST_EVENT_AC_DISCONNECTED); } -DECLARE_HOOK(HOOK_AC_CHANGE, extpower_changed, HOOK_PRIO_DEFAULT); +DECLARE_DEFERRED(extpower_deferred); void extpower_interrupt(enum gpio_signal signal) { /* Trigger deferred notification of external power change */ - hook_notify(HOOK_AC_CHANGE); + hook_call_deferred(extpower_deferred, 0); } |