]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM] gpio_free might sleep, arm architecture
authorUwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Wed, 29 Oct 2008 21:14:54 +0000 (14:14 -0700)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 30 Oct 2008 14:41:50 +0000 (14:41 +0000)
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>
arch/arm/mach-at91/include/mach/gpio.h
arch/arm/mach-imx/include/mach/gpio.h
arch/arm/mach-ixp4xx/include/mach/gpio.h
arch/arm/mach-ks8695/include/mach/gpio.h
arch/arm/mach-ns9xxx/gpio.c
arch/arm/mach-orion5x/gpio.c

index 76d76e2fa69ef108021b521291f728cc79152182..bffa6741a7515d890179b7a4f1db286287539fcf 100644 (file)
@@ -13,6 +13,7 @@
 #ifndef __ASM_ARCH_AT91RM9200_GPIO_H
 #define __ASM_ARCH_AT91RM9200_GPIO_H
 
+#include <linux/kernel.h>
 #include <asm/irq.h>
 
 #define PIN_BASE               NR_AIC_IRQS
@@ -220,6 +221,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+       might_sleep();
 }
 
 extern int gpio_direction_input(unsigned gpio);
index 6e3d795f22642c3d4301dba5f185ce6d968589bd..502d5aa2c093dad2b00acd22e5564bbfad7a21a6 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef _IMX_GPIO_H
 
+#include <linux/kernel.h>
 #include <mach/imx-regs.h>
 
 #define IMX_GPIO_ALLOC_MODE_NORMAL     0
@@ -63,6 +64,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+       might_sleep();
+
        imx_gpio_free(gpio);
 }
 
index 9fbde177920f74bf8f741ca2924a4f9cdf339030..cd5aec26c072d3d218cd171ad8cb02635529ba84 100644 (file)
@@ -25,6 +25,7 @@
 #ifndef __ASM_ARCH_IXP4XX_GPIO_H
 #define __ASM_ARCH_IXP4XX_GPIO_H
 
+#include <linux/kernel.h>
 #include <mach/hardware.h>
 
 static inline int gpio_request(unsigned gpio, const char *label)
@@ -34,6 +35,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+       might_sleep();
+
        return;
 }
 
index 73c84168761ce4bf34decb42a536da6b16653d4b..d4af5c335f1616aace85c43a4fa6b57f25c21006 100644 (file)
@@ -11,6 +11,8 @@
 #ifndef __ASM_ARCH_GPIO_H_
 #define __ASM_ARCH_GPIO_H_
 
+#include <linux/kernel.h>
+
 #define KS8695_GPIO_0          0
 #define KS8695_GPIO_1          1
 #define KS8695_GPIO_2          2
@@ -74,6 +76,7 @@ static inline int gpio_request(unsigned int pin, const char *label)
 
 static inline void gpio_free(unsigned int pin)
 {
+       might_sleep();
 }
 
 #endif
index 5241e6a286cc83fc70a7281c82712137ac9e747c..5503ca09c4aee4a1d2dc8e5a249ddb6e9c31814a 100644 (file)
@@ -8,6 +8,7 @@
  * under the terms of the GNU General Public License version 2 as published by
  * the Free Software Foundation.
  */
+#include <linux/kernel.h>
 #include <linux/compiler.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
@@ -63,6 +64,7 @@ EXPORT_SYMBOL(gpio_request);
 
 void gpio_free(unsigned gpio)
 {
+       might_sleep();
        clear_bit(gpio, gpiores);
        return;
 }
index fc419868e39fae9670401c652e5d86b4191ae5e0..f99d08811e5af6487bb31120f2b8f8433ba17c23 100644 (file)
@@ -165,6 +165,8 @@ EXPORT_SYMBOL(gpio_request);
 
 void gpio_free(unsigned pin)
 {
+       might_sleep();
+
        if (pin >= GPIO_MAX || !test_bit(pin, gpio_valid)) {
                pr_debug("%s: invalid GPIO %d\n", __func__, pin);
                return;