Commit 01e7dc89 authored by Russell King's avatar Russell King

ARM: gpio: consolidate gpio_to_irq

Many of the gpio_to_irq implementations use the gpiolib version of this
function.  Provide the standard gpiolib gpio_to_irq() for everyone, but
allow platforms to override it if they wish.  Add the neccessary
overrides for those platforms which do not use the standard definition.
Acked-by: default avatarKukjin Kim <kgene.kim@samsung.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 22fe6783
......@@ -14,4 +14,13 @@
#define gpio_cansleep __gpio_cansleep
#endif
/*
* Provide a default gpio_to_irq() which should satisfy every case.
* However, some platforms want to do this differently, so allow them
* to override it.
*/
#ifndef gpio_to_irq
#define gpio_to_irq __gpio_to_irq
#endif
#endif /* _ARCH_ARM_GPIO_H */
......@@ -147,11 +147,6 @@ static inline int gpio_cansleep(unsigned gpio)
return __gpio_cansleep(gpio);
}
static inline int gpio_to_irq(unsigned gpio)
{
return __gpio_to_irq(gpio);
}
static inline int irq_to_gpio(unsigned irq)
{
/* don't support the reverse mapping */
......
......@@ -13,8 +13,6 @@
#ifndef __ASM_ARCH_GPIO_H
#define __ASM_ARCH_GPIO_H __FILE__
#define gpio_to_irq __gpio_to_irq
/* Practically, GPIO banks up to GPZ are the configurable gpio banks */
/* GPIO bank sizes */
......
......@@ -70,6 +70,7 @@ static inline void gpio_set_value(unsigned gpio, int value)
#include <asm-generic/gpio.h> /* cansleep wrappers */
extern int gpio_to_irq(int gpio);
#define gpio_to_irq gpio_to_irq
extern int irq_to_gpio(unsigned int irq);
#endif
......
......@@ -40,8 +40,6 @@ extern int ks8695_gpio_interrupt(unsigned int pin, unsigned int type);
*/
extern int irq_to_gpio(unsigned int irq);
#define gpio_to_irq __gpio_to_irq
#define __ARM_GPIOLIB_TRIVIAL
/* Register the GPIOs */
......
......@@ -51,9 +51,4 @@
#define __ARM_GPIOLIB_TRIVIAL
static inline int gpio_to_irq(unsigned gpio)
{
return __gpio_to_irq(gpio);
}
#endif
......@@ -18,6 +18,4 @@
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
#endif /* __ASM_ARCH_MSM_GPIO_H */
......@@ -24,7 +24,6 @@
/* use gpiolib dispatchers */
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
#define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START)
......
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
......@@ -12,7 +12,6 @@
*/
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
/* some boards require extra gpio capacity to support external
* devices that need GPIO.
......
......@@ -13,7 +13,6 @@
*/
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
/* GPIO bank sizes */
#define S3C64XX_GPIO_A_NR (8)
......
......@@ -14,7 +14,6 @@
#define __ASM_ARCH_GPIO_H __FILE__
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
/* GPIO bank sizes */
......
......@@ -16,7 +16,6 @@
#define __ASM_ARCH_GPIO_H __FILE__
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
/* GPIO bank sizes */
#define S5PC100_GPIO_A0_NR (8)
......
......@@ -14,7 +14,6 @@
#define __ASM_ARCH_GPIO_H __FILE__
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
/* Practically, GPIO banks up to MP03 are the configurable gpio banks */
......
......@@ -20,11 +20,6 @@
#define __ARM_GPIOLIB_TRIVIAL
static inline int gpio_to_irq(unsigned gpio)
{
return __gpio_to_irq(gpio);
}
static inline int irq_to_gpio(unsigned int irq)
{
return -ENOSYS;
......
......@@ -36,6 +36,7 @@ static inline int gpio_to_irq(unsigned int gpio)
return INT_GPIO_BASE + gpio;
return -EINVAL;
}
#define gpio_to_irq gpio_to_irq
static inline int irq_to_gpio(unsigned int irq)
{
......
......@@ -281,6 +281,7 @@ static inline unsigned gpio_to_irq(unsigned gpio)
{
return PIN_TO_PORT(gpio) + IRQ_U300_GPIO_PORT0;
}
#define gpio_to_irq gpio_to_irq
static inline unsigned irq_to_gpio(unsigned irq)
{
......
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
......@@ -22,6 +22,7 @@ static inline int gpio_to_irq(unsigned gpio)
{
return gpio;
}
#define gpio_to_irq gpio_to_irq
static inline int irq_to_gpio(unsigned irq)
{
......
......@@ -15,7 +15,6 @@
#include <linux/kernel.h>
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
/*
* "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving
......
......@@ -224,11 +224,6 @@ extern void omap_gpio_restore_context(void);
#define __ARM_GPIOLIB_TRIVIAL
static inline int gpio_to_irq(unsigned gpio)
{
return __gpio_to_irq(gpio);
}
static inline int irq_to_gpio(unsigned irq)
{
int tmp;
......
......@@ -15,11 +15,6 @@
#define __ARM_GPIOLIB_TRIVIAL
/*
* GENERIC_GPIO primitives.
*/
#define gpio_to_irq __gpio_to_irq
/*
* Orion-specific GPIO API extensions.
*/
......
......@@ -15,6 +15,5 @@
#define __PLAT_GPIO_H
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
#endif /* __PLAT_GPIO_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment