mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/4] gpio: realtek-otto: Handle errors from optional IRQ lookup
@ 2026-08-14  4:30 phucduc.bui
  2026-08-14  4:30 ` [PATCH 2/4] gpio: mlxbf3: " phucduc.bui
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: phucduc.bui @ 2026-08-14  4:30 UTC (permalink / raw)
  To: Adrian Ng, Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: 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. Other errors, such as -EPROBE_DEFER
and -EINVAL, should be propagated so that the caller can handle them
appropriately.

Propagate negative errors other than -ENXIO.

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

diff --git a/drivers/gpio/gpio-realtek-otto.c b/drivers/gpio/gpio-realtek-otto.c
index 4a606bad5848..5d7d28a26544 100644
--- a/drivers/gpio/gpio-realtek-otto.c
+++ b/drivers/gpio/gpio-realtek-otto.c
@@ -423,6 +423,8 @@ static int realtek_gpio_probe(struct platform_device *pdev)
 	ctrl->chip.gc.owner = THIS_MODULE;
 
 	irq = platform_get_irq_optional(pdev, 0);
+	if (irq < 0 && irq != -ENXIO)
+		return irq;
 	if (!(dev_flags & GPIO_INTERRUPTS_DISABLED) && irq > 0) {
 		girq = &ctrl->chip.gc.irq;
 		gpio_irq_chip_set_chip(girq, &realtek_gpio_irq_chip);
-- 
2.43.0


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

* [PATCH 2/4] gpio: mlxbf3: Handle errors from optional IRQ lookup
  2026-08-14  4:30 [PATCH 1/4] gpio: realtek-otto: Handle errors from optional IRQ lookup phucduc.bui
@ 2026-08-14  4:30 ` phucduc.bui
  2026-08-14  4:30 ` [PATCH 3/4] gpio: mlxbf2: " phucduc.bui
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: phucduc.bui @ 2026-08-14  4:30 UTC (permalink / raw)
  To: Adrian Ng, Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: 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. Other errors, such as -EPROBE_DEFER
and -EINVAL, should be propagated so that the caller can handle them
appropriately.

Propagate negative errors other than -ENXIO.

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

diff --git a/drivers/gpio/gpio-mlxbf3.c b/drivers/gpio/gpio-mlxbf3.c
index 566326644a2c..929f64c5140a 100644
--- a/drivers/gpio/gpio-mlxbf3.c
+++ b/drivers/gpio/gpio-mlxbf3.c
@@ -231,7 +231,9 @@ static int mlxbf3_gpio_probe(struct platform_device *pdev)
 	gc->add_pin_ranges = mlxbf3_gpio_add_pin_ranges;
 
 	irq = platform_get_irq_optional(pdev, 0);
-	if (irq >= 0) {
+	if (irq < 0 && irq != -ENXIO)
+		return irq;
+	if (irq > 0) {
 		girq = &gs->chip.gc.irq;
 		gpio_irq_chip_set_chip(girq, &gpio_mlxbf3_irqchip);
 		girq->default_type = IRQ_TYPE_NONE;
-- 
2.43.0


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

* [PATCH 3/4] gpio: mlxbf2: Handle errors from optional IRQ lookup
  2026-08-14  4:30 [PATCH 1/4] gpio: realtek-otto: Handle errors from optional IRQ lookup phucduc.bui
  2026-08-14  4:30 ` [PATCH 2/4] gpio: mlxbf3: " phucduc.bui
@ 2026-08-14  4:30 ` phucduc.bui
  2026-08-14  4:30 ` [PATCH 4/4] gpio: altera: " phucduc.bui
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: phucduc.bui @ 2026-08-14  4:30 UTC (permalink / raw)
  To: Adrian Ng, Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: 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. Other errors, such as -EPROBE_DEFER
and -EINVAL, should be propagated so that the caller can handle them
appropriately.

Propagate negative errors other than -ENXIO.

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

diff --git a/drivers/gpio/gpio-mlxbf2.c b/drivers/gpio/gpio-mlxbf2.c
index 4e2f3381d82b..4e5c5d196a50 100644
--- a/drivers/gpio/gpio-mlxbf2.c
+++ b/drivers/gpio/gpio-mlxbf2.c
@@ -394,7 +394,9 @@ mlxbf2_gpio_probe(struct platform_device *pdev)
 	gc->owner = THIS_MODULE;
 
 	irq = platform_get_irq_optional(pdev, 0);
