aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-08-03 11:49:50 +0000
committerFelix Fietkau <nbd@openwrt.org>2013-08-03 11:49:50 +0000
commit6d9f7bbe10a50a1ef2d2d1d39d162fdb2a474bcf (patch)
tree410cf1ea64e6e17ff3c8cdcfac3afe86adae911c /package/kernel
parentd3be69f35e924538f107ed62b168e42cecf8ff9e (diff)
downloadmaster-187ad058-6d9f7bbe10a50a1ef2d2d1d39d162fdb2a474bcf.tar.gz
master-187ad058-6d9f7bbe10a50a1ef2d2d1d39d162fdb2a474bcf.tar.bz2
master-187ad058-6d9f7bbe10a50a1ef2d2d1d39d162fdb2a474bcf.zip
gpio-button-hotplug: fix active_low handling, possibly broken in r37643
Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@37664 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/kernel')
-rw-r--r--package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c17
1 files changed, 9 insertions, 8 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 74c2ecaa2e..012cd228dc 100644
--- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
+++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
@@ -274,23 +274,24 @@ struct gpio_keys_polled_dev {
struct gpio_keys_button_data data[0];
};
-static inline int gpio_button_get_value(struct gpio_keys_button *button,
- struct gpio_keys_button_data *bdata)
+static int gpio_button_get_value(struct gpio_keys_button *button,
+ struct gpio_keys_button_data *bdata)
{
+ int val;
+
if (bdata->can_sleep)
- return !!gpio_get_value_cansleep(button->gpio);
+ val = !!gpio_get_value_cansleep(button->gpio);
else
- return !!gpio_get_value(button->gpio);
+ val = !!gpio_get_value(button->gpio);
+
+ return val ^ button->active_low;
}
static void gpio_keys_polled_check_state(struct gpio_keys_button *button,
struct gpio_keys_button_data *bdata)
{
- int state;
-
- state = gpio_button_get_value(button, bdata);
+ int state = gpio_button_get_value(button, bdata);
- state = !!(state ^ button->active_low);
if (state != bdata->last_state) {
unsigned int type = button->type ?: EV_KEY;