UPSTREAM: usb: dwc3: gadget: simplify run_stop() break condition
[firefly-linux-kernel-4.4.55.git] / drivers / usb / dwc3 / gadget.c
index 92abd5e382fe1dc63227ba52691dbc7006db3f2c..0400d3f9ba8f9c0d3a548649e60c05691a967cda 100644 (file)
@@ -1584,14 +1584,8 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend)
 
        do {
                reg = dwc3_readl(dwc->regs, DWC3_DSTS);
-               if (is_on) {
-                       if (!(reg & DWC3_DSTS_DEVCTRLHLT))
-                               break;
-               } else {
-                       if (reg & DWC3_DSTS_DEVCTRLHLT)
-                               break;
-               }
-       } while (--timeout);
+               reg &= DWC3_DSTS_DEVCTRLHLT;
+       } while (--timeout && !(!is_on ^ !reg));
 
        if (!timeout)
                return -ETIMEDOUT;