UPSTREAM: usb: dwc3: gadget: simplify run_stop() break condition
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 9 Jun 2016 13:47:05 +0000 (16:47 +0300)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 16 Aug 2016 12:48:19 +0000 (20:48 +0800)
commit13f2374f1b1b13f6fd1760987df7066dda6420b1
tree461c03155c5badb45ccdbc5906b430ebe27df94d
parentd7824564eb094b81a907ca6e052dec326bb1059a
UPSTREAM: usb: dwc3: gadget: simplify run_stop() break condition

it's clear now that when is_on=true, we must loop
until DWC3_DSTS_DEVCTRLHLT clears; while when
is_on=false we must loop until DWC3_DSTS_DEVCTRLHLT
gets set.

Instead of adding actual if() statements, we can
rely on XOR operation to evaluate to true only when
the above conditions apply. Then, we can move the
break condition back to the while() statement
together with our timeout check and the resulting
code is very compact and simpler to read.

Change-Id: Id540c7422cd1d7e00120c26353d99e2e9888ea26
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit b6d4e16e831376b676edb3463f2bdaa192e5f7be)
drivers/usb/dwc3/gadget.c