Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] power_supply: bq25890: use flags argument of devm_gpiod_get
@ 2015-06-12  7:19 Uwe Kleine-König
  2015-06-13  2:38 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2015-06-12  7:19 UTC (permalink / raw)
  To: Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse
  Cc: linux-pm, kernel, Alexandre Courbot, Kishon Vijay Abraham I

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. Furthermore this is one caller less that
stops us making the flags argument to gpiod_get*() mandatory.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

this patch applies to next and is only necessary on top of 4aeae9cb0dad
(power_supply: Add support for TI BQ25890 charger chip).

Note I plan to make the flags parameter mandatory for 4.3. So unless
this change gets into 4.2, would it be ok to let it go in via the gpio
tree?

Best regards
Uwe

 drivers/power/bq25890_charger.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/power/bq25890_charger.c b/drivers/power/bq25890_charger.c
index 16b7c7bc987d..f993a55cde20 100644
--- a/drivers/power/bq25890_charger.c
+++ b/drivers/power/bq25890_charger.c
@@ -721,19 +721,14 @@ static int bq25890_usb_notifier(struct notifier_block *nb, unsigned long val,
 
 static int bq25890_irq_probe(struct bq25890_device *bq)
 {
-	int ret;
 	struct gpio_desc *irq;
 
-	irq = devm_gpiod_get_index(bq->dev, BQ25890_IRQ_PIN, 0);
+	irq = devm_gpiod_get_index(bq->dev, BQ25890_IRQ_PIN, 0, GPIOD_IN);
 	if (IS_ERR(irq)) {
 		dev_err(bq->dev, "Could not probe irq pin.\n");
 		return PTR_ERR(irq);
 	}
 
-	ret = gpiod_direction_input(irq);
-	if (ret < 0)
-		return ret;
-
 	return gpiod_to_irq(irq);
 }
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-13  2:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-12  7:19 [PATCH] power_supply: bq25890: use flags argument of devm_gpiod_get Uwe Kleine-König
2015-06-13  2:38 ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox