diff options
-rw-r--r-- | nuttx/arch/arm/src/sama5/sam_ohci.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/nuttx/arch/arm/src/sama5/sam_ohci.c b/nuttx/arch/arm/src/sama5/sam_ohci.c index 937689f8b..d466f7648 100644 --- a/nuttx/arch/arm/src/sama5/sam_ohci.c +++ b/nuttx/arch/arm/src/sama5/sam_ohci.c @@ -1616,11 +1616,17 @@ static int sam_wait(FAR struct usbhost_driver_s *drvr, FAR const bool *connected { /* Has the connection state changed on the RH port? */ - while (priv->rhport[rhpndx].connected != connected[rhpndx]) + if (priv->rhport[rhpndx].connected != connected[rhpndx]) { - /* Yes.. break out and return the RH port number */ + /* Yes.. Return the RH port number */ - break; + irqrestore(flags); + + udbg("RHPort%d connected: %s\n", + rhpndx + 1, + priv->rhport[rhpndx].connected ? "YES" : "NO"); + + return rhpndx; } } @@ -1631,13 +1637,6 @@ static int sam_wait(FAR struct usbhost_driver_s *drvr, FAR const bool *connected priv->rhswait = true; sam_takesem(&priv->rhssem); } - - irqrestore(flags); - - udbg("RHPort%d connected: %s\n", - rhpndx + 1, priv->rhport[rhpndx].connected ? "YES" : "NO"); - - return rhpndx; } /******************************************************************************* |