aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc
diff options
context:
space:
mode:
authorChristophe Ricard <christophe.ricard@gmail.com>2014-07-28 12:11:33 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2014-09-07 17:56:47 -0400
commit56ee645e304c9b86b48768de8e52babd5b6e1d8a (patch)
tree66cfb331b69b6090e369e3387f4ce0320a34c0c1 /drivers/nfc
parent361325e21d3a06a31ab53baf452c0946743b7abb (diff)
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')
-rw-r--r--drivers/nfc/st21nfcb/i2c.c30
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)
273 } 273 }
274 274
275 /* GPIO request and configuration */ 275 /* GPIO request and configuration */
276 r = devm_gpio_request(&client->dev, gpio, "clf_reset"); 276 r = devm_gpio_request_one(&client->dev, gpio,
277 GPIOF_OUT_INIT_HIGH, "clf_reset");
277 if (r) { 278 if (r) {
278 nfc_err(&client->dev, "Failed to request reset pin\n"); 279 nfc_err(&client->dev, "Failed to request reset pin\n");
279 return -ENODEV; 280 return -ENODEV;
280 } 281 }
281
282 r = gpio_direction_output(gpio, 1);
283 if (r) {
284 nfc_err(&client->dev,
285 "Failed to set reset pin direction as output\n");
286 return -ENODEV;
287 }
288 phy->gpio_reset = gpio; 282 phy->gpio_reset = gpio;
289 283
290 /* IRQ */ 284 /* IRQ */
@@ -325,32 +319,20 @@ static int st21nfcb_nci_i2c_request_resources(struct i2c_client *client)
325 phy->gpio_reset = pdata->gpio_reset; 319 phy->gpio_reset = pdata->gpio_reset;
326 phy->irq_polarity = pdata->irq_polarity; 320 phy->irq_polarity = pdata->irq_polarity;
327 321
328 r = devm_gpio_request(&client->dev, phy->gpio_irq, "wake_up"); 322 r = devm_gpio_request_one(&client->dev, phy->gpio_irq,
323 GPIOF_IN, "clf_irq");
329 if (r) { 324 if (r) {
330 pr_err("%s : gpio_request failed\n", __FILE__); 325 pr_err("%s : gpio_request failed\n", __FILE__);
331 return -ENODEV; 326 return -ENODEV;
332 } 327 }
333 328
334 r = gpio_direction_input(phy->gpio_irq); 329 r = devm_gpio_request_one(&client->dev,
335 if (r) { 330 phy->gpio_reset, GPIOF_OUT_INIT_HIGH, "clf_reset");
336 pr_err("%s : gpio_direction_input failed\n", __FILE__);
337 return -ENODEV;
338 }
339
340 r = devm_gpio_request(&client->dev,
341 phy->gpio_reset, "clf_reset");
342 if (r) { 331 if (r) {
343 pr_err("%s : reset gpio_request failed\n", __FILE__); 332 pr_err("%s : reset gpio_request failed\n", __FILE__);
344 return -ENODEV; 333 return -ENODEV;
345 } 334 }
346 335
347 r = gpio_direction_output(phy->gpio_reset, 1);
348 if (r) {
349 pr_err("%s : reset gpio_direction_output failed\n",
350 __FILE__);
351 return -ENODEV;
352 }
353
354 /* IRQ */ 336 /* IRQ */
355 irq = gpio_to_irq(phy->gpio_irq); 337 irq = gpio_to_irq(phy->gpio_irq);
356 if (irq < 0) { 338 if (irq < 0) {