linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: mxc: Only getting second IRQ when there is more than one IRQ
@ 2019-09-19  6:09 Anson Huang
  2019-09-19  7:18 ` Bartosz Golaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: Anson Huang @ 2019-09-19  6:09 UTC (permalink / raw)
  To: linus.walleij, bgolaszewski, linux-gpio, linux-kernel; +Cc: Linux-imx

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

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
 drivers/gpio/gpio-mxc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 7907a87..39ba7dd 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -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)
-- 
2.7.4


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

* Re: [PATCH] gpio: mxc: Only getting second IRQ when there is more than one IRQ
  2019-09-19  6:09 [PATCH] gpio: mxc: Only getting second IRQ when there is more than one IRQ Anson Huang
@ 2019-09-19  7:18 ` Bartosz Golaszewski
  2019-09-19  9:41   ` Anson Huang
  0 siblings, 1 reply; 3+ messages in thread
From: Bartosz Golaszewski @ 2019-09-19  7:18 UTC (permalink / raw)
  To: Anson Huang; +Cc: Linus Walleij, linux-gpio, LKML, dl-linux-imx

czw., 19 wrz 2019 o 08:10 Anson Huang <Anson.Huang@nxp.com> napisał(a):
>
> 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
>
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---
>  drivers/gpio/gpio-mxc.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index 7907a87..39ba7dd 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -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) {

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

> +               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
>

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

* RE: [PATCH] gpio: mxc: Only getting second IRQ when there is more than one IRQ
  2019-09-19  7:18 ` Bartosz Golaszewski
@ 2019-09-19  9:41   ` Anson Huang
  0 siblings, 0 replies; 3+ messages in thread
From: Anson Huang @ 2019-09-19  9:41 UTC (permalink / raw)
  To: Bartosz Golaszewski; +Cc: Linus Walleij, linux-gpio, LKML, dl-linux-imx

Hi, Bartosz

> czw., 19 wrz 2019 o 08:10 Anson Huang <Anson.Huang@nxp.com> napisał(a):
> >
> > 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
> >
> > Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> > ---
> >  drivers/gpio/gpio-mxc.c | 12 +++++++++---
> >  1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index
> > 7907a87..39ba7dd 100644
> > --- a/drivers/gpio/gpio-mxc.c
> > +++ b/drivers/gpio/gpio-mxc.c
> > @@ -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) {
> 
> 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

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

end of thread, other threads:[~2019-09-19  9:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-19  6:09 [PATCH] gpio: mxc: Only getting second IRQ when there is more than one IRQ Anson Huang
2019-09-19  7:18 ` Bartosz Golaszewski
2019-09-19  9:41   ` Anson Huang

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).