usb: dwc3-msm: Switch to freezable workqueue for sm_work
Use freezable workqueue for running the sm_work. The sm_work
add/removes the platform_dev to switch between host and the
gadget mode. However, the work_item does not have protection
against the system suspend/resume. Using freezable workqueue
ensures that the device tree is not changed while the
system is suspending or resuming. Using the system freezable
workqueue instead of creating a new one.
Bug: 112805393
Change-Id: I9242e9386043cea4f8f765010e32efaa3f10059d
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c
index 87b306c..88dd3fc 100644
--- a/drivers/usb/dwc3/dwc3-msm.c
+++ b/drivers/usb/dwc3/dwc3-msm.c
@@ -1875,7 +1875,7 @@ static int msm_dwc3_usbdev_notify(struct notifier_block *self,
}
mdwc->hc_died = true;
- schedule_delayed_work(&mdwc->sm_work, 0);
+ queue_delayed_work(system_freezable_wq, &mdwc->sm_work, 0);
return 0;
}
@@ -2915,7 +2915,7 @@ static void dwc3_ext_event_notify(struct dwc3_msm *mdwc)
clear_bit(B_SUSPEND, &mdwc->inputs);
}
- schedule_delayed_work(&mdwc->sm_work, 0);
+ queue_delayed_work(system_freezable_wq, &mdwc->sm_work, 0);
}
static void dwc3_resume_work(struct work_struct *w)
@@ -3984,7 +3984,7 @@ static int dwc3_msm_probe(struct platform_device *pdev)
dwc3_msm_id_notifier(&mdwc->id_nb, true, mdwc->extcon_id);
else if (!pval.intval) {
/* USB cable is not connected */
- schedule_delayed_work(&mdwc->sm_work, 0);
+ queue_delayed_work(system_freezable_wq, &mdwc->sm_work, 0);
} else {
if (pval.intval > 0)
dev_info(mdwc->dev, "charger detection in progress\n");
@@ -4785,7 +4785,7 @@ static void dwc3_otg_sm_work(struct work_struct *w)
}
if (work)
- schedule_delayed_work(&mdwc->sm_work, delay);
+ queue_delayed_work(system_freezable_wq, &mdwc->sm_work, delay);
ret:
return;