[RFT PATCH v2 05/14] gpio: axiado-sgpio: create the IRQ domain from the gpio-regmap callback
Andy Shevchenko
andriy.shevchenko at linux.intel.com
Fri Nov 27 10:35:10 PST 2026
On Fri, Nov 27, 2026 at 03:52:22PM +0100, Michael Walle wrote:
> Use the new .create_irq_domain() to actually create the domain. This
> way, there is no window where a NULL pointer could be dereferenced in
> the irq callbacks.
>
> Switch the irq host_data to the gpio_regmap pointer because it will
> already be needed in the irq domain callbacks. Otherwise, the
> .create_irq_domain() callback would have to set the sgpio->gpio pointer
> which looks odd.
>
> Don't use device managed resources anymore. Instead use the new
> .remove_irq_domain() callback. The driver didn't dispose any of the IRQ
> mappings before, although irq_domain_remove() mandates that. Thus add
> that to this callback, too.
...
> +static struct irq_domain *axiado_sgpio_create_irq_domain(struct gpio_regmap *gpio)
> +{
> + struct axiado_sgpio *sgpio = gpio_regmap_get_drvdata(gpio);
> + struct device *dev = regmap_get_device(sgpio->regmap);
> + struct platform_device *pdev = to_platform_device(dev);
> + unsigned int ngpio = sgpio->nsignals * 2;
> + struct irq_domain_info d_info = { };
> +
> + d_info.fwnode = dev_fwnode(&pdev->dev);
> + d_info.size = ngpio;
> + d_info.hwirq_max = ngpio;
> + d_info.ops = &axiado_sgpio_domain_ops;
> + d_info.host_data = gpio;
> +
> + sgpio->domain = irq_domain_instantiate(&d_info);
Same comment here, because it was no devm_*() helper for linear IRQ mappings.
Not sure if we need to consider error pointer after all in each of the
callbacks. We can just check NULL versus not-NULL inside gpio-regmap core.
> + return sgpio->domain;
> +}
--
With Best Regards,
Andy Shevchenko
More information about the linux-arm-kernel
mailing list