Improve battery status notification
authorMichael Trimarchi <trimarchi@gandalf.sssup.it>
Sat, 23 May 2009 20:54:00 +0000 (17:54 -0300)
committerNelson Castillo <arhuaco@freaks-unidos.net>
Mon, 1 Jun 2009 23:38:19 +0000 (20:38 -0300)
This patch adds a call to cancel_delayed_work before a call
to schedule_delayed_work.

Signed-off-by: Michael Trimarchi <michael@panicking.kicks-ass.org>
Signed-off-by: Daniel Willmann <daniel@totalueberwachung.de>
drivers/power/bq27000_battery.c

index 9f0f1a9..7e8b3f8 100644 (file)
@@ -170,9 +170,11 @@ static int hdq_read16(struct bq27000_device_info *di, int address)
 
 static void bq27000_battery_external_power_changed(struct power_supply *psy)
 {
-       struct bq27000_device_info *di = container_of(psy, struct bq27000_device_info, bat);
+       struct bq27000_device_info *di =
+               container_of(psy, struct bq27000_device_info, bat);
 
        dev_dbg(di->dev, "%s\n", __FUNCTION__);
+       cancel_delayed_work(&di->work);
        schedule_delayed_work(&di->work, 0);
 }