bq27x00_battery: Fix OOPS caused by unregistring bq27x00 driver
authorPali Rohár <pali.rohar@gmail.com>
Tue, 1 Nov 2011 00:43:11 +0000 (01:43 +0100)
committerGrazvydas Ignotas <notasas@gmail.com>
Sat, 14 Jan 2012 21:13:21 +0000 (23:13 +0200)
* power_supply_unregister call bq27x00_battery_get_property which
  call bq27x00_battery_poll
* make sure that bq27x00_battery_poll will not call
  schedule_delayed_work again after unregister (which cause OOPS)

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
drivers/power/bq27x00_battery.c

index 81d3dce..d4b5281 100644 (file)
@@ -593,6 +593,14 @@ static int bq27x00_powersupply_init(struct bq27x00_device_info *di)
 
 static void bq27x00_powersupply_unregister(struct bq27x00_device_info *di)
 {
+       /*
+        * power_supply_unregister call bq27x00_battery_get_property which
+        * call bq27x00_battery_poll.
+        * Make sure that bq27x00_battery_poll will not call
+        * schedule_delayed_work again after unregister (which cause OOPS).
+        */
+       poll_interval = 0;
+
        cancel_delayed_work_sync(&di->work);
 
        power_supply_unregister(&di->bat);