From: Sonic Zhang <sonic.adi@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Grant Likely <grant.likely@linaro.org>
Cc: linux-gpio@vger.kernel.org,
adi-buildroot-devel@lists.sourceforge.net,
Sonic Zhang <sonic.zhang@analog.com>
Subject: [PATCH] pinmux: 1 pin is not allowed to be configured for both GPIO and peripheral funtion
Date: Thu, 26 Feb 2015 15:41:44 +0800 [thread overview]
Message-ID: <1424936504-32662-1-git-send-email-sonic.adi@gmail.com> (raw)
From: Sonic Zhang <sonic.zhang@analog.com>
The blackfin pinmux and gpio controller doesn't allow user to set up 1 pin
for both GPIO and peripheral function. So, check both gpio_owner and
mux_owner before approving the pin request.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
---
drivers/pinctrl/pinmux.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index b874458..b58b97c 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -99,24 +99,24 @@ static int pin_request(struct pinctrl_dev *pctldev,
dev_dbg(pctldev->dev, "request pin %d (%s) for %s\n",
pin, desc->name, owner);
+ if (desc->gpio_owner) {
+ dev_err(pctldev->dev,
+ "pin %s already requested by %s; cannot claim for %s\n",
+ desc->name, desc->gpio_owner, owner);
+ goto out;
+ }
+
+ if (desc->mux_usecount && strcmp(desc->mux_owner, owner)) {
+ dev_err(pctldev->dev,
+ "pin %s already requested by %s; cannot claim for %s\n",
+ desc->name, desc->mux_owner, owner);
+ goto out;
+ }
+
if (gpio_range) {
/* There's no need to support multiple GPIO requests */
- if (desc->gpio_owner) {
- dev_err(pctldev->dev,
- "pin %s already requested by %s; cannot claim for %s\n",
- desc->name, desc->gpio_owner, owner);
- goto out;
- }
-
desc->gpio_owner = owner;
} else {
- if (desc->mux_usecount && strcmp(desc->mux_owner, owner)) {
- dev_err(pctldev->dev,
- "pin %s already requested by %s; cannot claim for %s\n",
- desc->name, desc->mux_owner, owner);
- goto out;
- }
-
desc->mux_usecount++;
if (desc->mux_usecount > 1)
return 0;
--
1.7.9.5
next reply other threads:[~2015-02-26 8:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-26 7:41 Sonic Zhang [this message]
2015-03-04 7:57 ` [PATCH] pinmux: 1 pin is not allowed to be configured for both GPIO and peripheral funtion Sonic Zhang
2015-03-09 15:46 ` 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=1424936504-32662-1-git-send-email-sonic.adi@gmail.com \
--to=sonic.adi@gmail.com \
--cc=adi-buildroot-devel@lists.sourceforge.net \
--cc=grant.likely@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=sonic.zhang@analog.com \
/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).