MLK-11183-2 usb: chipidea: otg: disable otg interrupt before flush_workqueue
authorPeter Chen <peter.chen@freescale.com>
Thu, 2 Jul 2015 01:41:04 +0000 (09:41 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:47:17 +0000 (14:47 -0500)
We do not want (care) the interrupt during we remove the otg function,
so move it beforehand.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 9ae22c687fd161dfff2e81512b50143fa154b9bb)

drivers/usb/chipidea/otg.c

index 1d2d99c..7c1a6b6 100644 (file)
@@ -327,14 +327,14 @@ int ci_hdrc_otg_init(struct ci_hdrc *ci)
  */
 void ci_hdrc_otg_destroy(struct ci_hdrc *ci)
 {
+       /* Disable all OTG irq and clear status */
+       hw_write_otgsc(ci, OTGSC_INT_EN_BITS | OTGSC_INT_STATUS_BITS,
+                                               OTGSC_INT_STATUS_BITS);
        if (ci->wq) {
                flush_workqueue(ci->wq);
                destroy_workqueue(ci->wq);
                ci->wq = NULL;
        }
-       /* Disable all OTG irq and clear status */
-       hw_write_otgsc(ci, OTGSC_INT_EN_BITS | OTGSC_INT_STATUS_BITS,
-                                               OTGSC_INT_STATUS_BITS);
        if (ci_otg_is_fsm_mode(ci))
                ci_hdrc_otg_fsm_remove(ci);
 }