linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] gpio: mlxbf3: revert device name logic
@ 2025-08-11 17:50 David Thompson
  2025-08-11 17:50 ` [PATCH v1 1/2] Revert "gpio: mlxbf3: only get IRQ for device instance 0" David Thompson
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: David Thompson @ 2025-08-11 17:50 UTC (permalink / raw)
  To: linus.walleij, brgl, andriy.shevchenko, mika.westerberg
  Cc: linux-gpio, linux-kernel, David Thompson

This series reverts the use of device name processing
in the BlueField-3 GPIO driver "probe()".  Instead, the
kernel API "platform_get_irq_optional()" should be used
to prevent errors being logged.

David Thompson (2):
  Revert "gpio: mlxbf3: only get IRQ for device instance 0"
  gpio: mlxbf3: use platform_get_irq_optional()

 drivers/gpio/gpio-mlxbf3.c | 54 ++++++++++++++------------------------
 1 file changed, 19 insertions(+), 35 deletions(-)

-- 
2.43.2


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

* [PATCH v1 1/2] Revert "gpio: mlxbf3: only get IRQ for device instance 0"
  2025-08-11 17:50 [PATCH v1 0/2] gpio: mlxbf3: revert device name logic David Thompson
@ 2025-08-11 17:50 ` David Thompson
  2025-08-12 13:43   ` Bartosz Golaszewski
  2025-08-11 17:50 ` [PATCH v1 2/2] gpio: mlxbf3: use platform_get_irq_optional() David Thompson
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: David Thompson @ 2025-08-11 17:50 UTC (permalink / raw)
  To: linus.walleij, brgl, andriy.shevchenko, mika.westerberg
  Cc: linux-gpio, linux-kernel, David Thompson, stable

This reverts commit 10af0273a35ab4513ca1546644b8c853044da134.

While this change was merged, it is not the preferred solution.
During review of a similar change to the gpio-mlxbf2 driver, the
use of "platform_get_irq_optional" was identified as the preferred
solution, so let's use it for gpio-mlxbf3 driver as well.

Cc: stable@vger.kernel.org
Fixes: 10af0273a35a ("gpio: mlxbf3: only get IRQ for device instance 0")
Signed-off-by: David Thompson <davthompson@nvidia.com>
---
 drivers/gpio/gpio-mlxbf3.c | 54 ++++++++++++++------------------------
 1 file changed, 19 insertions(+), 35 deletions(-)

diff --git a/drivers/gpio/gpio-mlxbf3.c b/drivers/gpio/gpio-mlxbf3.c
index 9875e34bde72..10ea71273c89 100644
--- a/drivers/gpio/gpio-mlxbf3.c
+++ b/drivers/gpio/gpio-mlxbf3.c
@@ -190,9 +190,7 @@ 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)
@@ -229,39 +227,25 @@ static int mlxbf3_gpio_probe(struct platform_device *pdev)
 	gc->owner = THIS_MODULE;
 	gc->add_pin_ranges = mlxbf3_gpio_add_pin_ranges;
 
-	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");
-		}
+	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 related	[flat|nested] 8+ messages in thread

* [PATCH v1 2/2] gpio: mlxbf3: use platform_get_irq_optional()
  2025-08-11 17:50 [PATCH v1 0/2] gpio: mlxbf3: revert device name logic David Thompson
  2025-08-11 17:50 ` [PATCH v1 1/2] Revert "gpio: mlxbf3: only get IRQ for device instance 0" David Thompson
@ 2025-08-11 17:50 ` David Thompson
  2025-08-11 20:35   ` Andy Shevchenko
  2025-08-11 20:36 ` [PATCH v1 0/2] gpio: mlxbf3: revert device name logic Andy Shevchenko
  2025-08-12 13:42 ` Bartosz Golaszewski
  3 siblings, 1 reply; 8+ messages in thread
From: David Thompson @ 2025-08-11 17:50 UTC (permalink / raw)
  To: linus.walleij, brgl, andriy.shevchenko, mika.westerberg
  Cc: linux-gpio, linux-kernel, David Thompson

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 use platform_get_irq(),
otherwise this error is logged when probing instance 1:
    mlxbf3_gpio MLNXBF33:01: error -ENXIO: IRQ index 0 not found

Fixes: cd33f216d241 ("gpio: mlxbf3: Add gpio driver support")
Signed-off-by: David Thompson <davthompson@nvidia.com>
---
 drivers/gpio/gpio-mlxbf3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-mlxbf3.c b/drivers/gpio/gpio-mlxbf3.c
index 10ea71273c89..ed29b07d16c1 100644
--- a/drivers/gpio/gpio-mlxbf3.c
+++ b/drivers/gpio/gpio-mlxbf3.c
@@ -227,7 +227,7 @@ 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);
+	irq = platform_get_irq_optional(pdev, 0);
 	if (irq >= 0) {
 		girq = &gs->gc.irq;
 		gpio_irq_chip_set_chip(girq, &gpio_mlxbf3_irqchip);
-- 
2.43.2


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

* Re: [PATCH v1 2/2] gpio: mlxbf3: use platform_get_irq_optional()
  2025-08-11 17:50 ` [PATCH v1 2/2] gpio: mlxbf3: use platform_get_irq_optional() David Thompson
@ 2025-08-11 20:35   ` Andy Shevchenko
  2025-08-12 13:42     ` Bartosz Golaszewski
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2025-08-11 20:35 UTC (permalink / raw)
  To: David Thompson
  Cc: linus.walleij, brgl, mika.westerberg, linux-gpio, linux-kernel

