Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Uwe Kleine-König and committed by
Sebastian Reichel
e31cd782 0007fa36

+3 -8
+3 -8
drivers/power/bq24257_charger.c
··· 608 608 609 609 static int bq24257_irq_probe(struct bq24257_device *bq) 610 610 { 611 - int ret; 612 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 614 if (IS_ERR(stat_irq)) { 616 615 dev_err(bq->dev, "could not probe stat_irq pin\n"); 617 616 return PTR_ERR(stat_irq); 618 617 } 619 - 620 - ret = gpiod_direction_input(stat_irq); 621 - if (ret < 0) 622 - return ret; 623 618 624 619 return gpiod_to_irq(stat_irq); 625 620 } 626 621 627 622 static 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 625 if (IS_ERR(bq->pg)) { 631 626 dev_err(bq->dev, "could not probe PG pin\n"); 632 627 return PTR_ERR(bq->pg); 633 628 } 634 629 635 - return gpiod_direction_input(bq->pg); 630 + return 0; 636 631 } 637 632 638 633 static int bq24257_fw_probe(struct bq24257_device *bq)