diff mbox series

[v2,1/7] gpio: tqmx86: really make IRQ optional

Message ID aee1d5a46b75fcaf4c231ddaf221f9ac2538440d.1625227382.git.matthias.schiffer@ew.tq-group.com
State New
Headers show
Series TQMx86: TQMx110EB and TQMxE40x MFD/GPIO support | expand

Commit Message

Matthias Schiffer July 2, 2021, 12:23 p.m. UTC
The tqmx86 MFD driver was passing IRQ 0 for "no IRQ" in the past. This
causes warnings with newer kernels.

Prepare the gpio-tqmx86 driver for the fixed MFD driver by handling a
missing IRQ properly.

Fixes: b868db94a6a7 ("gpio: tqmx86: Add GPIO from for this IO controller")
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
---

v2: add Fixes line

The "irq != -ENXIO" check can be removed again if
platform_get_irq_optional() is modified to return 0 when no IRQ is
found; the current code will work with both -ENXIO and 0 returns.


 drivers/gpio/gpio-tqmx86.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Andrew Lunn July 2, 2021, 1:45 p.m. UTC | #1
On Fri, Jul 02, 2021 at 02:23:47PM +0200, Matthias Schiffer wrote:
> The tqmx86 MFD driver was passing IRQ 0 for "no IRQ" in the past. This
> causes warnings with newer kernels.
> 
> Prepare the gpio-tqmx86 driver for the fixed MFD driver by handling a
> missing IRQ properly.
> 
> Fixes: b868db94a6a7 ("gpio: tqmx86: Add GPIO from for this IO controller")
> Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>

The system i was using this on made use of interrupts, so i never
tested with it missing.

It is a shame platform_get_irq_optional() does something different to
all the other _optional() calls :-(

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Andy Shevchenko July 2, 2021, 2:14 p.m. UTC | #2
On Fri, Jul 2, 2021 at 4:45 PM Andrew Lunn <andrew@lunn.ch> wrote:
> On Fri, Jul 02, 2021 at 02:23:47PM +0200, Matthias Schiffer wrote:
> > The tqmx86 MFD driver was passing IRQ 0 for "no IRQ" in the past. This
> > causes warnings with newer kernels.
> >
> > Prepare the gpio-tqmx86 driver for the fixed MFD driver by handling a
> > missing IRQ properly.

...

> It is a shame platform_get_irq_optional() does something different to
> all the other _optional() calls :-(

Exactly my point when I proposed the change to it!
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-tqmx86.c b/drivers/gpio/gpio-tqmx86.c
index 5022e0ad0fae..0f5d17f343f1 100644
--- a/drivers/gpio/gpio-tqmx86.c
+++ b/drivers/gpio/gpio-tqmx86.c
@@ -238,8 +238,8 @@  static int tqmx86_gpio_probe(struct platform_device *pdev)
 	struct resource *res;
 	int ret, irq;
 
-	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
+	irq = platform_get_irq_optional(pdev, 0);
+	if (irq < 0 && irq != -ENXIO)
 		return irq;
 
 	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
@@ -278,7 +278,7 @@  static int tqmx86_gpio_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(&pdev->dev);
 
-	if (irq) {
+	if (irq > 0) {
 		struct irq_chip *irq_chip = &gpio->irq_chip;
 		u8 irq_status;