aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpio/gpiolib.c2
-rw-r--r--include/linux/gpio.h3
2 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 8d2940517c99..317004fd94fb 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -792,6 +792,8 @@ void gpio_free(unsigned gpio)
792 unsigned long flags; 792 unsigned long flags;
793 struct gpio_desc *desc; 793 struct gpio_desc *desc;
794 794
795 might_sleep();
796
795 if (!gpio_is_valid(gpio)) { 797 if (!gpio_is_valid(gpio)) {
796 WARN_ON(extra_checks); 798 WARN_ON(extra_checks);
797 return; 799 return;
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 730a20b83576..e10c49a5b96e 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -8,6 +8,7 @@
8 8
9#else 9#else
10 10
11#include <linux/kernel.h>
11#include <linux/types.h> 12#include <linux/types.h>
12#include <linux/errno.h> 13#include <linux/errno.h>
13 14
@@ -32,6 +33,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
32 33
33static inline void gpio_free(unsigned gpio) 34static inline void gpio_free(unsigned gpio)
34{ 35{
36 might_sleep();
37
35 /* GPIO can never have been requested */ 38 /* GPIO can never have been requested */
36 WARN_ON(1); 39 WARN_ON(1);
37} 40}