]> asedeno.scripts.mit.edu Git - linux.git/commit
power: supply: gpio_charger: switch to using GPIO descriptors
authorLinus Walleij <linus.walleij@linaro.org>
Mon, 26 Dec 2016 20:18:55 +0000 (21:18 +0100)
committerSebastian Reichel <sre@kernel.org>
Wed, 4 Jan 2017 21:04:50 +0000 (22:04 +0100)
commitfb9a33ae6ba7eb6c22a2f37e4be7a96bf55da14d
tree8e57770001a8a08352d48c52beb0a12f5748f904
parentc56ca24a01ee88e53d2ecf4c070653b6ef45968f
power: supply: gpio_charger: switch to using GPIO descriptors

The GPIO charger is using a mix of the legacy GPIO interface
and <linux/of_gpio.h> which is not the modern way to use GPIOs.

Refactor like this:

- Use a GPIO descriptor for the GPIO line used to monitor the
  charger.
- Fetch the descriptor with devm_gpiod_get() as the first
  method.
- If this fails and we are *not* using device tree, then
  start looking to see if we can use platform data instead.
- After looking up and requesting a GPIO number with the
  legacy API, convert it to a descriptor.

This way we can later isolate and drop the legacy code as
more platforms move over to using descriptors.

Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
drivers/power/supply/gpio-charger.c