[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=MdYeoMxNFYeX_9S-M286aUjnsxLyy9_apmfPR4NeqVouw@mail.gmail.com>
Date: Wed, 4 Feb 2026 07:58:44 -0500
From: Bartosz Golaszewski <brgl@...nel.org>
To: Tzung-Bi Shih <tzungbi@...nel.org>
Cc: Jonathan Corbet <corbet@....net>, Shuah Khan <shuah@...nel.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Wolfram Sang <wsa+renesas@...g-engineering.com>, Jason Gunthorpe <jgg@...dia.com>,
Johan Hovold <johan@...nel.org>, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, chrome-platform@...ts.linux.dev,
Dan Williams <dan.j.williams@...el.com>, linux-gpio@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>,
Danilo Krummrich <dakr@...nel.org>, Bartosz Golaszewski <brgl@...ev.pl>, Linus Walleij <linusw@...nel.org>
Subject: Re: [PATCH v2 07/11] gpio: Add revocable provider handle for struct gpio_chip
On Tue, 3 Feb 2026 07:10:54 +0100, Tzung-Bi Shih <tzungbi@...nel.org> said:
> 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.
>
> Signed-off-by: Tzung-Bi Shih <tzungbi@...nel.org>
> ---
[snip]
> 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.
Bart
> #ifdef CONFIG_PINCTRL
> /*
> --
> 2.53.0.rc2.204.g2597b5adb4-goog
>
>
Powered by blists - more mailing lists