summaryrefslogtreecommitdiffstats
path: root/drivers/power/supply/bq27xxx_battery.c
diff options
context:
space:
mode:
authorSebastian Reichel <sebastian.reichel@collabora.co.uk>2018-02-15 21:28:40 +0100
committerSebastian Reichel <sre@kernel.org>2018-03-12 14:30:09 +0100
commitf72c14ad8c6631a0a42115e74164f9b5faf4c724 (patch)
treeb1c0edaaefeafa84cee647a9e34186ce692776a7 /drivers/power/supply/bq27xxx_battery.c
parent66ec32fc7cd116dab5c02603ea8ec28ff92da3b5 (diff)
downloadlinux-f72c14ad8c6631a0a42115e74164f9b5faf4c724.tar.bz2
power: supply: bq27xxx: support missing supplier device
power_supply_am_i_supplied() can return negative error codes. In this case we should assume, that no charger is connected and the battery should be marked as DISCHARGING instead of NOT_CHARGING. Reported-by: Merlijn Wajer <merlijn@wizzup.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Diffstat (limited to 'drivers/power/supply/bq27xxx_battery.c')
-rw-r--r--drivers/power/supply/bq27xxx_battery.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index d99981542a46..7ce60519b1bc 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -1670,7 +1670,7 @@ static int bq27xxx_battery_status(struct bq27xxx_device_info *di,
status = POWER_SUPPLY_STATUS_FULL;
else if (di->cache.flags & BQ27000_FLAG_CHGS)
status = POWER_SUPPLY_STATUS_CHARGING;
- else if (power_supply_am_i_supplied(di->bat))
+ else if (power_supply_am_i_supplied(di->bat) > 0)
status = POWER_SUPPLY_STATUS_NOT_CHARGING;
else
status = POWER_SUPPLY_STATUS_DISCHARGING;