diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2014-07-28 20:11:33 +0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2014-09-08 01:56:47 +0400 |
commit | 56ee645e304c9b86b48768de8e52babd5b6e1d8a (patch) | |
tree | 66cfb331b69b6090e369e3387f4ce0320a34c0c1 /drivers/nfc/st21nfcb/i2c.c | |
parent | 361325e21d3a06a31ab53baf452c0946743b7abb (diff) | |
download | linux-56ee645e304c9b86b48768de8e52babd5b6e1d8a.tar.xz |
NFC: st21nfcb: Convert to use devm_gpio_request_one
Simplify the code a bit as mention by Axel Lin in a previous patch for
st21nfca.
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/st21nfcb/i2c.c')
-rw-r--r-- | drivers/nfc/st21nfcb/i2c.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/drivers/nfc/st21nfcb/i2c.c b/drivers/nfc/st21nfcb/i2c.c index 5a166cde35bc..7ae9767dbcce 100644 --- a/drivers/nfc/st21nfcb/i2c.c +++ b/drivers/nfc/st21nfcb/i2c.c @@ -273,18 +273,12 @@ static int st21nfcb_nci_i2c_of_request_resources(struct i2c_client *client) } /* GPIO request and configuration */ - r = devm_gpio_request(&client->dev, gpio, "clf_reset"); + r = devm_gpio_request_one(&client->dev, gpio, + GPIOF_OUT_INIT_HIGH, "clf_reset"); if (r) { nfc_err(&client->dev, "Failed to request reset pin\n"); return -ENODEV; } - - r = gpio_direction_output(gpio, 1); - if (r) { - nfc_err(&client->dev, - "Failed to set reset pin direction as output\n"); - return -ENODEV; - } phy->gpio_reset = gpio; /* IRQ */ @@ -325,32 +319,20 @@ static int st21nfcb_nci_i2c_request_resources(struct i2c_client *client) phy->gpio_reset = pdata->gpio_reset; 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, "clf_irq"); 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; - } - - r = devm_gpio_request(&client->dev, - phy->gpio_reset, "clf_reset"); + r = devm_gpio_request_one(&client->dev, + phy->gpio_reset, GPIOF_OUT_INIT_HIGH, "clf_reset"); if (r) { pr_err("%s : reset gpio_request failed\n", __FILE__); return -ENODEV; } - r = gpio_direction_output(phy->gpio_reset, 1); - if (r) { - pr_err("%s : reset gpio_direction_output failed\n", - __FILE__); - return -ENODEV; - } - /* IRQ */ irq = gpio_to_irq(phy->gpio_irq); if (irq < 0) { |