From: Heiko Stuebner Date: Tue, 23 Sep 2014 20:42:16 +0000 (+0200) Subject: power: gpio-charger: do not use gpio value directly X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4d96fb1ec81118c6406fe6d3670f172b2faaedf3;p=linux-beck.git 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 Reviewed-by: Doug Anderson Tested-by: Doug Anderson Signed-off-by: Sebastian Reichel --- diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c index a0024b252197..7536933d0ab9 100644 --- a/drivers/power/gpio-charger.c +++ b/drivers/power/gpio-charger.c @@ -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: