From: Axel Lin <axel.lin@ingics.com>
To: Samuel Ortiz <sameo@linux.intel.com>
Cc: Christophe Ricard <christophe-h.ricard@st.com>,
linux-wireless@vger.kernel.org, linux-nfc@lists.01.org
Subject: [PATCH] NFC: st21nfca: Convert to use devm_gpio_request_one
Date: Mon, 26 May 2014 21:54:22 +0800 [thread overview]
Message-ID: <1401112462.22584.2.camel@phoenix> (raw)
This simplifies the code a bit.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/nfc/st21nfca/i2c.c | 28 ++++++----------------------
1 file changed, 6 insertions(+), 22 deletions(-)
diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c
index 3f954ed..0e096ad 100644
--- a/drivers/nfc/st21nfca/i2c.c
+++ b/drivers/nfc/st21nfca/i2c.c
@@ -524,17 +524,13 @@ static int st21nfca_hci_i2c_of_request_resources(struct i2c_client *client)
}
/* GPIO request and configuration */
- r = devm_gpio_request(&client->dev, gpio, "clf_enable");
+ r = devm_gpio_request_one(&client->dev, gpio, GPIOF_OUT_INIT_HIGH,
+ "clf_enable");
if (r) {
nfc_err(&client->dev, "Failed to request enable pin\n");
return -ENODEV;
}
- r = gpio_direction_output(gpio, 1);
- if (r) {
- nfc_err(&client->dev, "Failed to set enable pin direction as output\n");
- return -ENODEV;
- }
phy->gpio_ena = gpio;
/* IRQ */
@@ -575,32 +571,20 @@ static int st21nfca_hci_i2c_request_resources(struct i2c_client *client)
phy->gpio_ena = pdata->gpio_ena;
phy->irq_polarity = pdata->irq_polarity;
- r = devm_gpio_request(&client->dev, phy->gpio_irq, "wake_up");
+ r = devm_gpio_request_one(&client->dev, phy->gpio_irq, GPIOF_IN,
+ "wake_up");
if (r) {
pr_err("%s : gpio_request failed\n", __FILE__);
return -ENODEV;
}
- r = gpio_direction_input(phy->gpio_irq);
- if (r) {
- pr_err("%s : gpio_direction_input failed\n", __FILE__);
- return -ENODEV;
- }
-
if (phy->gpio_ena > 0) {
- r = devm_gpio_request(&client->dev,
- phy->gpio_ena, "clf_enable");
+ r = devm_gpio_request_one(&client->dev, phy->gpio_ena,
+ GPIOF_OUT_INIT_HIGH, "clf_enable");
if (r) {
pr_err("%s : ena gpio_request failed\n", __FILE__);
return -ENODEV;
}
- r = gpio_direction_output(phy->gpio_ena, 1);
-
- if (r) {
- pr_err("%s : ena gpio_direction_output failed\n",
- __FILE__);
- return -ENODEV;
- }
}
/* IRQ */
--
1.8.3.2
next reply other threads:[~2014-05-26 13:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-26 13:54 Axel Lin [this message]
[not found] ` <0B9F1C5B86169C4EA9D042C251022E4938E98AD9CA@SAFEX1MAIL3.st.com>
2014-07-25 21:04 ` [PATCH] NFC: st21nfca: Convert to use devm_gpio_request_one Christophe RICARD
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=1401112462.22584.2.camel@phoenix \
--to=axel.lin@ingics.com \
--cc=christophe-h.ricard@st.com \
--cc=linux-nfc@lists.01.org \
--cc=linux-wireless@vger.kernel.org \
--cc=sameo@linux.intel.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).