Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8cfaaa81 authored by Pali Rohár's avatar Pali Rohár Committed by Anton Vorontsov
Browse files

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: default avatarPali Rohár <pali.rohar@gmail.com>
Signed-off-by: default avatarAnton Vorontsov <cbouatmailru@gmail.com>
parent c6cd4f26
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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);