From: Anti Sullin <anti.sullin@artecdesign.ee>
To: LKML <linux-kernel@vger.kernel.org>
Cc: dtor@mail.ru, akpm@linux-foundation.org, david-b@pacbell.net
Subject: [PATCH 1/2] gpio_keys: add gpio_to_irq return code check
Date: Tue, 18 Sep 2007 18:43:38 +0300 [thread overview]
Message-ID: <46EFF22A.9010509@artecdesign.ee> (raw)
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>
---
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 16:59:23.000000000 +0300
@@ -77,10 +77,12 @@ 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)
+ 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
next reply other threads:[~2007-09-18 15:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-18 15:43 Anti Sullin [this message]
2007-09-18 15:59 ` [PATCH 1/2] gpio_keys: add gpio_to_irq return code check Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46EFF22A.9010509@artecdesign.ee \
--to=anti.sullin@artecdesign.ee \
--cc=akpm@linux-foundation.org \
--cc=david-b@pacbell.net \
--cc=dtor@mail.ru \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox