gpio-button-hotplug: add inline function gpio_button_get_value().
authorJohn Crispin <john@openwrt.org>
Thu, 1 Aug 2013 14:31:20 +0000 (14:31 +0000)
committerJohn Crispin <john@openwrt.org>
Thu, 1 Aug 2013 14:31:20 +0000 (14:31 +0000)
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
SVN-Revision: 37641

package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c

index 0b3140c0bff45e8e4c1f80c7f371ea9e7721f463..7fe169067d47b282248f4cf6a90d7ddb5479cbde 100644 (file)
@@ -274,6 +274,15 @@ 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)
+{
+       if (bdata->can_sleep)
+               return !!gpio_get_value_cansleep(button->gpio);
+       else
+               return !!gpio_get_value(button->gpio);
+}
+
 static void gpio_keys_polled_check_state(struct gpio_keys_button *button,
                                         struct gpio_keys_button_data *bdata)
 {