max1720x, max77779fg: avoid double lock on batt_ce_lock
- use cancel_delayed_work instead of cancel_delayed_work_sync(), sync by
ce->estimate_state
- move batt_ce_dump_data() before batt_ce_stop_estimation() clears data
Bug: 380195438
Test: trigger batt_ce_start -> remove charger -> no panic
Signed-off-by: Spade Lee <[email protected]>
(cherry picked from https://partner-android-review.googlesource.com/q/commit:98fcdb45209820ada6bd878ef6f1fd2d0fda908d)
Merged-In: I4451084eb0f1054124f56123fc53b2f7bf78d8b9
Change-Id: I4451084eb0f1054124f56123fc53b2f7bf78d8b9
diff --git a/max1720x_battery.c b/max1720x_battery.c
index f85e030..4833bad 100644
--- a/max1720x_battery.c
+++ b/max1720x_battery.c
@@ -2754,11 +2754,11 @@
} else if (ce->cable_in) {
if (ce->estimate_state == ESTIMATE_PENDING)
- cancel_delayed_work_sync(&ce->settle_timer);
+ cancel_delayed_work(&ce->settle_timer);
/* race with batt_ce_capacityfiltered_work() */
- batt_ce_stop_estimation(ce, ESTIMATE_NONE);
batt_ce_dump_data(ce, chip->ce_log);
+ batt_ce_stop_estimation(ce, ESTIMATE_NONE);
ce->cable_in = false;
}
mutex_unlock(&ce->batt_ce_lock);
diff --git a/max77779_fg.c b/max77779_fg.c
index 61e60b8..e3f26b0 100644
--- a/max77779_fg.c
+++ b/max77779_fg.c
@@ -1722,11 +1722,11 @@
} else if (ce->cable_in) {
if (ce->estimate_state == ESTIMATE_PENDING)
- cancel_delayed_work_sync(&ce->settle_timer);
+ cancel_delayed_work(&ce->settle_timer);
/* race with batt_ce_capacityfiltered_work() */
- batt_ce_stop_estimation(ce, ESTIMATE_NONE);
batt_ce_dump_data(ce, chip->ce_log);
+ batt_ce_stop_estimation(ce, ESTIMATE_NONE);
ce->cable_in = false;
}
mutex_unlock(&ce->batt_ce_lock);