Skip to contentSkip to conversation

gpio-mlxbf2: use platform_get_irq_optional()

PATCH Applied David Thompson 3 participants 4 messages Jul 28, 2025 – Aug 3, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 gpio-mlxbf2: use platform_get_irq_optional()

The gpio-mlxbf2 driver interfaces with four GPIO controllers, device instances 0-3. There are two IRQ resources shared between the four controllers, and they are found in the ACPI table for instances 0 and 3. The driver should not use platform_get_irq(), otherwise this error is logged when probing instances 1 and 2:
mlxbf2_gpio MLNXBF22:01: error -ENXIO: IRQ index 0 not found

Fixes 2b725265cb08 ("gpio: mlxbf2: Introduce IRQ support")

---
v4: updated logic to simply use platform_get_irq_optional()
v3: added version history
v2: added tag "Cc: [email protected]"

 drivers/gpio/gpio-mlxbf2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-mlxbf2.c +1 -1
index 6f3dda6b635f..390f2e74a9d8 100644
@@ -397,7 +397,7 @@ mlxbf2_gpio_probe(struct platform_device *pdev)
 	gc->ngpio = npins;
 	gc->owner = THIS_MODULE;
 
-	irq = platform_get_irq(pdev, 0);
+	irq = platform_get_irq_optional(pdev, 0);
 	if (irq >= 0) {
 		girq = &gs->gc.irq;
 		gpio_irq_chip_set_chip(girq, &mlxbf2_gpio_irq_chip);
Signature · 1 line
2.43.2
#1 lore raw
Quoted 34 lines · David Thompson

The gpio-mlxbf2 driver interfaces with four GPIO controllers, device instances 0-3. There are two IRQ resources shared between the four controllers, and they are found in the ACPI table for instances 0 and 3. The driver should not use platform_get_irq(), otherwise this error is logged when probing instances 1 and 2:
mlxbf2_gpio MLNXBF22:01: error -ENXIO: IRQ index 0 not found

Fixes 2b725265cb08 ("gpio: mlxbf2: Introduce IRQ support")

---
v4: updated logic to simply use platform_get_irq_optional()
v3: added version history
v2: added tag "Cc: [email protected]"

 drivers/gpio/gpio-mlxbf2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-mlxbf2.c +1 -2
index 6f3dda6b635f..390f2e74a9d8 100644
@@ -397,7 +397,7 @@ mlxbf2_gpio_probe(struct platform_device *pdev)
        gc->ngpio = npins;
        gc->owner = THIS_MODULE;
 
-       irq = platform_get_irq(pdev, 0);
+       irq = platform_get_irq_optional(pdev, 0);
        if (irq >= 0) {
                girq = &gs->gc.irq;
                gpio_irq_chip_set_chip(girq, &mlxbf2_gpio_irq_chip);
--
Quoted 2 lines

2.43.2

Cc'ed Andy and Mika for review.

Bartosz

Reviewed-by
#2 lore raw
Quoted 29 lines · Bartosz Golaszewski
Quoted 28 lines · David Thompson

The gpio-mlxbf2 driver interfaces with four GPIO controllers, device instances 0-3. There are two IRQ resources shared between the four controllers, and they are found in the ACPI table for instances 0 and 3. The driver should not use platform_get_irq(), otherwise this error is logged when probing instances 1 and 2:
mlxbf2_gpio MLNXBF22:01: error -ENXIO: IRQ index 0 not found

Fixes 2b725265cb08 ("gpio: mlxbf2: Introduce IRQ support")

---
v4: updated logic to simply use platform_get_irq_optional()
v3: added version history
v2: added tag "Cc: [email protected]"

 drivers/gpio/gpio-mlxbf2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-mlxbf2.c +0 -0
index 6f3dda6b635f..390f2e74a9d8 100644
@@ -397,7 +397,7 @@ mlxbf2_gpio_probe(struct platform_device *pdev)
        gc->ngpio = npins;
        gc->owner = THIS_MODULE;
 
Quoted 10 lines
Quoted 8 lines
drivers/gpio/gpio-mlxbf2.c +1 -2
-       irq = platform_get_irq(pdev, 0);
+       irq = platform_get_irq_optional(pdev, 0);
        if (irq >= 0) {
                girq = &gs->gc.irq;
                gpio_irq_chip_set_chip(girq, &mlxbf2_gpio_irq_chip);
--

2.43.2

Cc'ed Andy and Mika for review.

Looks good to me,

#3 lore raw
In reply to David Thompson

From: Bartosz Golaszewski <[email protected]>

Quoted 8 lines · David Thompson

The gpio-mlxbf2 driver interfaces with four GPIO controllers, device instances 0-3. There are two IRQ resources shared between the four controllers, and they are found in the ACPI table for instances 0 and 3. The driver should not use platform_get_irq(), otherwise this error is logged when probing instances 1 and 2:
mlxbf2_gpio MLNXBF22:01: error -ENXIO: IRQ index 0 not found

[...]

Subject should have been: "gpio: mlxbf2: ..."

Applied, thanks!

[1/1] gpio-mlxbf2: use platform_get_irq_optional()

      https://git.kernel.org/brgl/linux/c/63c7bc53a35e785accdc2ceab8f72d94501931ab

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>