summaryrefslogtreecommitdiff
path: root/arch/blackfin/include/asm/gpio.h
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2009-03-28 21:18:45 +0800
committerBryan Wu <cooloney@kernel.org>2009-03-28 21:18:45 +0800
commite1312bfcc25f9301f997bf1ce84355a0f1167847 (patch)
treeb9c11675d8abda4a53787443426f7b2ac743c4c9 /arch/blackfin/include/asm/gpio.h
parenta66648756f97ea5150875b85a0177c33e41afc1d (diff)
downloadlinux-next-e1312bfcc25f9301f997bf1ce84355a0f1167847.tar.gz
Blackfin arch: add a check to make sure only Blackfin GPIOs may generate IRQs
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin/include/asm/gpio.h')
-rw-r--r--arch/blackfin/include/asm/gpio.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h
index d4a082ef75b4..3c99ddc8df16 100644
--- a/arch/blackfin/include/asm/gpio.h
+++ b/arch/blackfin/include/asm/gpio.h
@@ -303,7 +303,10 @@ static inline void gpio_set_value(unsigned gpio, int value)
static inline int gpio_to_irq(unsigned gpio)
{
- return (gpio + GPIO_IRQ_BASE);
+ if (likely(gpio < MAX_BLACKFIN_GPIOS))
+ return gpio + GPIO_IRQ_BASE;
+
+ return -EINVAL;
}
static inline int irq_to_gpio(unsigned irq)