As David Brownell pointed out when reviewing my suspend patch to
gpio_keys, the original gpio_keys driver does not check gpio_to_irq
return code.
This patch adds the gpio_to_irq return code check to gpio_keys and
moves the IRQ edge type setting to request_irq flags to avoid changing
the irq type before we have confirmed we can use it.
Signed-off-by: Anti Sullin <anti.sullin@artecdesign.ee>
---
Resent because probe return code was missing in case of error happens.
---
diff -pur clean/linux-2.6.23-rc5-at91/drivers/input/keyboard/gpio_keys.c linux-2.6.23-rc5-at91/drivers/input/keyboard/gpio_keys.c
--- clean/linux-2.6.23-rc5-at91/drivers/input/keyboard/gpio_keys.c 2007-09-01 09:08:24.000000000 +0300
+++ linux-2.6.23-rc5-at91/drivers/input/keyboard/gpio_keys.c 2007-09-18 19:27:25.000000000 +0300
@@ -77,10 +77,16 @@ static int __devinit gpio_keys_probe(str
int irq = gpio_to_irq(button->gpio);
unsigned int type = button->type ?: EV_KEY;
- set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
- error = request_irq(irq, gpio_keys_isr, IRQF_SAMPLE_RANDOM,
- button->desc ? button->desc : "gpio_keys",
- pdev);
+ if (irq < 0) {
+ error = -EINVAL;
+ printk(KERN_ERR "gpio-keys: unable to get irq number for GPIO %d\n",
+ button->gpio);
+ goto fail;
+ }
+
+ error = request_irq(irq, gpio_keys_isr,
+ IRQF_SAMPLE_RANDOM | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+ button->desc ? button->desc : "gpio_keys", pdev);
if (error) {
printk(KERN_ERR "gpio-keys: unable to claim irq %d; error %d\n",
irq, error);
--
Anti Sullin
Embedded Software Engineer
Artec Design LLC
Türi 10C, 11313, Tallinn, Estonia
-
| Linus Torvalds | Linux 2.6.27-rc8 |
| Greg KH | [patch 00/71] 2.6.26-stable review |
| Dmitry Torokhov | 2.6.27-rc8+ - first impressions |
| Rafael J. Wysocki | [Bug #11215] INFO: possible recursive locking detected ps2 command |
git: | |
| Christian MICHON | Re: MinGW port - initial work uploaded |
| Luiz Fernando N. Capitulino | Libification project (SoC) |
| Linus Torvalds | People unaware of the importance of "git gc"? |
| Jakub Narebski | [RFC] Git User's Survey 2008 |
| Richard Stallman | Real men don't attack straw men |
| Tony Abernethy | Re: What is our ultimate goal?? |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| James Hartley | scp batch mode? |
| Ingo Molnar | Re: [TCP]: TCP_DEFER_ACCEPT causes leak sockets |
| Timo Teräs | Re: xfrm_state locking regression... |
| Ingo Molnar | Re: [bug] stuck localhost TCP connections, v2.6.26-rc3+ |
| Natalie Protasevich | [BUG] New Kernel Bugs |
