pinctrl: ocelot: Propagate errors from optional IRQ lookup
Subsystems (5)
PATCH 1/5 pinctrl: ocelot: Propagate errors from optional IRQ lookup
From: bui duc phuc <[email protected]>
platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no optional IRQ is available, while other errors should be propagated.
Propagate all error codes returned by platform_get_irq_optional() other than -ENXIO.
--- drivers/pinctrl/pinctrl-ocelot.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/pinctrl-ocelot.c +2 -0
@@ -2369,6 +2369,8 @@ static int ocelot_gpiochip_register(struct platform_device *pdev, gc->label ="ocelot-gpio" ; irq =platform_get_irq_optional (pdev,0 ); +if (irq <0 && irq != -ENXIO ) +return irq;if (irq >0 ) { girq = &gc->irq;gpio_irq_chip_set_chip (girq, &ocelot_irqchip);
Signature · 1 line
2.43.0
PATCH 2/5 pinctrl: keembay: Propagate errors from optional IRQ lookup
From: bui duc phuc <[email protected]>
platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no optional IRQ is available, while other errors should be propagated.
Propagate all error codes returned by platform_get_irq_optional() other than -ENXIO.
--- drivers/pinctrl/pinctrl-keembay.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/pinctrl-keembay.c +3 -1
@@ -1497,8 +1497,10 @@ static int keembay_gpiochip_probe(struct keembay_pinctrl *kpc,int irq; irq =platform_get_irq_optional (pdev, i); -if (irq <=0 ) +if (irq == -ENXIO )continue ; +if (irq <0 ) +return irq; girq->parents[i] = irq; kmb_irq->line = girq->parents[i];
Signature · 1 line
2.43.0
Re: [PATCH 2/5] pinctrl: keembay: Propagate errors from optional IRQ lookup
Quoted 7 lines · On Mon, Aug 10, 2026 at 8:32 AM <[email protected]> wrote:
platform_get_irq_optional()returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ,-ENXIOindicates that no optional IRQ is available, while other errors should be propagated.Propagate all error codes returned by
platform_get_irq_optional()other than-ENXIO.
While this looks okay, have you considered actually having the platform_get_irq_optional() to be optional in this sense?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 2/5] pinctrl: keembay: Propagate errors from optional IRQ lookup
Hi Andy,
Thank you for your review .
Quoted 4 lines
While this looks okay, have you considered actually having the
platform_get_irq_optional()to be optional in this sense?
As I understand it, if we decide to use platform_get_irq_optional(), then -ENXIO should be handled as the expected case where the IRQ is not available.
If we do not want to handle -ENXIO as an optional IRQ, then I think we should use platform_get_irq() instead, which matches its intended semantics:
https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/base/platform.c#L301
-------------------------------
ret = platform_get_irq_optional(dev, num);
if (ret < 0)
return dev_err_probe(&dev->dev, ret,
"IRQ index %u not found\n", num);-------------------------------
In my opinion, we should not use an optional API if the IRQ is not actually intended to be optional.
Best regards,
Phuc
Re: [PATCH 2/5] pinctrl: keembay: Propagate errors from optional IRQ lookup
Quoted 6 lines · Bui Duc Phuc
Quoted 2 lines
While this looks okay, have you considered actually having the
platform_get_irq_optional()to be optional in this sense?As I understand it, if we decide to use
platform_get_irq_optional(), then-ENXIOshould be handled as the expected case where the IRQ is not available.
If platform_get_irq_optional() was optional, it would return 0 instead of ENXIO (and avoid printing any message in such a case).
Quoted 9 lines
If we do not want to handle
-ENXIOas an optional IRQ, then I think we should useplatform_get_irq()instead, which matches its intended semantics:https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/base/platform.c#L301
-------------------------------
ret =platform_get_irq_optional(dev, num);
if (ret < 0)
Quoted 6 lines
return dev_err_probe(&dev->dev, ret, "IRQ index %u not found\n", num);-------------------------------
In my opinion, we should not use an optional API if the IRQ is not actually intended to be optional.
Right. But does it suit for this driver?
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 3/5 pinctrl: lynxpoint: Propagate errors from optional IRQ lookup
In reply to [email protected]From: bui duc phuc <[email protected]>
platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no optional IRQ is available, while other errors should be propagated.
Propagate all error codes returned by platform_get_irq_optional() other than -ENXIO.
--- drivers/pinctrl/intel/pinctrl-lynxpoint.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/intel/pinctrl-lynxpoint.c +2 -0
@@ -777,6 +777,8 @@ static int lp_gpio_probe(struct platform_device *pdev)/* set up interrupts */ irq =platform_get_irq_optional (pdev,0 ); +if (irq <0 && irq != -ENXIO ) +return irq;if (irq >0 ) {struct gpio_irq_chip *girq;
Signature · 1 line
2.43.0
Re: [PATCH 3/5] pinctrl: lynxpoint: Propagate errors from optional IRQ lookup
Quoted 6 lines · On Mon, Aug 10, 2026 at 8:32 AM <[email protected]> wrote:
platform_get_irq_optional()returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ,-ENXIOindicates that no optional IRQ is available, while other errors should be propagated.Propagate all error codes returned by
platform_get_irq_optional()other than-ENXIO.
Same comment as per Bay Trail version.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 4/5 pinctrl: baytrail: Propagate errors from optional IRQ lookup
In reply to [email protected]From: bui duc phuc <[email protected]>
platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no optional IRQ is available, while other errors should be propagated.
Propagate all error codes returned by platform_get_irq_optional() other than -ENXIO.
--- drivers/pinctrl/intel/pinctrl-baytrail.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/intel/pinctrl-baytrail.c +2 -0
@@ -1533,6 +1533,8 @@ static int byt_gpio_probe(struct intel_pinctrl *vg)/* set up interrupts */ irq =platform_get_irq_optional (pdev,0 ); +if (irq <0 && irq != -ENXIO ) +return irq;if (irq >0 ) {struct gpio_irq_chip *girq;
Signature · 1 line
2.43.0
Re: [PATCH 4/5] pinctrl: baytrail: Propagate errors from optional IRQ lookup
Quoted 9 lines · On Mon, Aug 10, 2026 at 8:32 AM <[email protected]> wrote:
From: bui duc phuc <[email protected]>
platform_get_irq_optional()returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ,-ENXIOindicates that no optional IRQ is available, while other errors should be propagated.Propagate all error codes returned by
platform_get_irq_optional()other than-ENXIO.
On this platform (ACPI-based) there are no other possibilities to get something meaningful that can be returned (deferred probe). The rest of the error codes will actually regress since the user won't have a pin control driver at all, instead of having it IRQ-less (which is doubtfully useful, though). Have you considered that scenario?
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 5/5 pinctrl: bcm: iproc-gpio: Propagate errors from optional IRQ lookup
In reply to [email protected]From: bui duc phuc <[email protected]>
platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no optional IRQ is available, while other errors should be propagated.
Propagate all error codes returned by platform_get_irq_optional() other than -ENXIO.
--- drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c +2 -0
@@ -873,6 +873,8 @@ static int iproc_gpio_probe(struct platform_device *pdev)/* optional GPIO interrupt support */ irq =platform_get_irq_optional (pdev,0 ); +if (irq <0 && irq != -ENXIO ) +return irq;if (irq >0 ) {struct gpio_irq_chip *girq;
Signature · 1 line
2.43.0
Re: [PATCH 5/5] pinctrl: bcm: iproc-gpio: Propagate errors from optional IRQ lookup
Quoted 9 lines · On Mon, Aug 10, 2026 at 8:32 AM <[email protected]> wrote:
From: bui duc phuc <[email protected]>
platform_get_irq_optional()returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ,-ENXIOindicates that no optional IRQ is available, while other errors should be propagated.Propagate all error codes returned by
platform_get_irq_optional()other than-ENXIO.
...
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c static int iproc_gpio_probe(struct platform_device *pdev) · line 877
Quoted 4 lines
/* optional GPIO interrupt support */ irq = platform_get_irq_optional(pdev, 0);drivers/pinctrl/bcm/pinctrl-iproc-gpio.c +2
-0+if (irq <0 && irq != -ENXIO ) +return irq;
Here and everywhere else in the similar contributions you made all over the kernel:
Quoted 2 lines
if (irq > 0) {
struct gpio_irq_chip *girq;Use the 'else' branch instead of the above.
} else if (irq != -ENXIO) {
return irq;
But before doing that, check carefully if this is really what we want to have and how it will affect the driver behaviour in such a case.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 7 lines · On Mon, Aug 10, 2026 at 8:32 AM <[email protected]> wrote:
platform_get_irq_optional()returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ,-ENXIOindicates that no optional IRQ is available, while other errors should be propagated.Propagate all error codes returned by
platform_get_irq_optional()other than-ENXIO.
Same comments. It may or may not be okay to have such a change. The less disruptive one is to check only for a deferred probe.
Signature · 2 lines
With Best Regards, Andy Shevchenko