Commit 56ee645e authored by Christophe Ricard's avatar Christophe Ricard Committed by Samuel Ortiz

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: default avatarChristophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 361325e2
...@@ -273,18 +273,12 @@ static int st21nfcb_nci_i2c_of_request_resources(struct i2c_client *client) ...@@ -273,18 +273,12 @@ static int st21nfcb_nci_i2c_of_request_resources(struct i2c_client *client)
} }
/* GPIO request and configuration */ /* 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) { if (r) {
nfc_err(&client->dev, "Failed to request reset pin\n"); nfc_err(&client->dev, "Failed to request reset pin\n");
return -ENODEV; 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; phy->gpio_reset = gpio;
/* IRQ */ /* IRQ */
...@@ -325,32 +319,20 @@ static int st21nfcb_nci_i2c_request_resources(struct i2c_client *client) ...@@ -325,32 +319,20 @@ static int st21nfcb_nci_i2c_request_resources(struct i2c_client *client)
phy->gpio_reset = pdata->gpio_reset; phy->gpio_reset = pdata->gpio_reset;
phy->irq_polarity = pdata->irq_polarity; 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) { if (r) {
pr_err("%s : gpio_request failed\n", __FILE__); pr_err("%s : gpio_request failed\n", __FILE__);
return -ENODEV; return -ENODEV;
} }
r = gpio_direction_input(phy->gpio_irq); r = devm_gpio_request_one(&client->dev,
if (r) { phy->gpio_reset, GPIOF_OUT_INIT_HIGH, "clf_reset");
pr_err("%s : gpio_direction_input failed\n", __FILE__);
return -ENODEV;
}
r = devm_gpio_request(&client->dev,
phy->gpio_reset, "clf_reset");
if (r) { if (r) {
pr_err("%s : reset gpio_request failed\n", __FILE__); pr_err("%s : reset gpio_request failed\n", __FILE__);
return -ENODEV; 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 */
irq = gpio_to_irq(phy->gpio_irq); irq = gpio_to_irq(phy->gpio_irq);
if (irq < 0) { if (irq < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment