diff options
-rw-r--r-- | drivers/input/keyboard/gpio_keys.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 739212252b09..b3069bc00f03 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
@@ -78,12 +78,24 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
78 | int irq = gpio_to_irq(button->gpio); | 78 | int irq = gpio_to_irq(button->gpio); |
79 | unsigned int type = button->type ?: EV_KEY; | 79 | unsigned int type = button->type ?: EV_KEY; |
80 | 80 | ||
81 | set_irq_type(irq, IRQ_TYPE_EDGE_BOTH); | 81 | if (irq < 0) { |
82 | error = request_irq(irq, gpio_keys_isr, IRQF_SAMPLE_RANDOM, | 82 | error = irq; |
83 | button->desc ? button->desc : "gpio_keys", | 83 | printk(KERN_ERR |
84 | pdev); | 84 | "gpio-keys: " |
85 | "Unable to get irq number for GPIO %d," | ||
86 | "error %d\n", | ||
87 | button->gpio, error); | ||
88 | goto fail; | ||
89 | } | ||
90 | |||
91 | error = request_irq(irq, gpio_keys_isr, | ||
92 | IRQF_SAMPLE_RANDOM | IRQF_TRIGGER_RISING | | ||
93 | IRQF_TRIGGER_FALLING, | ||
94 | button->desc ? button->desc : "gpio_keys", | ||
95 | pdev); | ||
85 | if (error) { | 96 | if (error) { |
86 | printk(KERN_ERR "gpio-keys: unable to claim irq %d; error %d\n", | 97 | printk(KERN_ERR |
98 | "gpio-keys: Unable to claim irq %d; error %d\n", | ||
87 | irq, error); | 99 | irq, error); |
88 | goto fail; | 100 | goto fail; |
89 | } | 101 | } |
@@ -93,16 +105,19 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
93 | 105 | ||
94 | error = input_register_device(input); | 106 | error = input_register_device(input); |
95 | if (error) { | 107 | if (error) { |
96 | printk(KERN_ERR "Unable to register gpio-keys input device\n"); | 108 | printk(KERN_ERR |
109 | "gpio-keys: Unable to register input device, " | ||
110 | "error: %d\n", error); | ||
97 | goto fail; | 111 | goto fail; |
98 | } | 112 | } |
99 | 113 | ||
100 | return 0; | 114 | return 0; |
101 | 115 | ||
102 | fail: | 116 | fail: |
103 | for (i = i - 1; i >= 0; i--) | 117 | while (--i >= 0) |
104 | free_irq(gpio_to_irq(pdata->buttons[i].gpio), pdev); | 118 | free_irq(gpio_to_irq(pdata->buttons[i].gpio), pdev); |
105 | 119 | ||
120 | platform_set_drvdata(pdev, NULL); | ||
106 | input_free_device(input); | 121 | input_free_device(input); |
107 | 122 | ||
108 | return error; | 123 | return error; |