On Tue, 3 Feb 2026 07:10:56 +0100, Tzung-Bi Shih <[email protected]> said:
> Struct gpio_device now provides a revocable provider to the underlying
> struct gpio_chip. Leverage revocable for accessing the struct
> gpio_chip instead of using gpio_chip_guard.
>
> Signed-off-by: Tzung-Bi Shih <[email protected]>
> --
[snip]
> diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
> index cd136d5b52e9..ce6273cc74f2 100644
> --- a/drivers/gpio/gpiolib.h
> +++ b/drivers/gpio/gpiolib.h
> @@ -224,27 +224,6 @@ struct gpio_desc {
>
> #define gpiod_not_found(desc) (IS_ERR(desc) && PTR_ERR(desc)
> == -ENOENT)
>
> -struct gpio_chip_guard {
> - struct gpio_device *gdev;
> - struct gpio_chip *gc;
> - int idx;
> -};
> -
> -DEFINE_CLASS(gpio_chip_guard,
> - struct gpio_chip_guard,
> - srcu_read_unlock(&_T.gdev->srcu, _T.idx),
> - ({
> - struct gpio_chip_guard _guard;
> -
> - _guard.gdev = desc->gdev;
> - _guard.idx = srcu_read_lock(&_guard.gdev->srcu);
> - _guard.gc = srcu_dereference(_guard.gdev->chip,
> - &_guard.gdev->srcu);
> -
> - _guard;
> - }),
> - struct gpio_desc *desc)
> -
Ah, yes, I'll gladly export this into someone else's header. :)
Bart