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

Commit 2582140f authored by Sahil Chandna's avatar Sahil Chandna
Browse files

power: qpnp-fg-gen3: Fix FG cleanup operation



Cancel all work/timers as part of FG cleanup
before releasing/destroying any resource.

Change-Id: I3f540a51bcf658c171a45c291ac290b8849e5350
Signed-off-by: default avatarSahil Chandna <chandna@codeaurora.org>
parent 61956696
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -5604,13 +5604,24 @@ static void fg_cleanup(struct fg_chip *chip)
{
	int i;

	power_supply_unreg_notifier(&chip->nb);
	qpnp_misc_twm_notifier_unregister(&chip->twm_nb);
	cancel_delayed_work_sync(&chip->ttf_work);
	cancel_delayed_work_sync(&chip->sram_dump_work);
	if (chip->dt.use_esr_sw)
		alarm_cancel(&chip->esr_sw_timer);
	cancel_work_sync(&chip->esr_sw_work);
	cancel_delayed_work_sync(&chip->profile_load_work);
	cancel_work_sync(&chip->status_change_work);
	cancel_work_sync(&chip->esr_filter_work);
	cancel_delayed_work_sync(&chip->pl_enable_work);

	for (i = 0; i < FG_IRQ_MAX; i++) {
		if (fg_irqs[i].irq)
			devm_free_irq(chip->dev, fg_irqs[i].irq, chip);
	}

	alarm_try_to_cancel(&chip->esr_filter_alarm);
	power_supply_unreg_notifier(&chip->nb);
	debugfs_remove_recursive(chip->dfs_root);
	if (chip->awake_votable)
		destroy_votable(chip->awake_votable);