aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-08-05 10:32:13 +0000
committerFelix Fietkau <nbd@openwrt.org>2013-08-05 10:32:13 +0000
commit6743f2625b854cd45d253e289844524c99584777 (patch)
treed8f1c8b130eaa4b0b18408bb6f86a0d33b50b0bb /package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
parent158cc23d39dab3f0ddae876fd0a74a748e6b5251 (diff)
downloadupstream-6743f2625b854cd45d253e289844524c99584777.tar.gz
upstream-6743f2625b854cd45d253e289844524c99584777.tar.bz2
upstream-6743f2625b854cd45d253e289844524c99584777.zip
gpio-button-hotplug: debounce the initial button state, the first reads at boot time might be wrong
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 37702
Diffstat (limited to 'package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c')
-rw-r--r--package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c6
1 files changed, 4 insertions, 2 deletions
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 487c813dda..ea6f94ba43 100644
--- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
+++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
@@ -298,7 +298,9 @@ static void gpio_keys_polled_check_state(struct gpio_keys_button *button,
return;
}
- button_hotplug_event(bdata, type, button->code, state);
+ if (bdata->last_state != -1)
+ button_hotplug_event(bdata, type, button->code, state);
+
bdata->last_state = state;
}
@@ -508,7 +510,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
}
bdata->can_sleep = gpio_cansleep(gpio);
- bdata->last_state = gpio_button_get_value(button, bdata);
+ bdata->last_state = -1;
bdata->threshold = DIV_ROUND_UP(button->debounce_interval,
pdata->poll_interval);
}