[RFT PATCH 04/13] gpio: axiado-sgpio: create the IRQ domain from the gpio-regmap callback

Michael Walle mwalle at kernel.org
Mon Nov 30 02:11:31 PST 2026


On Mon Nov 30, 2026 at 10:39 AM CET, Petar Stepanovic wrote:
>
> On 11/26/2026 4:35 PM, Michael Walle wrote:
>> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
>>
>>
>> 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.
>>
>
> Tested on the Axiado AX3005 SoC using an SGPIO hardware loopback setup.
>
> GPIO read/write operations and rising/falling edge interrupts work as expected. No regressions observed.
>
> Tested-by: Petar Stepanovic <pstepanovic at axiado.com>

Hi,

thanks for the test! In the meantime there was a new version:

https://lore.kernel.org/r/20261127145232.814492-1-mwalle@kernel.org/

Could you give that one a test, too? FWIW, I'll address Andy's
comment and replace the open coded domain instantiation with
irq_domain_create_linear(). Basically this one on top of the v2:

---snip---
--- a/drivers/gpio/gpio-axiado-sgpio.c
+++ b/drivers/gpio/gpio-axiado-sgpio.c
@@ -476,17 +476,13 @@ static struct irq_domain *axiado_sgpio_create_irq_domain(struct gpio_regmap *gpi
 {
 	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);
+	sgpio->domain = irq_domain_create_linear(dev_fwnode(dev),
+						 sgpio->nsignals * 2,
+						 &axiado_sgpio_domain_ops,
+						 gpio);
+	if (!sgpio->domain)
+		return ERR_PTR(-ENOMEM);

 	return sgpio->domain;
 }
---snip---

-michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 297 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20261130/7743eb7f/attachment.sig>


More information about the linux-arm-kernel mailing list