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: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Russell King 2011-07-26 11:29:42 +01:00
parent 22fe678376
commit 01e7dc89d0
24 changed files with 13 additions and 42 deletions

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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

View file

@ -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 */

View file

@ -51,9 +51,4 @@
#define __ARM_GPIOLIB_TRIVIAL
static inline int gpio_to_irq(unsigned gpio)
{
return __gpio_to_irq(gpio);
}
#endif

View file

@ -18,6 +18,4 @@
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
#endif /* __ASM_ARCH_MSM_GPIO_H */

View file

@ -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)

View file

@ -1,2 +1 @@
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq

View file

@ -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.

View file

@ -13,7 +13,6 @@
*/
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
/* GPIO bank sizes */
#define S3C64XX_GPIO_A_NR (8)

View file

@ -14,7 +14,6 @@
#define __ASM_ARCH_GPIO_H __FILE__
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
/* GPIO bank sizes */

View file

@ -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)

View file

@ -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 */

View file

@ -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;

View file

@ -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)
{

View file

@ -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)
{

View file

@ -1,2 +1 @@
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq

View file

@ -1,2 +1 @@
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq

View file

@ -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)
{

View file

@ -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

View file

@ -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;

View file

@ -15,11 +15,6 @@
#define __ARM_GPIOLIB_TRIVIAL
/*
* GENERIC_GPIO primitives.
*/
#define gpio_to_irq __gpio_to_irq
/*
* Orion-specific GPIO API extensions.
*/

View file

@ -15,6 +15,5 @@
#define __PLAT_GPIO_H
#define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
#endif /* __PLAT_GPIO_H */