Re: [PATCH v2 4/5] gpiolib: don't overwrite the entire flags field in gpiod_free_commit()
From: Andy Shevchenko
Date: Mon Nov 09 2026 - 16:54:53 EST
On Mon, Nov 09, 2026 at 11:27:08AM +0100, Bartosz Golaszewski wrote:
> Use gpiod_update_flags() to clear all request-related flags in one go
> instead of risking racing with concurrent users and overwriting any
> changes they could have done between READ_ONCE() and WRITE_ONCE().
...
> #include <linux/acpi.h>
> #include <linux/array_size.h>
> #include <linux/bitmap.h>
> +#include <linux/bitops.h>
> #include <linux/cleanup.h>
> #include <linux/compat.h>
> #include <linux/debugfs.h>
No need, bitmap API implies all bitops.
> + set_mask_bits(&desc->flags,
> + BIT(GPIOD_FLAG_ACTIVE_LOW) |
> + BIT(GPIOD_FLAG_REQUESTED) |
> + BIT(GPIOD_FLAG_OPEN_DRAIN) |
> + BIT(GPIOD_FLAG_OPEN_SOURCE) |
> + BIT(GPIOD_FLAG_PULL_UP) |
> + BIT(GPIOD_FLAG_PULL_DOWN) |
> + BIT(GPIOD_FLAG_BIAS_DISABLE) |
> + BIT(GPIOD_FLAG_EDGE_RISING) |
> + BIT(GPIOD_FLAG_EDGE_FALLING) |
> + BIT(GPIOD_FLAG_EVENT_CLOCK_REALTIME) |
> + BIT(GPIOD_FLAG_EVENT_CLOCK_HTE) |
> + BIT(GPIOD_FLAG_IS_HOGGED), 0);
Indentation is broken (and it has spaces, which makes me totally confused what
the point of those spaces in the first place?).
--
With Best Regards,
Andy Shevchenko