[PATCH v3 2/5] gpio: shared: use atomic set_bit() for descriptor flags
From: Bartosz Golaszewski
Date: Tue Nov 10 2026 - 08:52:25 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: a060b8c511ab ("gpiolib: implement low-level, shared GPIO support")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
---
drivers/gpio/gpiolib-shared.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpiolib-shared.c b/drivers/gpio/gpiolib-shared.c
index 8c9ac9d9330490b17fb3936b8758beb97a308a15..7faa5109617018af84896163f3602ff7dc2ab62f 100644
--- a/drivers/gpio/gpiolib-shared.c
+++ b/drivers/gpio/gpiolib-shared.c
@@ -532,8 +532,7 @@ 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 +572,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