Initialize the delay work before IRQ init

Initialize the delay work before IRQ init in case the irq
occurs to schedule the delay work before it initialized
and cause Kernel panic.

Change-Id: I9497e4ca66193d9f9170b666dd15a9fed9fd890b
Signed-off-by: Yonghua Yan <yanyh2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2497207
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: litong <litong20@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Yonghua Yan committed 2023-01-30 03:29:49 -06:00
1 parent d44cfbed7c
commit fd3c66b1b0
1 file changed
+3 -2
@@ -3390,6 +3390,9 @@ static int sgm4154x_probe(struct i2c_client *client,
otg_notify = usb_register_notifier(sgm->usb3_phy, &sgm->usb_nb);
}
INIT_DELAYED_WORK(&sgm->charge_detect_delayed_work, charger_detect_work_func);
INIT_DELAYED_WORK(&sgm->charge_monitor_work, charger_monitor_work_func);
if (client->irq) {
ret = devm_request_threaded_irq(dev, client->irq, NULL,
sgm4154x_irq_handler_thread,
@@ -3402,8 +3405,6 @@ static int sgm4154x_probe(struct i2c_client *client,
sgm->irq_enabled = true;
}
INIT_DELAYED_WORK(&sgm->charge_detect_delayed_work, charger_detect_work_func);
INIT_DELAYED_WORK(&sgm->charge_monitor_work, charger_monitor_work_func);
sgm->pm_nb.notifier_call = sgm4154x_suspend_notifier;
register_pm_notifier(&sgm->pm_nb);
sgm->psy_nb.notifier_call = sgm4154x_psy_notifier_call;