From 464cbabf02d43c5fd773a94989328c1e26a026e5 Mon Sep 17 00:00:00 2001 From: taeyoung Date: Tue, 13 Dec 2016 19:39:48 +0900 Subject: [PATCH] display: fix bug that booting done event handler is removed before booting done Previously, booting done event handler was removed when keykilter is enabled. Thus the position to remove the handler is modified. Change-Id: If26ca2ec191160a0b6600a0e8488b80ef8f9be44 Signed-off-by: taeyoung --- src/display/key-filter.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/display/key-filter.c b/src/display/key-filter.c index c194c1e..2ee2a39 100644 --- a/src/display/key-filter.c +++ b/src/display/key-filter.c @@ -88,7 +88,20 @@ static bool touch_pressed = false; static int skip_lcd_off = false; static int skip_combination = false; static const struct device_ops *touchled; -static int booting_check = true; + +static int booting_done(void *data) +{ + static int done = 0; + + if (!data) + return done; + + done = *(int *)data; + + _I("Booting done(%d)", done); + + return done; +} static inline int current_state_in_on(void) { @@ -312,7 +325,7 @@ static int decide_lcdoff(void) return false; /* At booting time, display must do not turn off */ - if (booting_check) + if (!booting_done(NULL)) return false; return true; @@ -594,13 +607,6 @@ static int check_key_filter(void *data, int fd) return 0; } -static int booting_done_cb(void *data) -{ - booting_check = 0; - - return 0; -} - /* * Default capability * powerkey := LCDON | LCDOFF | POWEROFF @@ -625,7 +631,12 @@ static void keyfilter_init(void) touchled = find_device(TOUCHLED_NAME); - register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done_cb); + register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); +} + +static void keyfilter_exit(void) +{ + unregister_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); } static void key_backlight_enable(bool enable) @@ -641,12 +652,11 @@ static void key_backlight_enable(bool enable) opt = TOUCHLED_DIRECT_OFF; touchled->execute(&opt); - - unregister_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done_cb); } static const struct display_keyfilter_ops normal_keyfilter_ops = { .init = keyfilter_init, + .exit = keyfilter_exit, .check = check_key_filter, .set_powerkey_ignore = NULL, .powerkey_lcdoff = NULL, -- 2.7.4