* [PATCH v1] gpio: mlxbf3: only get IRQ for device instance 0
@ 2025-06-13 16:34 David Thompson
2025-06-16 7:58 ` Bartosz Golaszewski
2025-06-18 10:20 ` Bartosz Golaszewski
0 siblings, 2 replies; 4+ messages in thread
From: David Thompson @ 2025-06-13 16:34 UTC (permalink / raw)
To: linus.walleij, brgl
Cc: linux-gpio, linux-kernel, David Thompson, Shravan Kumar Ramani
The gpio-mlxbf3 driver interfaces with two GPIO controllers,
device instance 0 and 1. There is a single IRQ resource shared
between the two controllers, and it is found in the ACPI table for
device instance 0. The driver should not attempt to get an IRQ
resource when probing device instance 1, otherwise the following
error is logged:
mlxbf3_gpio MLNXBF33:01: error -ENXIO: IRQ index 0 not found
Signed-off-by: David Thompson <davthompson@nvidia.com>
Reviewed-by: Shravan Kumar Ramani <shravankr@nvidia.com>
---
drivers/gpio/gpio-mlxbf3.c | 54 ++++++++++++++++++++++++--------------
1 file changed, 35 insertions(+), 19 deletions(-)
diff --git a/drivers/gpio/gpio-mlxbf3.c b/drivers/gpio/gpio-mlxbf3.c
index 10ea71273c89..9875e34bde72 100644
--- a/drivers/gpio/gpio-mlxbf3.c
+++ b/drivers/gpio/gpio-mlxbf3.c
@@ -190,7 +190,9 @@ static int mlxbf3_gpio_probe(struct platform_device *pdev)
struct mlxbf3_gpio_context *gs;
struct gpio_irq_chip *girq;
struct gpio_chip *gc;
+ char *colon_ptr;
int ret, irq;
+ long num;
gs = devm_kzalloc(dev, sizeof(*gs), GFP_KERNEL);
if (!gs)
@@ -227,25 +229,39 @@ static int mlxbf3_gpio_probe(struct platform_device *pdev)
gc->owner = THIS_MODULE;
gc->add_pin_ranges = mlxbf3_gpio_add_pin_ranges;
- irq = platform_get_irq(pdev, 0);
- if (irq >= 0) {
- girq = &gs->gc.irq;
- gpio_irq_chip_set_chip(girq, &gpio_mlxbf3_irqchip);
- girq->default_type = IRQ_TYPE_NONE;
- /* This will let us handle the parent IRQ in the driver */
- girq->num_parents = 0;
- girq->parents = NULL;
- girq->parent_handler = NULL;
- girq->handler = handle_bad_irq;
-
- /*
- * Directly request the irq here instead of passing
- * a flow-handler because the irq is shared.
- */
- ret = devm_request_irq(dev, irq, mlxbf3_gpio_irq_handler,
- IRQF_SHARED, dev_name(dev), gs);
- if (ret)
- return dev_err_probe(dev, ret, "failed to request IRQ");
+ colon_ptr = strchr(dev_name(dev), ':');
+ if (!colon_ptr) {
+ dev_err(dev, "invalid device name format\n");
+ return -EINVAL;
+ }
+
+ ret = kstrtol(++colon_ptr, 16, &num);
+ if (ret) {
+ dev_err(dev, "invalid device instance\n");
+ return ret;
+ }
+
+ if (!num) {
+ irq = platform_get_irq(pdev, 0);
+ if (irq >= 0) {
+ girq = &gs->gc.irq;
+ gpio_irq_chip_set_chip(girq, &gpio_mlxbf3_irqchip);
+ girq->default_type = IRQ_TYPE_NONE;
+ /* This will let us handle the parent IRQ in the driver */
+ girq->num_parents = 0;
+ girq->parents = NULL;
+ girq->parent_handler = NULL;
+ girq->handler = handle_bad_irq;
+
+ /*
+ * Directly request the irq here instead of passing
+ * a flow-handler because the irq is shared.
+ */
+ ret = devm_request_irq(dev, irq, mlxbf3_gpio_irq_handler,
+ IRQF_SHARED, dev_name(dev), gs);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to request IRQ");
+ }
}
platform_set_drvdata(pdev, gs);
--
2.43.2
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v1] gpio: mlxbf3: only get IRQ for device instance 0
2025-06-13 16:34 [PATCH v1] gpio: mlxbf3: only get IRQ for device instance 0 David Thompson
@ 2025-06-16 7:58 ` Bartosz Golaszewski
2025-06-17 20:17 ` David Thompson
2025-06-18 10:20 ` Bartosz Golaszewski
1 sibling, 1 reply; 4+ messages in thread
From: Bartosz Golaszewski @ 2025-06-16 7:58 UTC (permalink / raw)
To: David Thompson
Cc: linus.walleij, linux-gpio, linux-kernel, Shravan Kumar Ramani
On Fri, Jun 13, 2025 at 6:35 PM David Thompson <davthompson@nvidia.com> wrote:
>
> The gpio-mlxbf3 driver interfaces with two GPIO controllers,
> device instance 0 and 1. There is a single IRQ resource shared
> between the two controllers, and it is found in the ACPI table for
> device instance 0. The driver should not attempt to get an IRQ
> resource when probing device instance 1, otherwise the following
> error is logged:
> mlxbf3_gpio MLNXBF33:01: error -ENXIO: IRQ index 0 not found
>
> Signed-off-by: David Thompson <davthompson@nvidia.com>
> Reviewed-by: Shravan Kumar Ramani <shravankr@nvidia.com>
> ---
This looks like a fix, does it miss the Fixes: and Cc: stable tags?
Bartosz
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH v1] gpio: mlxbf3: only get IRQ for device instance 0
2025-06-16 7:58 ` Bartosz Golaszewski
@ 2025-06-17 20:17 ` David Thompson
0 siblings, 0 replies; 4+ messages in thread
From: David Thompson @ 2025-06-17 20:17 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: linus.walleij, linux-gpio, linux-kernel, Shravan Ramani
> -----Original Message-----
> From: Bartosz Golaszewski <brgl@bgdev.pl>
> Sent: Monday, June 16, 2025 3:59 AM
> To: David Thompson <davthompson@nvidia.com>
> Cc: linus.walleij@linaro.org; linux-gpio@vger.kernel.org; linux-
> kernel@vger.kernel.org; Shravan Ramani <shravankr@nvidia.com>
> Subject: Re: [PATCH v1] gpio: mlxbf3: only get IRQ for device instance 0
>
> On Fri, Jun 13, 2025 at 6:35 PM David Thompson <davthompson@nvidia.com>
> wrote:
> >
> > The gpio-mlxbf3 driver interfaces with two GPIO controllers, device
> > instance 0 and 1. There is a single IRQ resource shared between the
> > two controllers, and it is found in the ACPI table for device instance
> > 0. The driver should not attempt to get an IRQ resource when probing
> > device instance 1, otherwise the following error is logged:
> > mlxbf3_gpio MLNXBF33:01: error -ENXIO: IRQ index 0 not found
> >
> > Signed-off-by: David Thompson <davthompson@nvidia.com>
> > Reviewed-by: Shravan Kumar Ramani <shravankr@nvidia.com>
> > ---
>
> This looks like a fix, does it miss the Fixes: and Cc: stable tags?
>
> Bartosz
Hello Bartosz,
Yes, good point. Since this patch is a fix, it should have the following tag:
Fixes: cd33f216d241 ("gpio: mlxbf3: Add gpio driver support")
Do you want me to create a v2 with the above Fixes tag and send out,
this time including to CC:stable@vger.kernel.org?
Regards, Dave
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] gpio: mlxbf3: only get IRQ for device instance 0
2025-06-13 16:34 [PATCH v1] gpio: mlxbf3: only get IRQ for device instance 0 David Thompson
2025-06-16 7:58 ` Bartosz Golaszewski
@ 2025-06-18 10:20 ` Bartosz Golaszewski
1 sibling, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2025-06-18 10:20 UTC (permalink / raw)
To: linus.walleij, brgl, David Thompson
Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Shravan Kumar Ramani
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
On Fri, 13 Jun 2025 16:34:43 +0000, David Thompson wrote:
> The gpio-mlxbf3 driver interfaces with two GPIO controllers,
> device instance 0 and 1. There is a single IRQ resource shared
> between the two controllers, and it is found in the ACPI table for
> device instance 0. The driver should not attempt to get an IRQ
> resource when probing device instance 1, otherwise the following
> error is logged:
> mlxbf3_gpio MLNXBF33:01: error -ENXIO: IRQ index 0 not found
>
> [...]
Applied, thanks!
[1/1] gpio: mlxbf3: only get IRQ for device instance 0
https://git.kernel.org/brgl/linux/c/10af0273a35ab4513ca1546644b8c853044da134
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-06-18 10:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-13 16:34 [PATCH v1] gpio: mlxbf3: only get IRQ for device instance 0 David Thompson
2025-06-16 7:58 ` Bartosz Golaszewski
2025-06-17 20:17 ` David Thompson
2025-06-18 10:20 ` Bartosz Golaszewski
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®