MLK-11147 usb: chipidea: otg: keep irq enabled if otg work had been queued
authorLi Jun <jun.li@freescale.com>
Tue, 23 Jun 2015 02:46:44 +0000 (10:46 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:47:17 +0000 (14:47 -0500)
If the otg work had been queued, current code will disable irq again
but the otg work will be done only once, so the irq enable and disable
cannot be balanced, this patch is to fix this.

Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 0d5c0888eaec17289e40968d7d15b92b781ed34f)

drivers/usb/chipidea/otg.h

index 43296cd..95fa6c2 100644 (file)
@@ -21,11 +21,13 @@ void ci_handle_id_switch(struct ci_hdrc *ci);
 void ci_handle_vbus_connected(struct ci_hdrc *ci);
 static inline void ci_otg_queue_work(struct ci_hdrc *ci)
 {
-       WARN_ON(!ci->wq);
-
-       disable_irq_nosync(ci->irq);
-       if (ci->wq)
-               queue_work(ci->wq, &ci->work);
+       if (ci->wq) {
+               disable_irq_nosync(ci->irq);
+               if (!queue_work(ci->wq, &ci->work))
+                       enable_irq(ci->irq);
+       } else {
+               WARN_ON(!ci->wq);
+       }
 }
 
 #endif /* __DRIVERS_USB_CHIPIDEA_OTG_H */