Re: [PATCH 5/5] gpio: cdev: don't overwrite the whole flags field when configuring lines
From: Bartosz Golaszewski
Date: Mon Nov 09 2026 - 05:26:04 EST
On Thu, Nov 05, 2026 at 12:23:45PM +0800, Kent Gibson wrote:
> On Wed, Nov 04, 2026 at 04:37:00PM +0100, Bartosz Golaszewski wrote:
>
> A couple of things not covered in these patches, but related to flag
> consistency:
>
> GPIOD_FLAG_USED_AS_IRQ is used as a lock over GPIOD_FLAG_IRQ_IS_ENABLED.
> e.g. gpiochip_enable_irq() and gpiochip_disable_irq() both warn and drop
> thru if it is not set.
> Yet gpiochip_lock_as_irq() does not check if it is already set, even just to
> raise a warning. Why not?
> Does the updating of those two flags by gpiochip_lock_as_irq() and
> gpiochip_unlock_as_irq() need to be atomic? Not individually atomic but
> as a pair, else they race with gpiochip_enable_irq() and
> gpiochip_disable_irq()?
> Similarly, don't gpiochip_enable_irq() and gpiochip_disable_irq() need
> to perform an atomic test (of GPIOD_FLAG_USED_AS_IRQ) and set
> (of GPIOD_FLAG_IRQ_IS_ENABLED) so as not to race with the lock/unlock?
>
Thanks, I'm adding these to my TODO list. :)
Bart