Re: [PATCH v8 8/8] gpiolib: remove the shared GPIO proxies before freeing the remaining IRQs

From: Kent Gibson

Date: Tue Nov 24 2026 - 09:08:43 EST


On Tue, Nov 24, 2026 at 11:20:39AM +0200, Adrian Ambrozewicz wrote:
> gpio_shared_proxy_to_irq() returns the parent chip's IRQ, so an edge
> request on a proxy line holds an IRQ of the parent.
>
> When the parent is removed, gpiochip_remove() frees the IRQs still
> requested on its lines before it removes the proxies in
> gpio_device_teardown_shared(). The release of a proxy line request is
> serialized only with the proxy's own removal notifier, so if
> gpiod_free_irqs() frees the IRQ between the release's irq_has_action()
> check and its free_irq(), free_irq() warns:
>
> Trying to free already-free IRQ 22
>
> Remove the proxies first, so the character device on each proxy frees
> its IRQs before the rest are forcibly freed.
>
> Reproduced on arm64 QEMU with a shared gpio-sim line and a test delay
> before the release's free_irq(): 3 of 3 runs warned; with this change,
> none.
>
> This patch depends on patch 7 of this series.
>

Reviewed-by: Kent Gibson <warthog618@xxxxxxxxx>

Cheers,
Kent.