Re: [PATCH 6/6] gpiolib: let the character device free its IRQs first on chip removal
From: Adrian Ambrozewicz
Date: Fri Oct 16 2026 - 03:49:31 EST
On Tue, Oct 13, 2026 at 07:05:13PM +0300, Andy Shevchenko wrote:
> > + mutex_init(&lr->config_mutex);
>
> You might also want to add the respective mutex_destroy() calls.
Will add both.
> > + irq = gc->to_irq(gc, gpiod_hwgpio(desc));
> > + if (irq <= 0)
>
> Are you sure about 0?
Yes. 0 is no IRQ: gpiod_to_irq() turns a 0 from ->to_irq() into
-ENXIO ("Zero means NO_IRQ"), and the code this replaces went through
gpiod_to_irq(), so it never got past a 0 either. With "irq < 0" a 0
would reach irq_to_desc(0), and on some architectures that finds a
descriptor that has nothing to do with this chip.
> This can be combined with the above, right?
>
> if (gc->to_irq)
> irq = gc->to_irq(gc, gpiod_hwgpio(desc));
> else
> irq = -ENOENT;
> if (irq < 0)
> return;
Yes, v2 combines them that way, with 0 for the missing callback and
the check kept at "irq <= 0".
Adrian