[PATCH 2/5] gpio: shared: use atomic set_bit() for descriptor flags

From: Bartosz Golaszewski

Date: Wed Nov 04 2026 - 10:49:43 EST


Use the atomic set_bit() instead of __set_bit() on desc->flags so that
every modification of the field uses atomic bitops. No functional change
as these run before any line of the chip can be requested.

Cc: stable@xxxxxxxxxxxxxxx
Fixes: eb374f764a70 ("gpio: provide gpiod_is_shared()")
Fixes: 310a4a9cbb17 ("gpio: shared: shorten the critical section in gpiochip_setup_shared()")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
---
drivers/gpio/gpiolib-shared.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpiolib-shared.c b/drivers/gpio/gpiolib-shared.c
index 8c9ac9d9330490b17fb3936b8758beb97a308a15..d94fb94f31c2f487d2e45924e11c33570466a0f1 100644
--- a/drivers/gpio/gpiolib-shared.c
+++ b/drivers/gpio/gpiolib-shared.c
@@ -532,8 +532,8 @@ int gpiochip_setup_shared(struct gpio_chip *gc)
* This is a shared GPIO proxy. Mark its
* descriptor as such and return here.
*/
- __set_bit(GPIOD_FLAG_SHARED_PROXY,
- &gdev->descs[0].flags);
+ set_bit(GPIOD_FLAG_SHARED_PROXY,
+ &gdev->descs[0].flags);
return 0;
}
}
@@ -573,7 +573,7 @@ int gpiochip_setup_shared(struct gpio_chip *gc)

desc = &gdev->descs[entry->offset];

- __set_bit(GPIOD_FLAG_SHARED, &desc->flags);
+ set_bit(GPIOD_FLAG_SHARED, &desc->flags);
/*
* Shared GPIOs are not requested via the normal path. Make
* them inaccessible to anyone even before we register the

--
2.47.3