diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-07-26 06:29:42 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-08-12 03:54:05 -0400 |
commit | 01e7dc89d060413fd639635618de506093730964 (patch) | |
tree | 4fd1f5563c3446155e18fe76d4789ca6fe17b791 /arch | |
parent | 22fe67837614469f8e86c97e9e43d46270701b33 (diff) |
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>
Diffstat (limited to 'arch')
24 files changed, 13 insertions, 42 deletions
diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h index 15e8970f20f4..5032224eec3d 100644 --- a/arch/arm/include/asm/gpio.h +++ b/arch/arm/include/asm/gpio.h | |||
@@ -14,4 +14,13 @@ | |||
14 | #define gpio_cansleep __gpio_cansleep | 14 | #define gpio_cansleep __gpio_cansleep |
15 | #endif | 15 | #endif |
16 | 16 | ||
17 | /* | ||
18 | * Provide a default gpio_to_irq() which should satisfy every case. | ||
19 | * However, some platforms want to do this differently, so allow them | ||
20 | * to override it. | ||
21 | */ | ||
22 | #ifndef gpio_to_irq | ||
23 | #define gpio_to_irq __gpio_to_irq | ||
24 | #endif | ||
25 | |||
17 | #endif /* _ARCH_ARM_GPIO_H */ | 26 | #endif /* _ARCH_ARM_GPIO_H */ |
diff --git a/arch/arm/mach-davinci/include/mach/gpio.h b/arch/arm/mach-davinci/include/mach/gpio.h index fbece126c2bf..73fc7a087f83 100644 --- a/arch/arm/mach-davinci/include/mach/gpio.h +++ b/arch/arm/mach-davinci/include/mach/gpio.h | |||
@@ -147,11 +147,6 @@ static inline int gpio_cansleep(unsigned gpio) | |||
147 | return __gpio_cansleep(gpio); | 147 | return __gpio_cansleep(gpio); |
148 | } | 148 | } |
149 | 149 | ||
150 | static inline int gpio_to_irq(unsigned gpio) | ||
151 | { | ||
152 | return __gpio_to_irq(gpio); | ||
153 | } | ||
154 | |||
155 | static inline int irq_to_gpio(unsigned irq) | 150 | static inline int irq_to_gpio(unsigned irq) |
156 | { | 151 | { |
157 | /* don't support the reverse mapping */ | 152 | /* don't support the reverse mapping */ |
diff --git a/arch/arm/mach-exynos4/include/mach/gpio.h b/arch/arm/mach-exynos4/include/mach/gpio.h index b2e3595ae943..b91e8b2782bc 100644 --- a/arch/arm/mach-exynos4/include/mach/gpio.h +++ b/arch/arm/mach-exynos4/include/mach/gpio.h | |||
@@ -13,8 +13,6 @@ | |||
13 | #ifndef __ASM_ARCH_GPIO_H | 13 | #ifndef __ASM_ARCH_GPIO_H |
14 | #define __ASM_ARCH_GPIO_H __FILE__ | 14 | #define __ASM_ARCH_GPIO_H __FILE__ |
15 | 15 | ||
16 | #define gpio_to_irq __gpio_to_irq | ||
17 | |||
18 | /* Practically, GPIO banks up to GPZ are the configurable gpio banks */ | 16 | /* Practically, GPIO banks up to GPZ are the configurable gpio banks */ |
19 | 17 | ||
20 | /* GPIO bank sizes */ | 18 | /* GPIO bank sizes */ |
diff --git a/arch/arm/mach-ixp4xx/include/mach/gpio.h b/arch/arm/mach-ixp4xx/include/mach/gpio.h index a5f87ded2f28..19009bf98a0e 100644 --- a/arch/arm/mach-ixp4xx/include/mach/gpio.h +++ b/arch/arm/mach-ixp4xx/include/mach/gpio.h | |||
@@ -70,6 +70,7 @@ static inline void gpio_set_value(unsigned gpio, int value) | |||
70 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | 70 | #include <asm-generic/gpio.h> /* cansleep wrappers */ |
71 | 71 | ||
72 | extern int gpio_to_irq(int gpio); | 72 | extern int gpio_to_irq(int gpio); |
73 | #define gpio_to_irq gpio_to_irq | ||
73 | extern int irq_to_gpio(unsigned int irq); | 74 | extern int irq_to_gpio(unsigned int irq); |
74 | 75 | ||
75 | #endif | 76 | #endif |
diff --git a/arch/arm/mach-ks8695/include/mach/gpio.h b/arch/arm/mach-ks8695/include/mach/gpio.h index c13952c22a39..59d6b53d27c0 100644 --- a/arch/arm/mach-ks8695/include/mach/gpio.h +++ b/arch/arm/mach-ks8695/include/mach/gpio.h | |||
@@ -40,8 +40,6 @@ extern int ks8695_gpio_interrupt(unsigned int pin, unsigned int type); | |||
40 | */ | 40 | */ |
41 | extern int irq_to_gpio(unsigned int irq); | 41 | extern int irq_to_gpio(unsigned int irq); |
42 | 42 | ||
43 | #define gpio_to_irq __gpio_to_irq | ||
44 | |||
45 | #define __ARM_GPIOLIB_TRIVIAL | 43 | #define __ARM_GPIOLIB_TRIVIAL |
46 | 44 | ||
47 | /* Register the GPIOs */ | 45 | /* Register the GPIOs */ |
diff --git a/arch/arm/mach-lpc32xx/include/mach/gpio.h b/arch/arm/mach-lpc32xx/include/mach/gpio.h index 0ca6c2778aa7..b01cd24715dc 100644 --- a/arch/arm/mach-lpc32xx/include/mach/gpio.h +++ b/arch/arm/mach-lpc32xx/include/mach/gpio.h | |||
@@ -51,9 +51,4 @@ | |||
51 | 51 | ||
52 | #define __ARM_GPIOLIB_TRIVIAL | 52 | #define __ARM_GPIOLIB_TRIVIAL |
53 | 53 | ||
54 | static inline int gpio_to_irq(unsigned gpio) | ||
55 | { | ||
56 | return __gpio_to_irq(gpio); | ||
57 | } | ||
58 | |||
59 | #endif | 54 | #endif |
diff --git a/arch/arm/mach-msm/include/mach/gpio.h b/arch/arm/mach-msm/include/mach/gpio.h index bc75e2041144..10197a9e9d90 100644 --- a/arch/arm/mach-msm/include/mach/gpio.h +++ b/arch/arm/mach-msm/include/mach/gpio.h | |||
@@ -18,6 +18,4 @@ | |||
18 | 18 | ||
19 | #define __ARM_GPIOLIB_TRIVIAL | 19 | #define __ARM_GPIOLIB_TRIVIAL |
20 | 20 | ||
21 | #define gpio_to_irq __gpio_to_irq | ||
22 | |||
23 | #endif /* __ASM_ARCH_MSM_GPIO_H */ | 21 | #endif /* __ASM_ARCH_MSM_GPIO_H */ |
diff --git a/arch/arm/mach-mxs/include/mach/gpio.h b/arch/arm/mach-mxs/include/mach/gpio.h index bb44c8dcf31c..bf28a1f8dc48 100644 --- a/arch/arm/mach-mxs/include/mach/gpio.h +++ b/arch/arm/mach-mxs/include/mach/gpio.h | |||
@@ -24,7 +24,6 @@ | |||
24 | 24 | ||
25 | /* use gpiolib dispatchers */ | 25 | /* use gpiolib dispatchers */ |
26 | #define __ARM_GPIOLIB_TRIVIAL | 26 | #define __ARM_GPIOLIB_TRIVIAL |
27 | #define gpio_to_irq __gpio_to_irq | ||
28 | 27 | ||
29 | #define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START) | 28 | #define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START) |
30 | 29 | ||
diff --git a/arch/arm/mach-realview/include/mach/gpio.h b/arch/arm/mach-realview/include/mach/gpio.h index bd11dc503cce..910974bbd83b 100644 --- a/arch/arm/mach-realview/include/mach/gpio.h +++ b/arch/arm/mach-realview/include/mach/gpio.h | |||
@@ -1,2 +1 @@ | |||
1 | #define __ARM_GPIOLIB_TRIVIAL | #define __ARM_GPIOLIB_TRIVIAL | |
2 | #define gpio_to_irq __gpio_to_irq | ||
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio.h b/arch/arm/mach-s3c2410/include/mach/gpio.h index 998ef4c41de8..d502d17d46bf 100644 --- a/arch/arm/mach-s3c2410/include/mach/gpio.h +++ b/arch/arm/mach-s3c2410/include/mach/gpio.h | |||
@@ -12,7 +12,6 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #define __ARM_GPIOLIB_TRIVIAL | 14 | #define __ARM_GPIOLIB_TRIVIAL |
15 | #define gpio_to_irq __gpio_to_irq | ||
16 | 15 | ||
17 | /* some boards require extra gpio capacity to support external | 16 | /* some boards require extra gpio capacity to support external |
18 | * devices that need GPIO. | 17 | * devices that need GPIO. |
diff --git a/arch/arm/mach-s3c64xx/include/mach/gpio.h b/arch/arm/mach-s3c64xx/include/mach/gpio.h index 6958b3fe5255..3a8857c68e4d 100644 --- a/arch/arm/mach-s3c64xx/include/mach/gpio.h +++ b/arch/arm/mach-s3c64xx/include/mach/gpio.h | |||
@@ -13,7 +13,6 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #define __ARM_GPIOLIB_TRIVIAL | 15 | #define __ARM_GPIOLIB_TRIVIAL |
16 | #define gpio_to_irq __gpio_to_irq | ||
17 | 16 | ||
18 | /* GPIO bank sizes */ | 17 | /* GPIO bank sizes */ |
19 | #define S3C64XX_GPIO_A_NR (8) | 18 | #define S3C64XX_GPIO_A_NR (8) |
diff --git a/arch/arm/mach-s5p64x0/include/mach/gpio.h b/arch/arm/mach-s5p64x0/include/mach/gpio.h index a25160b426dd..c3a6aa0c472f 100644 --- a/arch/arm/mach-s5p64x0/include/mach/gpio.h +++ b/arch/arm/mach-s5p64x0/include/mach/gpio.h | |||
@@ -14,7 +14,6 @@ | |||
14 | #define __ASM_ARCH_GPIO_H __FILE__ | 14 | #define __ASM_ARCH_GPIO_H __FILE__ |
15 | 15 | ||
16 | #define __ARM_GPIOLIB_TRIVIAL | 16 | #define __ARM_GPIOLIB_TRIVIAL |
17 | #define gpio_to_irq __gpio_to_irq | ||
18 | 17 | ||
19 | /* GPIO bank sizes */ | 18 | /* GPIO bank sizes */ |
20 | 19 | ||
diff --git a/arch/arm/mach-s5pc100/include/mach/gpio.h b/arch/arm/mach-s5pc100/include/mach/gpio.h index f515bfb964a6..0e75641249c7 100644 --- a/arch/arm/mach-s5pc100/include/mach/gpio.h +++ b/arch/arm/mach-s5pc100/include/mach/gpio.h | |||
@@ -16,7 +16,6 @@ | |||
16 | #define __ASM_ARCH_GPIO_H __FILE__ | 16 | #define __ASM_ARCH_GPIO_H __FILE__ |
17 | 17 | ||
18 | #define __ARM_GPIOLIB_TRIVIAL | 18 | #define __ARM_GPIOLIB_TRIVIAL |
19 | #define gpio_to_irq __gpio_to_irq | ||
20 | 19 | ||
21 | /* GPIO bank sizes */ | 20 | /* GPIO bank sizes */ |
22 | #define S5PC100_GPIO_A0_NR (8) | 21 | #define S5PC100_GPIO_A0_NR (8) |
diff --git a/arch/arm/mach-s5pv210/include/mach/gpio.h b/arch/arm/mach-s5pv210/include/mach/gpio.h index 27f2139df311..d348ee2cb0ac 100644 --- a/arch/arm/mach-s5pv210/include/mach/gpio.h +++ b/arch/arm/mach-s5pv210/include/mach/gpio.h | |||
@@ -14,7 +14,6 @@ | |||
14 | #define __ASM_ARCH_GPIO_H __FILE__ | 14 | #define __ASM_ARCH_GPIO_H __FILE__ |
15 | 15 | ||
16 | #define __ARM_GPIOLIB_TRIVIAL | 16 | #define __ARM_GPIOLIB_TRIVIAL |
17 | #define gpio_to_irq __gpio_to_irq | ||
18 | 17 | ||
19 | /* Practically, GPIO banks up to MP03 are the configurable gpio banks */ | 18 | /* Practically, GPIO banks up to MP03 are the configurable gpio banks */ |
20 | 19 | ||
diff --git a/arch/arm/mach-shmobile/include/mach/gpio.h b/arch/arm/mach-shmobile/include/mach/gpio.h index e8feff014d99..95e11cfe4e41 100644 --- a/arch/arm/mach-shmobile/include/mach/gpio.h +++ b/arch/arm/mach-shmobile/include/mach/gpio.h | |||
@@ -20,11 +20,6 @@ | |||
20 | 20 | ||
21 | #define __ARM_GPIOLIB_TRIVIAL | 21 | #define __ARM_GPIOLIB_TRIVIAL |
22 | 22 | ||
23 | static inline int gpio_to_irq(unsigned gpio) | ||
24 | { | ||
25 | return __gpio_to_irq(gpio); | ||
26 | } | ||
27 | |||
28 | static inline int irq_to_gpio(unsigned int irq) | 23 | static inline int irq_to_gpio(unsigned int irq) |
29 | { | 24 | { |
30 | return -ENOSYS; | 25 | return -ENOSYS; |
diff --git a/arch/arm/mach-tegra/include/mach/gpio.h b/arch/arm/mach-tegra/include/mach/gpio.h index d51be09fe3ad..51072238d85a 100644 --- a/arch/arm/mach-tegra/include/mach/gpio.h +++ b/arch/arm/mach-tegra/include/mach/gpio.h | |||
@@ -36,6 +36,7 @@ static inline int gpio_to_irq(unsigned int gpio) | |||
36 | return INT_GPIO_BASE + gpio; | 36 | return INT_GPIO_BASE + gpio; |
37 | return -EINVAL; | 37 | return -EINVAL; |
38 | } | 38 | } |
39 | #define gpio_to_irq gpio_to_irq | ||
39 | 40 | ||
40 | static inline int irq_to_gpio(unsigned int irq) | 41 | static inline int irq_to_gpio(unsigned int irq) |
41 | { | 42 | { |
diff --git a/arch/arm/mach-u300/include/mach/gpio.h b/arch/arm/mach-u300/include/mach/gpio.h index d5a71abcbaea..3d7b7d1291e2 100644 --- a/arch/arm/mach-u300/include/mach/gpio.h +++ b/arch/arm/mach-u300/include/mach/gpio.h | |||
@@ -281,6 +281,7 @@ static inline unsigned gpio_to_irq(unsigned gpio) | |||
281 | { | 281 | { |
282 | return PIN_TO_PORT(gpio) + IRQ_U300_GPIO_PORT0; | 282 | return PIN_TO_PORT(gpio) + IRQ_U300_GPIO_PORT0; |
283 | } | 283 | } |
284 | #define gpio_to_irq gpio_to_irq | ||
284 | 285 | ||
285 | static inline unsigned irq_to_gpio(unsigned irq) | 286 | static inline unsigned irq_to_gpio(unsigned irq) |
286 | { | 287 | { |
diff --git a/arch/arm/mach-versatile/include/mach/gpio.h b/arch/arm/mach-versatile/include/mach/gpio.h index bd11dc503cce..910974bbd83b 100644 --- a/arch/arm/mach-versatile/include/mach/gpio.h +++ b/arch/arm/mach-versatile/include/mach/gpio.h | |||
@@ -1,2 +1 @@ | |||
1 | #define __ARM_GPIOLIB_TRIVIAL | #define __ARM_GPIOLIB_TRIVIAL | |
2 | #define gpio_to_irq __gpio_to_irq | ||
diff --git a/arch/arm/mach-vt8500/include/mach/gpio.h b/arch/arm/mach-vt8500/include/mach/gpio.h index bd11dc503cce..910974bbd83b 100644 --- a/arch/arm/mach-vt8500/include/mach/gpio.h +++ b/arch/arm/mach-vt8500/include/mach/gpio.h | |||
@@ -1,2 +1 @@ | |||
1 | #define __ARM_GPIOLIB_TRIVIAL | #define __ARM_GPIOLIB_TRIVIAL | |
2 | #define gpio_to_irq __gpio_to_irq | ||
diff --git a/arch/arm/mach-w90x900/include/mach/gpio.h b/arch/arm/mach-w90x900/include/mach/gpio.h index 60c784619b2b..e7d4ed156802 100644 --- a/arch/arm/mach-w90x900/include/mach/gpio.h +++ b/arch/arm/mach-w90x900/include/mach/gpio.h | |||
@@ -22,6 +22,7 @@ static inline int gpio_to_irq(unsigned gpio) | |||
22 | { | 22 | { |
23 | return gpio; | 23 | return gpio; |
24 | } | 24 | } |
25 | #define gpio_to_irq gpio_to_irq | ||
25 | 26 | ||
26 | static inline int irq_to_gpio(unsigned irq) | 27 | static inline int irq_to_gpio(unsigned irq) |
27 | { | 28 | { |
diff --git a/arch/arm/plat-nomadik/include/plat/gpio.h b/arch/arm/plat-nomadik/include/plat/gpio.h index c804c3474c85..d2c4290317d9 100644 --- a/arch/arm/plat-nomadik/include/plat/gpio.h +++ b/arch/arm/plat-nomadik/include/plat/gpio.h | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | 16 | ||
17 | #define __ARM_GPIOLIB_TRIVIAL | 17 | #define __ARM_GPIOLIB_TRIVIAL |
18 | #define gpio_to_irq __gpio_to_irq | ||
19 | 18 | ||
20 | /* | 19 | /* |
21 | * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving | 20 | * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving |
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h index 20eedbbcdcb5..f1fdfa5a9cf8 100644 --- a/arch/arm/plat-omap/include/plat/gpio.h +++ b/arch/arm/plat-omap/include/plat/gpio.h | |||
@@ -224,11 +224,6 @@ extern void omap_gpio_restore_context(void); | |||
224 | 224 | ||
225 | #define __ARM_GPIOLIB_TRIVIAL | 225 | #define __ARM_GPIOLIB_TRIVIAL |
226 | 226 | ||
227 | static inline int gpio_to_irq(unsigned gpio) | ||
228 | { | ||
229 | return __gpio_to_irq(gpio); | ||
230 | } | ||
231 | |||
232 | static inline int irq_to_gpio(unsigned irq) | 227 | static inline int irq_to_gpio(unsigned irq) |
233 | { | 228 | { |
234 | int tmp; | 229 | int tmp; |
diff --git a/arch/arm/plat-orion/include/plat/gpio.h b/arch/arm/plat-orion/include/plat/gpio.h index 71c4c6c28e56..985c197aecc3 100644 --- a/arch/arm/plat-orion/include/plat/gpio.h +++ b/arch/arm/plat-orion/include/plat/gpio.h | |||
@@ -16,11 +16,6 @@ | |||
16 | #define __ARM_GPIOLIB_TRIVIAL | 16 | #define __ARM_GPIOLIB_TRIVIAL |
17 | 17 | ||
18 | /* | 18 | /* |
19 | * GENERIC_GPIO primitives. | ||
20 | */ | ||
21 | #define gpio_to_irq __gpio_to_irq | ||
22 | |||
23 | /* | ||
24 | * Orion-specific GPIO API extensions. | 19 | * Orion-specific GPIO API extensions. |
25 | */ | 20 | */ |
26 | void orion_gpio_set_unused(unsigned pin); | 21 | void orion_gpio_set_unused(unsigned pin); |
diff --git a/arch/arm/plat-spear/include/plat/gpio.h b/arch/arm/plat-spear/include/plat/gpio.h index 3c6f04403d9b..22d9e0fc1fcc 100644 --- a/arch/arm/plat-spear/include/plat/gpio.h +++ b/arch/arm/plat-spear/include/plat/gpio.h | |||
@@ -15,6 +15,5 @@ | |||
15 | #define __PLAT_GPIO_H | 15 | #define __PLAT_GPIO_H |
16 | 16 | ||
17 | #define __ARM_GPIOLIB_TRIVIAL | 17 | #define __ARM_GPIOLIB_TRIVIAL |
18 | #define gpio_to_irq __gpio_to_irq | ||
19 | 18 | ||
20 | #endif /* __PLAT_GPIO_H */ | 19 | #endif /* __PLAT_GPIO_H */ |