-	if (irq >= 0) {
+	if (irq < 0 && irq != -ENXIO)
+		return irq;
+	if (irq > 0) {
 		girq = &gs->chip.gc.irq;
 		gpio_irq_chip_set_chip(girq, &mlxbf2_gpio_irq_chip);
 		girq->handler = handle_simple_irq;
-- 
2.43.0


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

* [PATCH 4/4] gpio: altera: Handle errors from optional IRQ lookup
  2026-08-14  4:30 [PATCH 1/4] gpio: realtek-otto: Handle errors from optional IRQ lookup phucduc.bui
  2026-08-14  4:30 ` [PATCH 2/4] gpio: mlxbf3: " phucduc.bui
  2026-08-14  4:30 ` [PATCH 3/4] gpio: mlxbf2: " phucduc.bui
@ 2026-08-14  4:30 ` phucduc.bui
  2026-09-01 15:55 ` [PATCH 1/4] gpio: realtek-otto: " Bartosz Golaszewski
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: phucduc.bui @ 2026-08-14  4:30 UTC (permalink / raw)
  To: Adrian Ng, Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: 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. Other errors, such as -EPROBE_DEFER
and -EINVAL, should be propagated so that the caller can handle them
appropriately.

Propagate negative errors other than -ENXIO.

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

diff --git a/drivers/gpio/gpio-altera.c b/drivers/gpio/gpio-altera.c
index 532e3360b70e..d22f5be00745 100644
--- a/drivers/gpio/gpio-altera.c
+++ b/drivers/gpio/gpio-altera.c
@@ -220,8 +220,11 @@ static int altera_gpio_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	mapped_irq = platform_get_irq_optional(pdev, 0);
-	if (mapped_irq < 0)
+	if (mapped_irq < 0) {
+		if (irq != -ENXIO)
+			return irq;
 		goto skip_irq;
+	}
 
 	if (device_property_read_u32(dev, "altr,interrupt-type", &reg)) {
 		dev_err(&pdev->dev,
-- 
2.43.0


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

* Re: [PATCH 1/4] gpio: realtek-otto: Handle errors from optional IRQ lookup
  2026-08-14  4:30 [PATCH 1/4] gpio: realtek-otto: Handle errors from optional IRQ lookup phucduc.bui
                   ` (2 preceding siblings ...)
  2026-08-14  4:30 ` [PATCH 4/4] gpio: altera: " phucduc.bui
@ 2026-09-01 15:55 ` Bartosz Golaszewski
  2026-09-14 11:56 ` Linus Walleij
  2026-09-28  9:57 ` Andy Shevchenko
  5 siblings, 0 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2026-09-01 15:55 UTC (permalink / raw)
  To: Adrian Ng, Linus Walleij, Bartosz Golaszewski, linux-gpio,
	linux-kernel, phucduc.bui
  Cc: Bartosz Golaszewski


On Fri, 14 Aug 2026 11:30:25 +0700, 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. Other errors, such as -EPROBE_DEFER
> and -EINVAL, should be propagated so that the caller can handle them
> appropriately.
> 
> Propagate negative errors other than -ENXIO.
> 
> [...]

Applied, thanks!

[1/4] gpio: realtek-otto: Handle errors from optional IRQ lookup
      https://git.kernel.org/brgl/c/ef0d275786a3c98d1e52f1d4d89183c802af58db
[2/4] gpio: mlxbf3: Handle errors from optional IRQ lookup
      https://git.kernel.org/brgl/c/53ffd779a094d5752551dea2ba7bc787aab29229
[3/4] gpio: mlxbf2: Handle errors from optional IRQ lookup
      https://git.kernel.org/brgl/c/d8aaf6b0fdc835d10c7def7775803b28ebfd4d81
[4/4] gpio: altera: Handle errors from optional IRQ lookup
      https://git.kernel.org/brgl/c/6e6e585b603e4f679c2a33c8f0954ec88b52fd7a

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

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

* Re: [PATCH 1/4] gpio: realtek-otto: Handle errors from optional IRQ lookup
  2026-08-14  4:30 [PATCH 1/4] gpio: realtek-otto: Handle errors from optional IRQ lookup phucduc.bui
                   ` (3 preceding siblings ...)
  2026-09-01 15:55 ` [PATCH 1/4] gpio: realtek-otto: " Bartosz Golaszewski
@ 2026-09-14 11:56 ` Linus Walleij
  2026-09-28  9:57 ` Andy Shevchenko
  5 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2026-09-14 11:56 UTC (permalink / raw)
  To: phucduc.bui; +Cc: Adrian Ng, Bartosz Golaszewski, linux-gpio, linux-kernel

On Fri, Aug 14, 2026 at 6:30 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. Other errors, such as -EPROBE_DEFER
> and -EINVAL, should be propagated so that the caller can handle them
> appropriately.
>
> Propagate negative errors other than -ENXIO.
>
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>

Looks good to me.
Reviewed-by: Linus Walleij <linusw@kernel.org>

Yours,
Linus Walleij

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

* Re: [PATCH 1/4] gpio: realtek-otto: Handle errors from optional IRQ lookup
  2026-08-14  4:30 [PATCH 1/4] gpio: realtek-otto: Handle errors from optional IRQ lookup phucduc.bui
                   ` (4 preceding siblings ...)
  2026-09-14 11:56 ` Linus Walleij
@ 2026-09-28  9:57 ` Andy Shevchenko
  5 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-09-28  9:57 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Adrian Ng, Linus Walleij, Bartosz Golaszewski, linux-gpio, linux-kernel

On Fri, Aug 14, 2026 at 11:30:25AM +0700, 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. Other errors, such as -EPROBE_DEFER
> and -EINVAL, should be propagated so that the caller can handle them
> appropriately.
> 
> Propagate negative errors other than -ENXIO.

Have you read the discussion [1]?
It would be better to make platform_get_irq_optional() to be actually optional.

[1]: https://lore.kernel.org/lkml/20220212201631.12648-1-s.shtylyov@omp.ru/

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2026-09-28  9:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-14  4:30 [PATCH 1/4] gpio: realtek-otto: Handle errors from optional IRQ lookup phucduc.bui
2026-08-14  4:30 ` [PATCH 2/4] gpio: mlxbf3: " phucduc.bui
2026-08-14  4:30 ` [PATCH 3/4] gpio: mlxbf2: " phucduc.bui
2026-08-14  4:30 ` [PATCH 4/4] gpio: altera: " phucduc.bui
2026-09-01 15:55 ` [PATCH 1/4] gpio: realtek-otto: " Bartosz Golaszewski
2026-09-14 11:56 ` Linus Walleij
2026-09-28  9:57 ` Andy Shevchenko

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

all inboxes | Powered by JetHome®