usb: chipidea: Fix otg event handler
authorLoic Poulain <loic.poulain@linaro.org>
Tue, 4 Sep 2018 15:18:58 +0000 (17:18 +0200)
committerPeter Chen <peter.chen@nxp.com>
Thu, 20 Sep 2018 09:04:22 +0000 (17:04 +0800)
At OTG work running time, it's possible that several events need to be
addressed (e.g. ID and VBUS events). The current implementation handles
only one event at a time which leads to ignoring the other one. Fix it.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
drivers/usb/chipidea/otg.c

index db4ceffcf2a6118c9063fa720830cc337a6f92c3..f25d4827fd49c41179326f517b8aeaa7999f54dd 100644 (file)
@@ -203,14 +203,17 @@ static void ci_otg_work(struct work_struct *work)
        }
 
        pm_runtime_get_sync(ci->dev);
+
        if (ci->id_event) {
                ci->id_event = false;
                ci_handle_id_switch(ci);
-       } else if (ci->b_sess_valid_event) {
+       }
+
+       if (ci->b_sess_valid_event) {
                ci->b_sess_valid_event = false;
                ci_handle_vbus_change(ci);
-       } else
-               dev_err(ci->dev, "unexpected event occurs at %s\n", __func__);
+       }
+
        pm_runtime_put_sync(ci->dev);
 
        enable_irq(ci->irq);