On Mon, Aug 11, 2025 at 01:50:45PM -0400, 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 use platform_get_irq(),
> otherwise this error is logged when probing instance 1:
>     mlxbf3_gpio MLNXBF33:01: error -ENXIO: IRQ index 0 not found

Missed Cc to stable@.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 0/2] gpio: mlxbf3: revert device name logic
  2025-08-11 17:50 [PATCH v1 0/2] gpio: mlxbf3: revert device name logic David Thompson
  2025-08-11 17:50 ` [PATCH v1 1/2] Revert "gpio: mlxbf3: only get IRQ for device instance 0" David Thompson
  2025-08-11 17:50 ` [PATCH v1 2/2] gpio: mlxbf3: use platform_get_irq_optional() David Thompson
@ 2025-08-11 20:36 ` Andy Shevchenko
  2025-08-12 13:42 ` Bartosz Golaszewski
  3 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2025-08-11 20:36 UTC (permalink / raw)
  To: David Thompson
  Cc: linus.walleij, brgl, mika.westerberg, linux-gpio, linux-kernel

On Mon, Aug 11, 2025 at 01:50:43PM -0400, David Thompson wrote:
> This series reverts the use of device name processing
> in the BlueField-3 GPIO driver "probe()".  Instead, the
> kernel API "platform_get_irq_optional()" should be used
> to prevent errors being logged.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 0/2] gpio: mlxbf3: revert device name logic
  2025-08-11 17:50 [PATCH v1 0/2] gpio: mlxbf3: revert device name logic David Thompson
                   ` (2 preceding siblings ...)
  2025-08-11 20:36 ` [PATCH v1 0/2] gpio: mlxbf3: revert device name logic Andy Shevchenko
@ 2025-08-12 13:42 ` Bartosz Golaszewski
  3 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2025-08-12 13:42 UTC (permalink / raw)
  To: linus.walleij, brgl, andriy.shevchenko, mika.westerberg,
	David Thompson
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Mon, 11 Aug 2025 13:50:43 -0400, David Thompson wrote:
> This series reverts the use of device name processing
> in the BlueField-3 GPIO driver "probe()".  Instead, the
> kernel API "platform_get_irq_optional()" should be used
> to prevent errors being logged.
> 
> David Thompson (2):
>   Revert "gpio: mlxbf3: only get IRQ for device instance 0"
>   gpio: mlxbf3: use platform_get_irq_optional()
> 
> [...]

Applied, thanks!

[1/2] Revert "gpio: mlxbf3: only get IRQ for device instance 0"
      https://git.kernel.org/brgl/linux/c/56bdf7270ff4f870e2d4bfacdc00161e766dba2d
[2/2] gpio: mlxbf3: use platform_get_irq_optional()
      https://git.kernel.org/brgl/linux/c/810bd9066fb1871b8a9528f31f2fdbf2a8b73bf2

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

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

* Re: [PATCH v1 2/2] gpio: mlxbf3: use platform_get_irq_optional()
  2025-08-11 20:35   ` Andy Shevchenko
@ 2025-08-12 13:42     ` Bartosz Golaszewski
  0 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2025-08-12 13:42 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: David Thompson, linus.walleij, mika.westerberg, linux-gpio,
	linux-kernel

On Mon, Aug 11, 2025 at 10:35 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Aug 11, 2025 at 01:50:45PM -0400, 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 use platform_get_irq(),
> > otherwise this error is logged when probing instance 1:
> >     mlxbf3_gpio MLNXBF33:01: error -ENXIO: IRQ index 0 not found
>
> Missed Cc to stable@.
>
> --
> With Best Regards,
> Andy Shevchenko
>
>

I added it when applying.

Bart

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

* Re: [PATCH v1 1/2] Revert "gpio: mlxbf3: only get IRQ for device instance 0"
  2025-08-11 17:50 ` [PATCH v1 1/2] Revert "gpio: mlxbf3: only get IRQ for device instance 0" David Thompson
@ 2025-08-12 13:43   ` Bartosz Golaszewski
  0 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2025-08-12 13:43 UTC (permalink / raw)
  To: David Thompson
  Cc: linus.walleij, andriy.shevchenko, mika.westerberg, linux-gpio,
	linux-kernel, stable

On Mon, Aug 11, 2025 at 7:51 PM David Thompson <davthompson@nvidia.com> wrote:
>
> This reverts commit 10af0273a35ab4513ca1546644b8c853044da134.
>
> While this change was merged, it is not the preferred solution.
> During review of a similar change to the gpio-mlxbf2 driver, the
> use of "platform_get_irq_optional" was identified as the preferred
> solution, so let's use it for gpio-mlxbf3 driver as well.
>
> Cc: stable@vger.kernel.org
> Fixes: 10af0273a35a ("gpio: mlxbf3: only get IRQ for device instance 0")
> Signed-off-by: David Thompson <davthompson@nvidia.com>
> ---

Ah, yes, it slipped through the crack, I should have paid more
attention like with the other one you mentioned.

Thanks!
Bart

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

end of thread, other threads:[~2025-08-12 13:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11 17:50 [PATCH v1 0/2] gpio: mlxbf3: revert device name logic David Thompson
2025-08-11 17:50 ` [PATCH v1 1/2] Revert "gpio: mlxbf3: only get IRQ for device instance 0" David Thompson
2025-08-12 13:43   ` Bartosz Golaszewski
2025-08-11 17:50 ` [PATCH v1 2/2] gpio: mlxbf3: use platform_get_irq_optional() David Thompson
2025-08-11 20:35   ` Andy Shevchenko
2025-08-12 13:42     ` Bartosz Golaszewski
2025-08-11 20:36 ` [PATCH v1 0/2] gpio: mlxbf3: revert device name logic Andy Shevchenko
2025-08-12 13:42 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).