异常处理线程:
/kernel-4.19/drivers/power/supply/mtk_battery.c
void mtk_power_misc_init(struct mtk_battery *gm)
{
mutex_init(&gm->sdc.lock);
alarm_init(&gm->sdc.kthread_fgtimer, ALARM_BOOTTIME,
power_misc_kthread_fgtimer_func);
init_waitqueue_head(&gm->sdc.wait_que);
kthread_run(power_misc_routine_thread, gm, "power_misc_thread");
gm->sdc.psy_nb.notifier_call = mtk_power_misc_psy_event;
power_supply_reg_notifier(&gm->sdc.psy_nb);
}
static int power_misc_routine_thread(void *arg)
{
struct mtk_battery *gm = arg;
struct shutdown_controller *sdd = &gm->sdc;
while (1) {
wait_event(sdd->wait_que, (sdd->timeout == true)
|| (sdd->overheat == true));
if (sdd->timeout == true) {
sdd->timeout = false;
power_misc_handler(gm);
}
if (sdd->overheat == true) {
sdd->overheat = false;
bm_debug("%s battery overheat~ power off\n",
__func__);
kernel_power_off();
return 1;
}
}
return 0;
}