mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 22:40:54 -04:00
add flag to ensure shutdown call only once
vbat_shutdown_triggler may run again an again before poweroff really excuted, it may cause a kernel panic. add flag to ensure shutdown only excutes once Change-Id: I1070a9eaef078fa15e01845e53022977ac559b0a Signed-off-by: xuxj12 <xuxj12@motorola.com> Reviewed-on: https://gerrit.mot.com/2401294 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Reviewed-by: Yonghua Yan <yanyh2@motorola.com> Reviewed-by: Jianqi Yang <yangj@motorola.com> Tested-by: Jira Key Submit-Approved: Jira Key
This commit is contained in:
parent
bd74cdd3bc
commit
295c26df84
1 changed files with 5 additions and 2 deletions
|
|
@ -2137,6 +2137,7 @@ static void mmi_charger_heartbeat_work(struct work_struct *work)
|
|||
heartbeat_work.work);
|
||||
struct timespec64 now;
|
||||
static struct timespec64 start;
|
||||
static bool shutdown_triggered = false;
|
||||
uint32_t elapsed_ms;
|
||||
|
||||
/* Have not been resumed so wait another 100 ms */
|
||||
|
|
@ -2188,8 +2189,9 @@ static void mmi_charger_heartbeat_work(struct work_struct *work)
|
|||
if (elapsed_ms < chip->factory_kill_debounce_ms) {
|
||||
mmi_err(chip, "Factory kill debounce elapsed_ms:%d\n",
|
||||
elapsed_ms);
|
||||
} else {
|
||||
} else if(!shutdown_triggered) {
|
||||
mmi_err(chip, "Factory kill power off\n");
|
||||
shutdown_triggered = true;
|
||||
#if (KERNEL_VERSION(5, 10, 0) > LINUX_VERSION_CODE) || defined(MMI_GKI_API_ALLOWANCE)
|
||||
orderly_poweroff(true);
|
||||
#else
|
||||
|
|
@ -2201,8 +2203,9 @@ static void mmi_charger_heartbeat_work(struct work_struct *work)
|
|||
}
|
||||
}
|
||||
|
||||
if (chip->empty_vbat_shutdown_triggered) {
|
||||
if (chip->empty_vbat_shutdown_triggered && !shutdown_triggered) {
|
||||
mmi_err(chip, "shutdown for empty battery voltage\n");
|
||||
shutdown_triggered = true;
|
||||
#if (KERNEL_VERSION(5, 10, 0) > LINUX_VERSION_CODE) || defined(MMI_GKI_API_ALLOWANCE)
|
||||
orderly_poweroff(true);
|
||||
#else
|
||||
|
|
|
|||
Loading…
Reference in a new issue