]> git.karo-electronics.de Git - linux-beck.git/commitdiff
power: bq24190_charger: Change first_time flag reset condition
authorThomas Elste <thomas.elste@imms.de>
Thu, 28 May 2015 09:05:32 +0000 (11:05 +0200)
committerSebastian Reichel <sre@kernel.org>
Fri, 29 May 2015 02:26:50 +0000 (04:26 +0200)
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>
drivers/power/bq24190_charger.c

index 407c4af83891331611ba710c62a7b5a8d1633d7b..052db78c373650979f620cd031cf7f7b0fa067b7 100644 (file)
@@ -1258,10 +1258,13 @@ static irqreturn_t bq24190_irq_handler_thread(int irq, void *data)
         * register reset so we should ignore that one (the very first
         * interrupt received).
         */
-       if (alert_userspace && !bdi->first_time) {
-               power_supply_changed(bdi->charger);
-               power_supply_changed(bdi->battery);
-               bdi->first_time = false;
+       if (alert_userspace) {
+               if (!bdi->first_time) {
+                       power_supply_changed(bdi->charger);
+                       power_supply_changed(bdi->battery);
+               } else {
+                       bdi->first_time = false;
+               }
        }
 
 out: