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)
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 */