Skip to content

Commit

Permalink
bq27x00_battery: Fix OOPS caused by unregistring bq27x00 driver
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
  • Loading branch information
pali authored and enomsg committed Nov 25, 2011
1 parent c6cd4f2 commit 8cfaaa8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/power/bq27x00_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8cfaaa8

Please sign in to comment.