From d13e65024dd7d634a66f625b598fea842f64a98d Mon Sep 17 00:00:00 2001 From: John Crispin Date: Thu, 1 Aug 2013 14:31:28 +0000 Subject: [PATCH] gpio-button-hotplug: use gpio_button_get_value() to initialize last_state. TL-WR720N-v3 has a slider switch composed of 2 GPIO buttons which can be used to swtich between 3 positions. At leat 1 button is in pressed state in any of those positions. Initialize 'last_state' as 0 (released) will cause the device to automatically enter failsafe mode on every bootup. Signed-off-by: Yousong Zhou SVN-Revision: 37643 --- package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c index 9cbee21e0a..74c2ecaa2e 100644 --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c @@ -509,7 +509,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) } bdata->can_sleep = gpio_cansleep(gpio); - bdata->last_state = 0; + bdata->last_state = gpio_button_get_value(button, bdata); bdata->threshold = DIV_ROUND_UP(button->debounce_interval, pdata->poll_interval); } -- 2.30.2