gpiolib: use a mutex to protect the list of GPIO devices
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 15 Dec 2023 15:53:00 +0000 (16:53 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 18 Dec 2023 09:00:43 +0000 (10:00 +0100)
commit65a828bab15887b33336d251fd659b2ae86de6d6
tree3b33dddd67f9d8914c1034ea0d09cf47723a77df
parentf95fd4ac155733b5735c84a2e56eee8321232095
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>
drivers/gpio/gpiolib-sysfs.c
drivers/gpio/gpiolib-sysfs.h
drivers/gpio/gpiolib.c
drivers/gpio/gpiolib.h