[RFT PATCH 00/13] gpio: regmap: IRQ domain cleanups
Andy Shevchenko
andriy.shevchenko at linux.intel.com
Thu Nov 26 12:48:26 PST 2026
On Thu, Nov 26, 2026 at 04:35:11PM +0100, Michael Walle wrote:
> The gpio-regmap provides two different variants to attach an IRQ
> domain to the gpio-regmap instance, either via .irq_domain or via
> .regmap_irq_chip. The former even has a small window where a
> consumer requesting an interrupt leads to a NULL pointer
> dereference. This also came up during sashiko reviews [1].
>
> It turns out, that it is impossible to create an external IRQ domain
> without a race while the gpio-regmap instance isn't created yet.
> That is because it will already use the gpio-regmap provided
> callbacks. Thus, with this patch series, gpio-regmap will now
> provide a callback for the individual drivers used to create an IRQ
> domain when all necessary fields are filled.
>
> To move even further and cover the most common use case of having a
> regmap-irq domain, gpio-regmap now provides a helper that can be
> used in the .create_irq_domain() callback.
>
> We need Long Zhao's patch [2] not only for ACPI but also for the
> regmap-irq handling. If the IRQ domain is removed before the
> gpio_chip, gpiochip_remove() would use the already freed domain to
> free the remaining interrupts.
>
> All the users of regmap-irq are switched over to this new helper.
> Finally, the last patch, removes the old variants.
>
> There is one change in behavior: because all regmap-irq domains use
> the gpio_regmap_irq_{reqres,relres}() helpers now, interrupt lines
> are now locked and cannot be switched to output. But that shouldn't
> be an issue anyway.
It's so elegant solution, my full support!
Reviewed-by: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
(I had something more complicated in mind.)
> This was mostly only compile-time tested. So please test. I'll do a
> proper test on the sl28 board tomorrow, but since Long already
> asked, I wanted to have this out for comments and testing.
I'm not sure I can help with testing (all our HW seems do not use this).
Only regression test for other users might be done, but I need to check
if we have platform that has an HW with the driver that uses gpio-regmap.
> [1] https://lore.kernel.org/r/20261123040142.48880-1-joseph@telaak.dev
> [2] https://lore.kernel.org/r/20261118-cv75-gpio-v15-3-e3c563673fe1@ambarella.com
--
With Best Regards,
Andy Shevchenko
More information about the linux-arm-kernel
mailing list