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 #define gpio_cansleep __gpio_cansleep
#endif #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 */ #endif /* _ARCH_ARM_GPIO_H */

View file

@ -147,11 +147,6 @@ static inline int gpio_cansleep(unsigned gpio)
return __gpio_cansleep(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) static inline int irq_to_gpio(unsigned irq)
{ {
/* don't support the reverse mapping */ /* don't support the reverse mapping */

View file

@ -13,8 +13,6 @@
#ifndef __ASM_ARCH_GPIO_H #ifndef __ASM_ARCH_GPIO_H
#define __ASM_ARCH_GPIO_H __FILE__ #define __ASM_ARCH_GPIO_H __FILE__
#define gpio_to_irq __gpio_to_irq
/* Practically, GPIO banks up to GPZ are the configurable gpio banks */ /* Practically, GPIO banks up to GPZ are the configurable gpio banks */
/* GPIO bank sizes */ /* 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 */ #include <asm-generic/gpio.h> /* cansleep wrappers */
extern int gpio_to_irq(int gpio); extern int gpio_to_irq(int gpio);
#define gpio_to_irq gpio_to_irq
extern int irq_to_gpio(unsigned int irq); extern int irq_to_gpio(unsigned int irq);
#endif #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); extern int irq_to_gpio(unsigned int irq);
#define gpio_to_irq __gpio_to_irq
#define __ARM_GPIOLIB_TRIVIAL #define __ARM_GPIOLIB_TRIVIAL
/* Register the GPIOs */ /* Register the GPIOs */

View file

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

View file

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

View file

@ -24,7 +24,6 @@
/* use gpiolib dispatchers */ /* use gpiolib dispatchers */
#define __ARM_GPIOLIB_TRIVIAL #define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
#define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START) #define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START)

View file

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

View file

@ -12,7 +12,6 @@
*/ */
#define __ARM_GPIOLIB_TRIVIAL #define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
/* some boards require extra gpio capacity to support external /* some boards require extra gpio capacity to support external
* devices that need GPIO. * devices that need GPIO.

View file

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

View file

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

View file

@ -16,7 +16,6 @@
#define __ASM_ARCH_GPIO_H __FILE__ #define __ASM_ARCH_GPIO_H __FILE__
#define __ARM_GPIOLIB_TRIVIAL #define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
/* GPIO bank sizes */ /* GPIO bank sizes */
#define S5PC100_GPIO_A0_NR (8) #define S5PC100_GPIO_A0_NR (8)

View file

@ -14,7 +14,6 @@
#define __ASM_ARCH_GPIO_H __FILE__ #define __ASM_ARCH_GPIO_H __FILE__
#define __ARM_GPIOLIB_TRIVIAL #define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
/* Practically, GPIO banks up to MP03 are the configurable gpio banks */ /* Practically, GPIO banks up to MP03 are the configurable gpio banks */

View file

@ -20,11 +20,6 @@
#define __ARM_GPIOLIB_TRIVIAL #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) static inline int irq_to_gpio(unsigned int irq)
{ {
return -ENOSYS; return -ENOSYS;

View file

@ -36,6 +36,7 @@ static inline int gpio_to_irq(unsigned int gpio)
return INT_GPIO_BASE + gpio; return INT_GPIO_BASE + gpio;
return -EINVAL; return -EINVAL;
} }
#define gpio_to_irq gpio_to_irq
static inline int irq_to_gpio(unsigned int 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; return PIN_TO_PORT(gpio) + IRQ_U300_GPIO_PORT0;
} }
#define gpio_to_irq gpio_to_irq
static inline unsigned irq_to_gpio(unsigned irq) static inline unsigned irq_to_gpio(unsigned irq)
{ {

View file

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

View file

@ -1,2 +1 @@
#define __ARM_GPIOLIB_TRIVIAL #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; return gpio;
} }
#define gpio_to_irq gpio_to_irq
static inline int irq_to_gpio(unsigned irq) static inline int irq_to_gpio(unsigned irq)
{ {

View file

@ -15,7 +15,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#define __ARM_GPIOLIB_TRIVIAL #define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
/* /*
* "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving * "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 #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) static inline int irq_to_gpio(unsigned irq)
{ {
int tmp; int tmp;

View file

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

View file

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