]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
gpio_free might sleep, generic part
authorUwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Thu, 16 Oct 2008 05:03:12 +0000 (22:03 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 16 Oct 2008 18:21:40 +0000 (11:21 -0700)
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 is the generic part which changes gpiolib and the fallback
implementation only.

Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/gpio/gpiolib.c
include/linux/gpio.h

index 8d2940517c99221c33e3bf200ac53a82214cebee..317004fd94fbb6908e40e8f0b7482a887845ce13 100644 (file)
@@ -792,6 +792,8 @@ void gpio_free(unsigned gpio)
        unsigned long           flags;
        struct gpio_desc        *desc;
 
+       might_sleep();
+
        if (!gpio_is_valid(gpio)) {
                WARN_ON(extra_checks);
                return;
index 730a20b83576b4ab39d81810085c20d61eec0225..e10c49a5b96e9ed300d670871af2edbaaf23add1 100644 (file)
@@ -8,6 +8,7 @@
 
 #else
 
+#include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 
@@ -32,6 +33,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+       might_sleep();
+
        /* GPIO can never have been requested */
        WARN_ON(1);
 }