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 @@ ...@@ -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 */
...@@ -147,11 +147,6 @@ static inline int gpio_cansleep(unsigned gpio) ...@@ -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 */
......
...@@ -13,8 +13,6 @@ ...@@ -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 */
......
...@@ -70,6 +70,7 @@ static inline void gpio_set_value(unsigned gpio, int value) ...@@ -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
......
...@@ -40,8 +40,6 @@ extern int ks8695_gpio_interrupt(unsigned int pin, unsigned int type); ...@@ -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 */
......
...@@ -51,9 +51,4 @@ ...@@ -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
...@@ -18,6 +18,4 @@ ...@@ -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 */
...@@ -24,7 +24,6 @@ ...@@ -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)
......
#define __ARM_GPIOLIB_TRIVIAL #define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
...@@ -12,7 +12,6 @@ ...@@ -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.
......
...@@ -13,7 +13,6 @@ ...@@ -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)
......
...@@ -14,7 +14,6 @@ ...@@ -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 */
......
...@@ -16,7 +16,6 @@ ...@@ -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)
......
...@@ -14,7 +14,6 @@ ...@@ -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 */
......
...@@ -20,11 +20,6 @@ ...@@ -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;
......
...@@ -36,6 +36,7 @@ static inline int gpio_to_irq(unsigned int gpio) ...@@ -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)
{ {
......
...@@ -281,6 +281,7 @@ static inline unsigned gpio_to_irq(unsigned gpio) ...@@ -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)
{ {
......
#define __ARM_GPIOLIB_TRIVIAL #define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
#define __ARM_GPIOLIB_TRIVIAL #define __ARM_GPIOLIB_TRIVIAL
#define gpio_to_irq __gpio_to_irq
...@@ -22,6 +22,7 @@ static inline int gpio_to_irq(unsigned gpio) ...@@ -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)
{ {
......
...@@ -15,7 +15,6 @@ ...@@ -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
......
...@@ -224,11 +224,6 @@ extern void omap_gpio_restore_context(void); ...@@ -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;
......
...@@ -15,11 +15,6 @@ ...@@ -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.
*/ */
......
...@@ -15,6 +15,5 @@ ...@@ -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 */
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