Re: [PATCH v2 07/11] gpio: Add revocable provider handle for struct gpio_chip

From: Tzung-Bi Shih

Date: Thu Feb 05 2026 - 03:52:28 EST


On Wed, Feb 04, 2026 at 07:58:44AM -0500, Bartosz Golaszewski wrote:
> On Tue, 3 Feb 2026 07:10:54 +0100, Tzung-Bi Shih <tzungbi@xxxxxxxxxx> said:
> > diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
> > index 3abb90385829..cd136d5b52e9 100644
> > --- a/drivers/gpio/gpiolib.h
> > +++ b/drivers/gpio/gpiolib.h
> > @@ -52,6 +52,7 @@
> > * @device_notifier: used to notify character device wait queues about the GPIO
> > * device being unregistered
> > * @srcu: protects the pointer to the underlying GPIO chip
> > + * @chip_rp: revocable provider handle for the corresponding struct gpio_chip.
> > * @pin_ranges: range of pins served by the GPIO driver
> > *
> > * This state container holds most of the runtime variable data
> > @@ -79,6 +80,7 @@ struct gpio_device {
> > struct workqueue_struct *line_state_wq;
> > struct blocking_notifier_head device_notifier;
> > struct srcu_struct srcu;
> > + struct revocable_provider __rcu *chip_rp;
> >
>
> Why __rcu? This doesn't live in a different address space, only the internal
> resource it protects does. If anything - this could be __attribute__((noderef))
> but even that is questionable as this is an opaque structure.

For fixing a race on the pointer itself. See also [1].

[1] https://lore.kernel.org/all/20260129143733.45618-2-tzungbi@xxxxxxxxxx