summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpiolib-sysfs.c
diff options
context:
space:
mode:
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>2024-01-02 18:59:48 +0300
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2024-01-04 12:29:16 +0300
commit1979a28075470ef82472a5656ecc969f901e0d3b (patch)
tree12b01c23e316fe05b646bad05b66d5e03127789a /drivers/gpio/gpiolib-sysfs.c
parent48e1b4d369cfe2729138a128afa6b8a55d093eaf (diff)
downloadlinux-1979a28075470ef82472a5656ecc969f901e0d3b.tar.xz
gpiolib: replace the GPIO device mutex with a read-write semaphore
There are only two spots where we modify (add to or remove objects from) the GPIO device list. Readers should be able to access it concurrently. Replace the mutex with a read-write semaphore and adjust the locking operations accordingly. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib-sysfs.c')
-rw-r--r--drivers/gpio/gpiolib-sysfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
index 2d29ae37d953..4dbf298bb5dd 100644
--- a/drivers/gpio/gpiolib-sysfs.c
+++ b/drivers/gpio/gpiolib-sysfs.c
@@ -773,7 +773,7 @@ int gpiochip_sysfs_register_all(void)
struct gpio_device *gdev;
int ret;
- guard(mutex)(&gpio_devices_lock);
+ guard(rwsem_read)(&gpio_devices_sem);
list_for_each_entry(gdev, &gpio_devices, list) {
if (gdev->mockdev)