All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>
Cc: linux-gpio@vger.kernel.org, kernel@pengutronix.de,
	Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Lauro Ramos Venancio <lauro.venancio@openbossa.org>,
	Aloisio Almeida Jr <aloisio.almeida@openbossa.org>,
	Charles Gorand <charles.gorand@effinnov.com>,
	linux-nfc@ml01.01.org
Subject: [PATCH gpio-for-next 06/10] NFC: nxp-nci_i2c: use flags argument of devm_gpiod_get_index
Date: Mon,  6 Jul 2015 11:09:46 +0200	[thread overview]
Message-ID: <1436173790-29963-6-git-send-email-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20150706090759.GS11824@pengutronix.de>

Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions)
which appeared in v3.17-rc1, the gpiod_get* functions take an additional
parameter that allows to specify direction and initial value for output.

Simplify driver accordingly which even makes error checking more correct
because gpiod_direction_{in,out}put might fail. Furthermore this is one
caller less that stops us making the flags argument to gpiod_get*()
mandatory.

Acked-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/nfc/nxp-nci/i2c.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 2f77f1d03638..fac80c691914 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -318,19 +318,15 @@ static int nxp_nci_i2c_acpi_config(struct nxp_nci_i2c_phy *phy)
 	struct i2c_client *client = phy->i2c_dev;
 	struct gpio_desc *gpiod_en, *gpiod_fw, *gpiod_irq;
 
-	gpiod_en = devm_gpiod_get_index(&client->dev, NULL, 2);
-	gpiod_fw = devm_gpiod_get_index(&client->dev, NULL, 1);
-	gpiod_irq = devm_gpiod_get_index(&client->dev, NULL, 0);
+	gpiod_en = devm_gpiod_get_index(&client->dev, NULL, 2, GPIOD_OUT_LOW);
+	gpiod_fw = devm_gpiod_get_index(&client->dev, NULL, 1, GPIOD_OUT_LOW);
+	gpiod_irq = devm_gpiod_get_index(&client->dev, NULL, 0, GPIOD_IN);
 
 	if (IS_ERR(gpiod_en) || IS_ERR(gpiod_fw) || IS_ERR(gpiod_irq)) {
 		nfc_err(&client->dev, "No GPIOs\n");
 		return -EINVAL;
 	}
 
-	gpiod_direction_output(gpiod_en, 0);
-	gpiod_direction_output(gpiod_fw, 0);
-	gpiod_direction_input(gpiod_irq);
-
 	client->irq = gpiod_to_irq(gpiod_irq);
 	if (client->irq < 0) {
 		nfc_err(&client->dev, "No IRQ\n");
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-07-06  9:10 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15 21:36 [PATCH] gpio: make flags mandatory for gpiod_get functions Uwe Kleine-König
2015-06-21  6:51 ` Alexandre Courbot
2015-07-06  9:07 ` [PULL gpio-for-next] " Uwe Kleine-König
2015-07-06  9:07   ` Uwe Kleine-König
2015-07-06  9:09   ` [PATCH gpio-for-next 01/10] drm/msm/dp: use flags argument of devm_gpiod_get to set direction Uwe Kleine-König
2015-07-06  9:09   ` [PATCH gpio-for-next 02/10] drm/tilcdc: panel: make better use of gpiod API Uwe Kleine-König
2015-07-06  9:09   ` [PATCH gpio-for-next 05/10] media: i2c/adp1653: set enable gpio to output Uwe Kleine-König
2015-07-06  9:09   ` Uwe Kleine-König [this message]
2015-07-06  9:09   ` [PATCH gpio-for-next 07/10] phy: tusb1210: make better use of gpiod API Uwe Kleine-König
2015-07-06  9:09   ` [PATCH gpio-for-next 08/10] usb: dwc3: pci: " Uwe Kleine-König
     [not found]   ` <20150706090759.GS11824-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-07-06  9:09     ` [PATCH gpio-for-next 03/10] iio: light: stk3310: use flags argument of devm_gpiod_get Uwe Kleine-König
2015-07-06  9:09       ` Uwe Kleine-König
2015-07-06  9:35       ` Breana, Tiberiu A
2015-07-06  9:35         ` Breana, Tiberiu A
2015-07-06  9:09     ` [PATCH gpio-for-next 04/10] iio: magn: bmc150: " Uwe Kleine-König
2015-07-06  9:09       ` Uwe Kleine-König
2015-07-06  9:09     ` [PATCH gpio-for-next 09/10] usb: pass flags parameter to gpiod_get functions Uwe Kleine-König
2015-07-06  9:09   ` [PATCH gpio-for-next 10/10] gpio: make flags mandatory for " Uwe Kleine-König
2015-07-08 10:51   ` [PULL gpio-for-next] " Uwe Kleine-König
2015-07-15  6:28     ` Uwe Kleine-König
2015-07-15  6:39       ` Alexandre Courbot
2015-07-17 12:28         ` Linus Walleij
2015-07-20  6:56           ` Uwe Kleine-König
2015-07-20  7:41             ` Linus Walleij
2015-07-20  7:51               ` Uwe Kleine-König
2015-07-20  8:28             ` 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=1436173790-29963-6-git-send-email-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=aloisio.almeida@openbossa.org \
    --cc=charles.gorand@effinnov.com \
    --cc=gnurou@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=lauro.venancio@openbossa.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-nfc@ml01.01.org \
    --cc=oleg.zhurakivskyy@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.