From 8cfaaa811894a3ae2d7360a15a6cfccff3ebc7db Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Tue, 1 Nov 2011 01:43:11 +0100 Subject: bq27x00_battery: Fix OOPS caused by unregistring bq27x00 driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 Signed-off-by: Anton Vorontsov --- drivers/power/bq27x00_battery.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/power') 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); -- cgit v1.2.3