Linux GPIO subsystem development
 help / color / mirror / Atom feed
* [PATCH 1/5] pinctrl: ocelot: Propagate errors from optional IRQ lookup
@ 2026-08-10  5:31 phucduc.bui
  2026-08-10  5:31 ` [PATCH 2/5] pinctrl: keembay: " phucduc.bui
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: phucduc.bui @ 2026-08-10  5:31 UTC (permalink / raw)
  To: Linus Walleij, Ray Jui, Scott Branden,
	Broadcom internal kernel review list
  Cc: Mika Westerberg, Andy Shevchenko, robh, linux-gpio,
	linux-arm-kernel, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/pinctrl/pinctrl-ocelot.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c
index 0fe0527863b8..02824da6bcdf 100644
--- a/drivers/pinctrl/pinctrl-ocelot.c
+++ b/drivers/pinctrl/pinctrl-ocelot.c
@@ -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);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/5] pinctrl: keembay: Propagate errors from optional IRQ lookup
  2026-08-10  5:31 [PATCH 1/5] pinctrl: ocelot: Propagate errors from optional IRQ lookup phucduc.bui
@ 2026-08-10  5:31 ` phucduc.bui
  2026-08-10  6:53   ` Andy Shevchenko
  2026-08-10  5:31 ` [PATCH 3/5] pinctrl: lynxpoint: " phucduc.bui
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: phucduc.bui @ 2026-08-10  5:31 UTC (permalink / raw)
  To: Linus Walleij, Ray Jui, Scott Branden,
	Broadcom internal kernel review list
  Cc: Mika Westerberg, Andy Shevchenko, robh, linux-gpio,
	linux-arm-kernel, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/pinctrl/pinctrl-keembay.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-keembay.c b/drivers/pinctrl/pinctrl-keembay.c
index 3241d3ae6219..0b65b186e3c1 100644
--- a/drivers/pinctrl/pinctrl-keembay.c
+++ b/drivers/pinctrl/pinctrl-keembay.c
@@ -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];
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/5] pinctrl: lynxpoint: Propagate errors from optional IRQ lookup
  2026-08-10  5:31 [PATCH 1/5] pinctrl: ocelot: Propagate errors from optional IRQ lookup phucduc.bui
  2026-08-10  5:31 ` [PATCH 2/5] pinctrl: keembay: " phucduc.bui
@ 2026-08-10  5:31 ` phucduc.bui
  2026-08-10  6:56   ` Andy Shevchenko
  2026-08-10  5:31 ` [PATCH 4/5] pinctrl: baytrail: " phucduc.bui
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: phucduc.bui @ 2026-08-10  5:31 UTC (permalink / raw)
  To: Linus Walleij, Ray Jui, Scott Branden,
	Broadcom internal kernel review list
  Cc: Mika Westerberg, Andy Shevchenko, robh, linux-gpio,
	linux-arm-kernel, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/pinctrl/intel/pinctrl-lynxpoint.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pinctrl/intel/pinctrl-lynxpoint.c b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
index 299ee4f22bdc..29df00c86250 100644
--- a/drivers/pinctrl/intel/pinctrl-lynxpoint.c
+++ b/drivers/pinctrl/intel/pinctrl-lynxpoint.c
@@ -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;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/5] pinctrl: baytrail: Propagate errors from optional IRQ lookup
  2026-08-10  5:31 [PATCH 1/5] pinctrl: ocelot: Propagate errors from optional IRQ lookup phucduc.bui
  2026-08-10  5:31 ` [PATCH 2/5] pinctrl: keembay: " phucduc.bui
  2026-08-10  5:31 ` [PATCH 3/5] pinctrl: lynxpoint: " phucduc.bui
@ 2026-08-10  5:31 ` phucduc.bui
  2026-08-10  6:56   ` Andy Shevchenko
  2026-08-10  5:31 ` [PATCH 5/5] pinctrl: bcm: iproc-gpio: " phucduc.bui
  2026-08-10  7:06 ` [PATCH 1/5] pinctrl: ocelot: " Andy Shevchenko
  4 siblings, 1 reply; 10+ messages in thread
From: phucduc.bui @ 2026-08-10  5:31 UTC (permalink / raw)
  To: Linus Walleij, Ray Jui, Scott Branden,
	Broadcom internal kernel review list
  Cc: Mika Westerberg, Andy Shevchenko, robh, linux-gpio,
	linux-arm-kernel, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index b733ec31ad9d..bcc77bf6e811 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -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;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/5] pinctrl: bcm: iproc-gpio: Propagate errors from optional IRQ lookup
  2026-08-10  5:31 [PATCH 1/5] pinctrl: ocelot: Propagate errors from optional IRQ lookup phucduc.bui
                   ` (2 preceding siblings ...)
  2026-08-10  5:31 ` [PATCH 4/5] pinctrl: baytrail: " phucduc.bui
