diff options
-rw-r--r-- | drivers/gpio/gpiolib.c | 2 | ||||
-rw-r--r-- | include/linux/gpio.h | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 8d2940517c9..317004fd94f 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -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; diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 730a20b8357..e10c49a5b96 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h @@ -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); } |