On Tue, Feb 3, 2026 at 7:12 AM Tzung-Bi Shih <[email protected]> wrote:
>
> Struct gpio_device now provides a revocable provider to the underlying
> struct gpio_chip. Leverage revocable for accessing the struct
> gpio_chip.
>
> Signed-off-by: Tzung-Bi Shih <[email protected]>
> ---
[snip]
> @@ -1432,10 +1433,10 @@ static long linereq_ioctl(struct file *file, unsigned
> int cmd,
> {
> struct linereq *lr = file->private_data;
> void __user *ip = (void __user *)arg;
> + struct gpio_chip *gc;
>
> - guard(srcu)(&lr->gdev->srcu);
> -
> - if (!rcu_access_pointer(lr->gdev->chip))
> + REVOCABLE_TRY_ACCESS_WITH(lr->gdev->chip_rp, gc);
> + if (!gc)
> return -ENODEV;
>
If we're doing this, then I'd love to see something that actually
makes the code smaller like:
REVOCABLE_TRY_ACCESS_WITH_OR_RETURN(lr->gdev->chip_rp, gc, -ENODEV);
which would allow dropping the repeated checks.
Bart