@ 2026-08-10  5:31 ` phucduc.bui
  2026-08-10  6:48   ` Andy Shevchenko
  2026-08-10  7:06 ` [PATCH 1/5] pinctrl: ocelot: " Andy Shevchenko
  4 siblings, 1 reply; 10+ messages in thread
From: phucduc.bui @ 2026-08-10  5:31 UTC (permalink / raw)
  To: Linus Walleij, Ray Jui, Scott Branden,
	Broadcom internal kernel review list
  Cc: Mika Westerberg, Andy Shevchenko, robh, linux-gpio,
	linux-arm-kernel, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
index e20f7dc79d43..025476e251c2 100644
--- a/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
+++ b/drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
@@ -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;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 5/5] pinctrl: bcm: iproc-gpio: Propagate errors from optional IRQ lookup
  2026-08-10  5:31 ` [PATCH 5/5] pinctrl: bcm: iproc-gpio: " phucduc.bui
@ 2026-08-10  6:48   ` Andy Shevchenko
  0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2026-08-10  6:48 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Linus Walleij, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Mika Westerberg,
	Andy Shevchenko, robh, linux-gpio, linux-arm-kernel, linux-kernel

On Mon, Aug 10, 2026 at 8:32 AM <phucduc.bui@gmail.com> wrote:
>
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> 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.

...

>         /* optional GPIO interrupt support */
>         irq = platform_get_irq_optional(pdev, 0);
> +       if (irq < 0 && irq != -ENXIO)
> +               return irq;

Here and everywhere else in the similar contributions you made all
over the kernel:

>         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.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/5] pinctrl: keembay: Propagate errors from optional IRQ lookup
  2026-08-10  5:31 ` [PATCH 2/5] pinctrl: keembay: " phucduc.bui
@ 2026-08-10  6:53   ` Andy Shevchenko
  0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2026-08-10  6:53 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Linus Walleij, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Mika Westerberg,
	Andy Shevchenko, robh, linux-gpio, linux-arm-kernel, linux-kernel

On Mon, Aug 10, 2026 at 8:32 AM <phucduc.bui@gmail.com> wrote:
>
> 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.

While this looks okay, have you considered actually having the
platform_get_irq_optional() to be optional in this sense?

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] pinctrl: baytrail: Propagate errors from optional IRQ lookup
  2026-08-10  5:31 ` [PATCH 4/5] pinctrl: baytrail: " phucduc.bui
@ 2026-08-10  6:56   ` Andy Shevchenko
  0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2026-08-10  6:56 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Linus Walleij, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Mika Westerberg,
	Andy Shevchenko, robh, linux-gpio, linux-arm-kernel, linux-kernel

On Mon, Aug 10, 2026 at 8:32 AM <phucduc.bui@gmail.com> wrote:
>
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> 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.

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?

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/5] pinctrl: lynxpoint: Propagate errors from optional IRQ lookup
  2026-08-10  5:31 ` [PATCH 3/5] pinctrl: lynxpoint: " phucduc.bui
@ 2026-08-10  6:56   ` Andy Shevchenko
  0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2026-08-10  6:56 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Linus Walleij, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Mika Westerberg,
	Andy Shevchenko, robh, linux-gpio, linux-arm-kernel, linux-kernel

On Mon, Aug 10, 2026 at 8:32 AM <phucduc.bui@gmail.com> wrote:

> 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.

Same comment as per Bay Trail version.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5] pinctrl: ocelot: Propagate errors from optional IRQ lookup
  2026-08-10  5:31 [PATCH 1/5] pinctrl: ocelot: Propagate errors from optional IRQ lookup phucduc.bui
                   ` (3 preceding siblings ...)
  2026-08-10  5:31 ` [PATCH 5/5] pinctrl: bcm: iproc-gpio: " phucduc.bui
@ 2026-08-10  7:06 ` Andy Shevchenko
  4 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2026-08-10  7:06 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Linus Walleij, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Mika Westerberg,
	Andy Shevchenko, robh, linux-gpio, linux-arm-kernel, linux-kernel

On Mon, Aug 10, 2026 at 8:32 AM <phucduc.bui@gmail.com> wrote:
>
> 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.

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.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-08-10  7:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-10  5:31 [PATCH 1/5] pinctrl: ocelot: Propagate errors from optional IRQ lookup phucduc.bui
2026-08-10  5:31 ` [PATCH 2/5] pinctrl: keembay: " phucduc.bui
2026-08-10  6:53   ` Andy Shevchenko
2026-08-10  5:31 ` [PATCH 3/5] pinctrl: lynxpoint: " phucduc.bui
2026-08-10  6:56   ` Andy Shevchenko
2026-08-10  5:31 ` [PATCH 4/5] pinctrl: baytrail: " phucduc.bui
2026-08-10  6:56   ` Andy Shevchenko
2026-08-10  5:31 ` [PATCH 5/5] pinctrl: bcm: iproc-gpio: " phucduc.bui
2026-08-10  6:48   ` Andy Shevchenko
2026-08-10  7:06 ` [PATCH 1/5] pinctrl: ocelot: " Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox