summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpiolib.h
diff options
context:
space:
mode:
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>2023-12-15 16:53:00 +0100
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2023-12-18 10:00:43 +0100
commit65a828bab15887b33336d251fd659b2ae86de6d6 (patch)
tree3b33dddd67f9d8914c1034ea0d09cf47723a77df /drivers/gpio/gpiolib.h
parentf95fd4ac155733b5735c84a2e56eee8321232095 (diff)
gpiolib: use a mutex to protect the list of GPIO devices
The global list of GPIO devices is never modified or accessed from atomic context so it's fine to protect it using a mutex. Add a new global lock dedicated to the gpio_devices list and use it whenever accessing or modifying it. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/gpio/gpiolib.h')
-rw-r--r--drivers/gpio/gpiolib.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
index 3ccacf3c1288..8142b5cbc395 100644
--- a/drivers/gpio/gpiolib.h
+++ b/drivers/gpio/gpiolib.h
@@ -15,6 +15,7 @@
#include <linux/gpio/consumer.h> /* for enum gpiod_flags */
#include <linux/gpio/driver.h>
#include <linux/module.h>
+#include <linux/mutex.h>
#include <linux/notifier.h>
#include <linux/rwsem.h>
@@ -136,6 +137,7 @@ int gpiod_set_transitory(struct gpio_desc *desc, bool transitory);
extern spinlock_t gpio_lock;
extern struct list_head gpio_devices;
+extern struct mutex gpio_devices_lock;
void gpiod_line_state_notify(struct gpio_desc *desc, unsigned long action);