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

Bartosz Golaszewski
2026-02-18T10:28:22Z

On Fri, Feb 13, 2026 at 10:31 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
>
> The underlying chip can be removed asynchronously. `gdev->srcu` is used
> to ensure the synchronization before accessing `gdev->chip`.
>
> Revocable encapsulates the details. Add revocable provider handle for
> the corresponding struct gpio_chip in struct gpio_device so that it can
> start to hide the synchronization details.
>
> diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
> index 3abb90385829..56643f40e87e 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 *chip_rp;

I like it much better than with __rcu but see my comment under the
revocable series: is there any reason why we can't do:

struct revocable chip_rp;

?

Bartosz