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

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 <[email protected]>
Reviewed-by: Doug Anderson <[email protected]>
Tested-by: Doug Anderson <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
This commit is contained in:
Heiko Stuebner 2014-09-23 22:42:16 +02:00 • committed by Sebastian Reichel
commit 4d96fb1ec8

View file

@ -55,7 +55,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);
val->intval ^= pdata->gpio_active_low;
break;
default: