linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
To: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Cc: linux-gpio <linux-gpio@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH] gpio: pl061: Warn when IRQ line has not been configured
Date: Wed, 4 Mar 2020 17:46:53 +0100	[thread overview]
Message-ID: <CAMpxmJXMdKMdXpQKjdyMatLPggUgPOm-wSMZ6rmWZFjwSv1sWA@mail.gmail.com> (raw)
In-Reply-To: <1d0a9528-8434-1087-d127-e5fd3d0c32d6@nokia.com>

śr., 4 mar 2020 o 15:58 Alexander Sverdlin
<alexander.sverdlin@nokia.com> napisał(a):
>
> Hi!
>
> On 04/03/2020 15:21, Bartosz Golaszewski wrote:
> > wt., 3 mar 2020 o 10:29 Alexander A Sverdlin
> > <alexander.sverdlin@nokia.com> napisał(a):
> >> From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> >>
> >> Existing (irq < 0) condition is always false because adev->irq has unsigned
> >> type and contains 0 in case of failed irq_of_parse_and_map(). Up to now all
> >> the mapping errors were silently ignored.
> >>
> >> Seems that repairing this check would be backwards-incompatible and might
> >> break the probe() for the implementations without IRQ support. Therefore
> >> warn the user instead.
> >>
> >> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> >> ---
> >>  drivers/gpio/gpio-pl061.c | 6 ++----
> >>  1 file changed, 2 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
> >> index 5df7782..3439120 100644
> >> --- a/drivers/gpio/gpio-pl061.c
> >> +++ b/drivers/gpio/gpio-pl061.c
> >> @@ -326,10 +326,8 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
> >>
> >>         writeb(0, pl061->base + GPIOIE); /* disable irqs */
> >>         irq = adev->irq[0];
> >> -       if (irq < 0) {
> >> -               dev_err(&adev->dev, "invalid IRQ\n");
> >> -               return -ENODEV;
> >> -       }
> >> +       if (!irq)
> >> +               dev_warn(&adev->dev, "IRQ support disabled\n");
> >>         pl061->parent_irq = irq;
> >>
> >>         girq = &pl061->gc.irq;
> >> --
> >> 2.4.6
> >>
> > What happens later on if irq == 0? Does irq_set_irq_wake() fail?
>
> Yes, would fail if IRQs would be requested from PL061:
>
> int irq_set_irq_wake(unsigned int irq, unsigned int on)
> {
>         unsigned long flags;
>         struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL);
>         int ret = 0;
>
>         if (!desc)
>                 return -EINVAL;
>
>
> --
> Best regards,
> Alexander Sverdlin.

Ok, I'll go ahead and queue this then.

Thanks!
Bartosz

  reply	other threads:[~2020-03-04 16:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03  9:28 [PATCH] gpio: pl061: Warn when IRQ line has not been configured Alexander A Sverdlin
2020-03-04 14:21 ` Bartosz Golaszewski
2020-03-04 14:58   ` Alexander Sverdlin
2020-03-04 16:46     ` Bartosz Golaszewski [this message]
     [not found] <20210317155919.41450-1-alexander.sverdlin@nokia.com>
2021-03-17 15:59 ` Alexander A Sverdlin
     [not found]   ` <CAHp75Vd-iUzEyo5X5LtKJ+66512i5-tKC+kkpPYJwG7L2qrvdw@mail.gmail.com>
2021-03-18 11:11     ` Alexander Sverdlin
2021-03-18 12:19       ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMpxmJXMdKMdXpQKjdyMatLPggUgPOm-wSMZ6rmWZFjwSv1sWA@mail.gmail.com \
    --to=bgolaszewski@baylibre.com \
    --cc=alexander.sverdlin@nokia.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).