mbox series

[v2,0/2] gpiolib: protect the list of GPIO devices with a mutex

Message ID 20231208102020.36390-1-brgl@bgdev.pl
Headers show
Series gpiolib: protect the list of GPIO devices with a mutex | expand

Message

Bartosz Golaszewski Dec. 8, 2023, 10:20 a.m. UTC
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

I figured that - since the descriptor locking is going to take some more
time - we should at least start the conversion and protect the GPIO
device list with a mutex.

Patch 2/2 here is actually a v2 of the original submission.

v1 -> v2:
- add a patch renaming two functions
- protect the list in gpio_device_find() too
- coding style tweaks

Bartosz Golaszewski (2):
  gpiolib: rename static functions that are called with the lock taken
  gpiolib: use a mutex to protect the list of GPIO devices

 drivers/gpio/gpiolib-sysfs.c |  26 +-----
 drivers/gpio/gpiolib-sysfs.h |   6 ++
 drivers/gpio/gpiolib.c       | 166 ++++++++++++++++++-----------------
 drivers/gpio/gpiolib.h       |   1 -
 4 files changed, 94 insertions(+), 105 deletions(-)

Comments

Andy Shevchenko Dec. 8, 2023, 2:06 p.m. UTC | #1
On Fri, Dec 08, 2023 at 11:20:19AM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> Rename two functions that read or modify the global GPIO device list but
> don't take the lock themselves (and need to be called with it already
> acquired). Use the _unlocked() suffix which seems to be used quite
> consistently across the kernel despite there also existing the _locked()
> suffix for the same purpose.

Okay,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>