Re: [PATCH v3 5/5] gpio: cdev: don't overwrite the whole flags field when configuring lines

From: Kent Gibson

Date: Fri Nov 13 2026 - 01:51:17 EST


On Tue, Nov 10, 2026 at 02:47:05PM +0100, Bartosz Golaszewski wrote:
> linehandle_flags_to_desc_flags() and
> gpio_v2_line_config_flags_to_desc_flags() read the flags word with
> READ_ONCE(), modify the local copy and write it back with WRITE_ONCE().
>
> The per-request config_mutex does not exclude sysfs, the irq core or
> drivers touching the same descriptor, so bits they set or clear
> concurrently can be lost.
>
> Build the mask of bits owned by the line configuration and their new
> values locally and apply them with gpiod_update_flags(). The whole
> group changes in a single atomic step.
>
> While at it: rename the functions whose semantics changed from
> "conversion" to "flags update" accordingly.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: b7adfb6076ff ("gpio: cdev: update flags at once when reconfiguring from user-space")
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
> ---

Reviewed-by: Kent Gibson <warthog618@xxxxxxxxx>

for the series.

Cheers,
Kent.