power: gpio-charger: do not use gpio value directly

A patch from »gpio-charger: add devicetree support« in state Mainline for linux-kernel

From: Heiko Stuebner <heiko.stuebner@...> Date: Tue, 11 Mar 2014 17:22:07 +0100

Commit-Message

Some gpio implementations return interesting values for gpio_get_value when the value is not 0 - as seen on a imx6sl board. Therefore do not use the value returned from gpio_get_value directly but simply check for 0 or not 0. Signed-off-by: Heiko Stuebner <heiko.stuebner@...>

Patch-Comment

drivers/power/gpio-charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

Statistics

  • 1 lines added
  • 1 lines removed

Changes

------------------------- drivers/power/gpio-charger.c -------------------------
index 5fe6879..ce99a29 100644
@@ -57,7 +57,7 @@ static int gpio_charger_get_property(struct power_supply *psy,
switch (psp) {
case POWER_SUPPLY_PROP_ONLINE:
- val->intval = gpio_get_value_cansleep(pdata->gpio);
+ val->intval = gpio_get_value_cansleep(pdata->gpio) ? 1 : 0;
val->intval ^= pdata->gpio_active_low;
break;
default:
 
 

Recent Patches

About Us

Sed lacus. Donec lectus. Nullam pretium nibh ut turpis. Nam bibendum. In nulla tortor, elementum vel, tempor at, varius non, purus. Mauris vitae nisl nec metus placerat consectetuer.

Read More...