]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
input: gpio-keys: Allow invalid irq as -ve or zero
authorLaxman Dewangan <ldewangan@nvidia.com>
Thu, 24 Apr 2014 04:45:18 +0000 (10:15 +0530)
committerSimone Willett <swillett@nvidia.com>
Fri, 25 Apr 2014 20:17:18 +0000 (13:17 -0700)
Allow to pass the invalid irq as -ve or zero from platform.
For this change irq type on platform data as the integer type and
handle in driver to treat -ve or zero irq as invalid irq.

bug 1502787

Change-Id: I09f77dd6ef82f7668c940d31d620a588e9f35e7c
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/401200
Reviewed-by: Mitch Luban <mluban@nvidia.com>
Tested-by: Mitch Luban <mluban@nvidia.com>
drivers/input/keyboard/gpio_keys.c
include/linux/gpio_keys.h

index 58adba9cc871f246695d6cb6d02f02e6eaf16098..78333db53db3b809487b8826d740e63ea02716ff 100644 (file)
@@ -463,7 +463,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
        bdata->button = button;
        spin_lock_init(&bdata->lock);
 
-       if (gpio_is_valid(button->gpio) && !button->irq) {
+       if (gpio_is_valid(button->gpio) && (button->irq <= 0)) {
                error = gpio_request_one(button->gpio, GPIOF_IN, desc);
                if (error < 0) {
                        dev_err(dev, "Failed to request GPIO %d, error %d\n",
@@ -498,7 +498,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
                irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING;
 
        } else {
-               if (!button->irq) {
+               if (button->irq <= 0) {
                        dev_err(dev, "No IRQ specified\n");
                        return -EINVAL;
                }
index 42530dc017d0365a6107ed900f59f3a30b0fe0c7..77d94bd4de6f2bfb8a1bdd00661f236dd7656a90 100644 (file)
@@ -14,7 +14,7 @@ struct gpio_keys_button {
        int debounce_interval;  /* debounce ticks interval in msecs */
        bool can_disable;
        int value;              /* axis value for EV_ABS */
-       unsigned int irq;       /* Irq number in case of interrupt keys */
+       int irq;                /* Irq number in case of interrupt keys */
 };
 
 struct gpio_keys_platform_data {