From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org, Alexandre Courbot <acourbot@nvidia.com>
Subject: Re: [PATCH v2] gpio: convince line to become input in irq helper
Date: Wed, 22 Jun 2016 14:51:04 -0700 [thread overview]
Message-ID: <20160622215104.GR1256@tuxbot> (raw)
In-Reply-To: <1466630758-26231-1-git-send-email-linus.walleij@linaro.org>
On Wed 22 Jun 14:25 PDT 2016, Linus Walleij wrote:
> The generic IRQ helper library just checks if the IRQ line is
> set as input before activating it for interrupts. As we
> recently started to check things better with .get_dir() it
> turns out that it's good to try to convince the line to become
> an input before attempting to lock it as IRQ.
>
> Cc: Björn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Regards,
Bjorn
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v2:
> - Propagate the error from .direction_input() so we can rely on
> it being used.
> ---
> drivers/gpio/gpiolib.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 5a21a6acf8af..b195ec406ff4 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1505,6 +1505,25 @@ static int gpiochip_irq_reqres(struct irq_data *d)
> if (!try_module_get(chip->gpiodev->owner))
> return -ENODEV;
>
> + /*
> + * If it is possible to switch this GPIO to an input
> + * this is a good time to do it.
> + */
> + if (chip->direction_input) {
> + struct gpio_desc *desc;
> + int ret;
> +
> + desc = gpiochip_get_desc(chip, d->hwirq);
> + if (IS_ERR(desc))
> + return PTR_ERR(desc);
> +
> + ret = chip->direction_input(chip, d->hwirq);
> + if (ret)
> + return ret;
> +
> + clear_bit(FLAG_IS_OUT, &desc->flags);
> + }
> +
> if (gpiochip_lock_as_irq(chip, d->hwirq)) {
> chip_err(chip,
> "unable to lock HW IRQ %lu for IRQ\n",
> --
> 2.4.11
>
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-06-22 21:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-22 21:25 [PATCH v2] gpio: convince line to become input in irq helper Linus Walleij
2016-06-22 21:51 ` Bjorn Andersson [this message]
2016-06-29 5:17 ` Alexandre Courbot
2016-07-05 10:07 ` Geert Uytterhoeven
2016-07-05 10:07 ` Geert Uytterhoeven
2016-07-05 14:52 ` Linus Walleij
2016-07-06 9:07 ` Grygorii Strashko
2016-07-06 12:38 ` Linus Walleij
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=20160622215104.GR1256@tuxbot \
--to=bjorn.andersson@linaro.org \
--cc=acourbot@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.