aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2015-06-12 04:54:04 -0400
committerSebastian Reichel <sre@kernel.org>2015-06-12 22:06:38 -0400
commite31cd7824d054d30ffc9f45550343123bc437e17 (patch)
treefc389a60efd30259daf8bbef8b95a82e7a411e54 /drivers/power
parent0007fa362a88f09a1b3e073434c83d35cc1e1e1c (diff)
power_supply: bq24257: use flags argument of devm_gpiod_get
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> Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/bq24257_charger.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/power/bq24257_charger.c b/drivers/power/bq24257_charger.c
index ce7f5bbfd5e3..5859bc7c1616 100644
--- a/drivers/power/bq24257_charger.c
+++ b/drivers/power/bq24257_charger.c
@@ -608,31 +608,26 @@ static int bq24257_power_supply_init(struct bq24257_device *bq)
608 608
609static int bq24257_irq_probe(struct bq24257_device *bq) 609static int bq24257_irq_probe(struct bq24257_device *bq)
610{ 610{
611 int ret;
612 struct gpio_desc *stat_irq; 611 struct gpio_desc *stat_irq;
613 612
614 stat_irq = devm_gpiod_get_index(bq->dev, BQ24257_STAT_IRQ, 0); 613 stat_irq = devm_gpiod_get_index(bq->dev, BQ24257_STAT_IRQ, 0, GPIOD_IN);
615 if (IS_ERR(stat_irq)) { 614 if (IS_ERR(stat_irq)) {
616 dev_err(bq->dev, "could not probe stat_irq pin\n"); 615 dev_err(bq->dev, "could not probe stat_irq pin\n");
617 return PTR_ERR(stat_irq); 616 return PTR_ERR(stat_irq);
618 } 617 }
619 618
620 ret = gpiod_direction_input(stat_irq);
621 if (ret < 0)
622 return ret;
623
624 return gpiod_to_irq(stat_irq); 619 return gpiod_to_irq(stat_irq);
625} 620}
626 621
627static int bq24257_pg_gpio_probe(struct bq24257_device *bq) 622static int bq24257_pg_gpio_probe(struct bq24257_device *bq)
628{ 623{
629 bq->pg = devm_gpiod_get_index(bq->dev, BQ24257_PG_GPIO, 0); 624 bq->pg = devm_gpiod_get_index(bq->dev, BQ24257_PG_GPIO, 0, GPIOD_IN);
630 if (IS_ERR(bq->pg)) { 625 if (IS_ERR(bq->pg)) {
631 dev_err(bq->dev, "could not probe PG pin\n"); 626 dev_err(bq->dev, "could not probe PG pin\n");
632 return PTR_ERR(bq->pg); 627 return PTR_ERR(bq->pg);
633 } 628 }
634 629
635 return gpiod_direction_input(bq->pg); 630 return 0;
636} 631}
637 632
638static int bq24257_fw_probe(struct bq24257_device *bq) 633static int bq24257_fw_probe(struct bq24257_device *bq)