From: Markus Pargmann <mpa@pengutronix.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "Alexandre Courbot" <gnurou@gmail.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Johan Hovold" <johan@kernel.org>,
linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
kernel@pengutronix.de, "Markus Pargmann" <mpa@pengutronix.de>
Subject: [PATCH v2] gpio: Allow hogged gpios to be requested
Date: Tue, 4 Aug 2015 11:27:04 +0200 [thread overview]
Message-ID: <1438680424-698-1-git-send-email-mpa@pengutronix.de> (raw)
It can be useful to claim hogged gpios later, for example from
userspace. This allows to set defaults for GPIOs using the hogging
mechanism and override the setup later from userspace or a kernel driver.
This patch adds a check for hogged gpios to allow requesting them. If
the gpio is not hogged but marked as requested, it still fails with
-EBUSY.
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
Only change is, that it is separated from the other series now.
drivers/gpio/gpiolib.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 926a1507431f..0f1d1f5faf5d 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -830,7 +830,8 @@ static int __gpiod_request(struct gpio_desc *desc, const char *label)
* before IRQs are enabled, for non-sleeping (SOC) GPIOs.
*/
- if (test_and_set_bit(FLAG_REQUESTED, &desc->flags) == 0) {
+ if (test_and_set_bit(FLAG_REQUESTED, &desc->flags) == 0 ||
+ test_and_clear_bit(FLAG_IS_HOGGED, &desc->flags) == 1) {
desc_set_label(desc, label ? : "?");
status = 0;
} else {
--
2.1.4
next reply other threads:[~2015-08-04 9:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-04 9:27 Markus Pargmann [this message]
2015-08-10 9:26 ` [PATCH v2] gpio: Allow hogged gpios to be requested Linus Walleij
2015-08-13 13:07 ` Markus Pargmann
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=1438680424-698-1-git-send-email-mpa@pengutronix.de \
--to=mpa@pengutronix.de \
--cc=gnurou@gmail.com \
--cc=johan@kernel.org \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/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).