Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

power: bq24190_charger: Change first_time flag reset condition

The initial register reset of BQ24190 generates a charger status change
whose propagation via power_supply_changed is prevented using a flag.
This flag gets never reset so all following events are ignored as well
leading for example to userspace not detecting charger connects/disconnects.

Therefor change the reset condition of first_time flag, so only the
propagation of the first charger status change is prevented.

Signed-off-by: Thomas Elste <thomas.elste@imms.de>
Signed-off-by: Sebastian Reichel <sre@kernel.org>

authored by

Thomas Elste and committed by
Sebastian Reichel
cd054ee1 843735b7

+7 -4
+7 -4
drivers/power/bq24190_charger.c
··· 1258 1258 * register reset so we should ignore that one (the very first 1259 1259 * interrupt received). 1260 1260 */ 1261 - if (alert_userspace && !bdi->first_time) { 1262 - power_supply_changed(bdi->charger); 1263 - power_supply_changed(bdi->battery); 1264 - bdi->first_time = false; 1261 + if (alert_userspace) { 1262 + if (!bdi->first_time) { 1263 + power_supply_changed(bdi->charger); 1264 + power_supply_changed(bdi->battery); 1265 + } else { 1266 + bdi->first_time = false; 1267 + } 1265 1268 } 1266 1269 1267 1270 out: