Skip to contentSkip to conversation

gpio: mxc: Only getting second IRQ when there is more than one IRQ

PATCH Superseded Anson Huang 2 participants 3 messages Sep 19, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: mxc: Only getting second IRQ when there is more than one IRQ

On some of i.MX SoCs like i.MX8QXP, there is ONLY one IRQ for each GPIO bank, so it is better to check the IRQ count before getting second IRQ to avoid below error message during probe:

[    1.070908] gpio-mxc 5d080000.gpio: IRQ index 1 not found
[    1.077420] gpio-mxc 5d090000.gpio: IRQ index 1 not found
[    1.083766] gpio-mxc 5d0a0000.gpio: IRQ index 1 not found
[    1.090122] gpio-mxc 5d0b0000.gpio: IRQ index 1 not found
[    1.096470] gpio-mxc 5d0c0000.gpio: IRQ index 1 not found
[    1.102804] gpio-mxc 5d0d0000.gpio: IRQ index 1 not found
[    1.109144] gpio-mxc 5d0e0000.gpio: IRQ index 1 not found
[    1.115475] gpio-mxc 5d0f0000.gpio: IRQ index 1 not found
---
 drivers/gpio/gpio-mxc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpio/gpio-mxc.c +9 -3
index 7907a87..39ba7dd 100644
@@ -426,9 +426,15 @@ static int mxc_gpio_probe(struct platform_device *pdev)
 	if (IS_ERR(port->base))
 		return PTR_ERR(port->base);
 
-	port->irq_high = platform_get_irq(pdev, 1);
-	if (port->irq_high < 0)
-		port->irq_high = 0;
+	err = platform_irq_count(pdev);
+	if (err < 0)
+		return err;
+
+	if (err > 1) {
+		port->irq_high = platform_get_irq(pdev, 1);
+		if (port->irq_high < 0)
+			port->irq_high = 0;
+	}
 
 	port->irq = platform_get_irq(pdev, 0);
 	if (port->irq < 0)
Signature · 1 line
2.7.4
#1 lore raw

czw., 19 wrz 2019 o 08:10 Anson Huang <[email protected]> napisał(a):

Quoted 25 lines

On some of i.MX SoCs like i.MX8QXP, there is ONLY one IRQ for each GPIO bank, so it is better to check the IRQ count before getting second IRQ to avoid below error message during probe:

[    1.070908] gpio-mxc 5d080000.gpio: IRQ index 1 not found
[    1.077420] gpio-mxc 5d090000.gpio: IRQ index 1 not found
[    1.083766] gpio-mxc 5d0a0000.gpio: IRQ index 1 not found
[    1.090122] gpio-mxc 5d0b0000.gpio: IRQ index 1 not found
[    1.096470] gpio-mxc 5d0c0000.gpio: IRQ index 1 not found
[    1.102804] gpio-mxc 5d0d0000.gpio: IRQ index 1 not found
[    1.109144] gpio-mxc 5d0e0000.gpio: IRQ index 1 not found
[    1.115475] gpio-mxc 5d0f0000.gpio: IRQ index 1 not found
---
 drivers/gpio/gpio-mxc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpio/gpio-mxc.c +0 -0
index 7907a87..39ba7dd 100644
@@ -426,9 +426,15 @@ static int mxc_gpio_probe(struct platform_device *pdev)
        if (IS_ERR(port->base))

drivers/gpio/gpio-mxc.c static int mxc_gpio_probe(struct platform_device *pdev) · line 433

Quoted 10 lines
drivers/gpio/gpio-mxc.c +5 -3
                return PTR_ERR(port->base);
 
-       port->irq_high = platform_get_irq(pdev, 1);
-       if (port->irq_high < 0)
-               port->irq_high = 0;
+       err = platform_irq_count(pdev);
+       if (err < 0)
+               return err;
+
+       if (err > 1) {

Could you use a variable called irq_count or something here? This 'err' is a confusing name for a variable that contains a valid value.

Bart

Quoted 10 lines
drivers/gpio/gpio-mxc.c +4 -1
+               port->irq_high = platform_get_irq(pdev, 1);
+               if (port->irq_high < 0)
+                       port->irq_high = 0;
+       }
 
        port->irq = platform_get_irq(pdev, 0);
        if (port->irq < 0)
--

2.7.4

#2 lore raw

Hi, Bartosz

Quoted 38 lines

czw., 19 wrz 2019 o 08:10 Anson Huang <[email protected]> napisał(a):

drivers/gpio/gpio-mxc.c static int mxc_gpio_probe(struct platform_device

Quoted 24 lines

On some of i.MX SoCs like i.MX8QXP, there is ONLY one IRQ for each GPIO bank, so it is better to check the IRQ count before getting second IRQ to avoid below error message during probe:

[    1.070908] gpio-mxc 5d080000.gpio: IRQ index 1 not found
[    1.077420] gpio-mxc 5d090000.gpio: IRQ index 1 not found
[    1.083766] gpio-mxc 5d0a0000.gpio: IRQ index 1 not found
[    1.090122] gpio-mxc 5d0b0000.gpio: IRQ index 1 not found
[    1.096470] gpio-mxc 5d0c0000.gpio: IRQ index 1 not found
[    1.102804] gpio-mxc 5d0d0000.gpio: IRQ index 1 not found
[    1.109144] gpio-mxc 5d0e0000.gpio: IRQ index 1 not found
[    1.115475] gpio-mxc 5d0f0000.gpio: IRQ index 1 not found
---
 drivers/gpio/gpio-mxc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpio/gpio-mxc.c index renamed from drivers/gpio/gpio-mxc.c +0 -0

7907a87..39ba7dd 100644

drivers/gpio/gpio-mxc.c +0 -0
@@ -426,9 +426,15 @@ static int mxc_gpio_probe(struct platform_device

*pdev)

drivers/gpio/gpio-mxc.c static int mxc_gpio_probe(struct platform_device *pdev) · line 433

Quoted 11 lines
drivers/gpio/gpio-mxc.c +5 -3
        if (IS_ERR(port->base))
                return PTR_ERR(port->base);
 
-       port->irq_high = platform_get_irq(pdev, 1);
-       if (port->irq_high < 0)
-               port->irq_high = 0;
+       err = platform_irq_count(pdev);
+       if (err < 0)
+               return err;
+
+       if (err > 1) {
Quoted 2 lines

Could you use a variable called irq_count or something here? This 'err' is a confusing name for a variable that contains a valid value.

Agreed, will send out a V2 patch using local variable irq_count instead.

Thanks,
Anson