summaryrefslogtreecommitdiffstats
path: root/drivers/power/bq27x00_battery.c
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2011-11-01 01:43:11 +0100
committerAnton Vorontsov <cbouatmailru@gmail.com>2011-11-26 00:03:44 +0400
commit8cfaaa811894a3ae2d7360a15a6cfccff3ebc7db (patch)
treede05bfaa8a687daf431827a10548f9e9797c1569 /drivers/power/bq27x00_battery.c
parentc6cd4f267d442f2ce279024adb03a69e8608e0f6 (diff)
downloadlinux-8cfaaa811894a3ae2d7360a15a6cfccff3ebc7db.tar.gz
linux-8cfaaa811894a3ae2d7360a15a6cfccff3ebc7db.tar.bz2
linux-8cfaaa811894a3ae2d7360a15a6cfccff3ebc7db.zip
bq27x00_battery: Fix OOPS caused by unregistring bq27x00 driver
* 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>
Diffstat (limited to 'drivers/power/bq27x00_battery.c')
-rw-r--r--drivers/power/bq27x00_battery.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index 82ab6ca45f58..98bf5676318d 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -598,6 +598,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);