diff options
author | Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> | 2008-10-29 17:14:54 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-10-30 10:41:50 -0400 |
commit | 9c6568501cbf731a910db2fcb7d094977dcb154c (patch) | |
tree | dda2ce4a1a7cd65134328fe4f199bff810ab4ba6 | |
parent | 63890a0ee1af994122094bd01f87ea6251631a3f (diff) |
[ARM] gpio_free might sleep, arm architecture
According to the documentation gpio_free should only be called from task
context only. To make this more explicit add a might sleep to all
implementations.
This patch changes the gpio_free implementations for the arm architecture.
DaVinci is skipped on purpose to simplify the merge process for patches
switching it over to use gpiolib as per request by David Brownell.
Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Cc: David Brownell <david-b@pacbell.net>
Cc: Andrew Victor <linux@maxim.org.za>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-at91/include/mach/gpio.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-imx/include/mach/gpio.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/include/mach/gpio.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-ks8695/include/mach/gpio.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/gpio.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/gpio.c | 2 |
6 files changed, 15 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h index 76d76e2fa69e..bffa6741a751 100644 --- a/arch/arm/mach-at91/include/mach/gpio.h +++ b/arch/arm/mach-at91/include/mach/gpio.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #ifndef __ASM_ARCH_AT91RM9200_GPIO_H | 13 | #ifndef __ASM_ARCH_AT91RM9200_GPIO_H |
14 | #define __ASM_ARCH_AT91RM9200_GPIO_H | 14 | #define __ASM_ARCH_AT91RM9200_GPIO_H |
15 | 15 | ||
16 | #include <linux/kernel.h> | ||
16 | #include <asm/irq.h> | 17 | #include <asm/irq.h> |
17 | 18 | ||
18 | #define PIN_BASE NR_AIC_IRQS | 19 | #define PIN_BASE NR_AIC_IRQS |
@@ -220,6 +221,7 @@ static inline int gpio_request(unsigned gpio, const char *label) | |||
220 | 221 | ||
221 | static inline void gpio_free(unsigned gpio) | 222 | static inline void gpio_free(unsigned gpio) |
222 | { | 223 | { |
224 | might_sleep(); | ||
223 | } | 225 | } |
224 | 226 | ||
225 | extern int gpio_direction_input(unsigned gpio); | 227 | extern int gpio_direction_input(unsigned gpio); |
diff --git a/arch/arm/mach-imx/include/mach/gpio.h b/arch/arm/mach-imx/include/mach/gpio.h index 6e3d795f2264..502d5aa2c093 100644 --- a/arch/arm/mach-imx/include/mach/gpio.h +++ b/arch/arm/mach-imx/include/mach/gpio.h | |||
@@ -1,5 +1,6 @@ | |||
1 | #ifndef _IMX_GPIO_H | 1 | #ifndef _IMX_GPIO_H |
2 | 2 | ||
3 | #include <linux/kernel.h> | ||
3 | #include <mach/imx-regs.h> | 4 | #include <mach/imx-regs.h> |
4 | 5 | ||
5 | #define IMX_GPIO_ALLOC_MODE_NORMAL 0 | 6 | #define IMX_GPIO_ALLOC_MODE_NORMAL 0 |
@@ -63,6 +64,8 @@ static inline int gpio_request(unsigned gpio, const char *label) | |||
63 | 64 | ||
64 | static inline void gpio_free(unsigned gpio) | 65 | static inline void gpio_free(unsigned gpio) |
65 | { | 66 | { |
67 | might_sleep(); | ||
68 | |||
66 | imx_gpio_free(gpio); | 69 | imx_gpio_free(gpio); |
67 | } | 70 | } |
68 | 71 | ||
diff --git a/arch/arm/mach-ixp4xx/include/mach/gpio.h b/arch/arm/mach-ixp4xx/include/mach/gpio.h index 9fbde177920f..cd5aec26c072 100644 --- a/arch/arm/mach-ixp4xx/include/mach/gpio.h +++ b/arch/arm/mach-ixp4xx/include/mach/gpio.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #ifndef __ASM_ARCH_IXP4XX_GPIO_H | 25 | #ifndef __ASM_ARCH_IXP4XX_GPIO_H |
26 | #define __ASM_ARCH_IXP4XX_GPIO_H | 26 | #define __ASM_ARCH_IXP4XX_GPIO_H |
27 | 27 | ||
28 | #include <linux/kernel.h> | ||
28 | #include <mach/hardware.h> | 29 | #include <mach/hardware.h> |
29 | 30 | ||
30 | static inline int gpio_request(unsigned gpio, const char *label) | 31 | static inline int gpio_request(unsigned gpio, const char *label) |
@@ -34,6 +35,8 @@ static inline int gpio_request(unsigned gpio, const char *label) | |||
34 | 35 | ||
35 | static inline void gpio_free(unsigned gpio) | 36 | static inline void gpio_free(unsigned gpio) |
36 | { | 37 | { |
38 | might_sleep(); | ||
39 | |||
37 | return; | 40 | return; |
38 | } | 41 | } |
39 | 42 | ||
diff --git a/arch/arm/mach-ks8695/include/mach/gpio.h b/arch/arm/mach-ks8695/include/mach/gpio.h index 73c84168761c..d4af5c335f16 100644 --- a/arch/arm/mach-ks8695/include/mach/gpio.h +++ b/arch/arm/mach-ks8695/include/mach/gpio.h | |||
@@ -11,6 +11,8 @@ | |||
11 | #ifndef __ASM_ARCH_GPIO_H_ | 11 | #ifndef __ASM_ARCH_GPIO_H_ |
12 | #define __ASM_ARCH_GPIO_H_ | 12 | #define __ASM_ARCH_GPIO_H_ |
13 | 13 | ||
14 | #include <linux/kernel.h> | ||
15 | |||
14 | #define KS8695_GPIO_0 0 | 16 | #define KS8695_GPIO_0 0 |
15 | #define KS8695_GPIO_1 1 | 17 | #define KS8695_GPIO_1 1 |
16 | #define KS8695_GPIO_2 2 | 18 | #define KS8695_GPIO_2 2 |
@@ -74,6 +76,7 @@ static inline int gpio_request(unsigned int pin, const char *label) | |||
74 | 76 | ||
75 | static inline void gpio_free(unsigned int pin) | 77 | static inline void gpio_free(unsigned int pin) |
76 | { | 78 | { |
79 | might_sleep(); | ||
77 | } | 80 | } |
78 | 81 | ||
79 | #endif | 82 | #endif |
diff --git a/arch/arm/mach-ns9xxx/gpio.c b/arch/arm/mach-ns9xxx/gpio.c index 5241e6a286cc..5503ca09c4ae 100644 --- a/arch/arm/mach-ns9xxx/gpio.c +++ b/arch/arm/mach-ns9xxx/gpio.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * under the terms of the GNU General Public License version 2 as published by | 8 | * under the terms of the GNU General Public License version 2 as published by |
9 | * the Free Software Foundation. | 9 | * the Free Software Foundation. |
10 | */ | 10 | */ |
11 | #include <linux/kernel.h> | ||
11 | #include <linux/compiler.h> | 12 | #include <linux/compiler.h> |
12 | #include <linux/init.h> | 13 | #include <linux/init.h> |
13 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
@@ -63,6 +64,7 @@ EXPORT_SYMBOL(gpio_request); | |||
63 | 64 | ||
64 | void gpio_free(unsigned gpio) | 65 | void gpio_free(unsigned gpio) |
65 | { | 66 | { |
67 | might_sleep(); | ||
66 | clear_bit(gpio, gpiores); | 68 | clear_bit(gpio, gpiores); |
67 | return; | 69 | return; |
68 | } | 70 | } |
diff --git a/arch/arm/mach-orion5x/gpio.c b/arch/arm/mach-orion5x/gpio.c index fc419868e39f..f99d08811e5a 100644 --- a/arch/arm/mach-orion5x/gpio.c +++ b/arch/arm/mach-orion5x/gpio.c | |||
@@ -165,6 +165,8 @@ EXPORT_SYMBOL(gpio_request); | |||
165 | 165 | ||
166 | void gpio_free(unsigned pin) | 166 | void gpio_free(unsigned pin) |
167 | { | 167 | { |
168 | might_sleep(); | ||
169 | |||
168 | if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) { | 170 | if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) { |
169 | pr_debug("%s: invalid GPIO %d\n", __func__, pin); | 171 | pr_debug("%s: invalid GPIO %d\n", __func__, pin); |
170 | return; | 172 | return; |