pkarashchenko commented on code in PR #6518:
URL: https://github.com/apache/incubator-nuttx/pull/6518#discussion_r906661477


##########
drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.c:
##########
@@ -892,23 +962,44 @@ int bcmf_sdio_thread(int argc, char **argv)
 
   while (true)
     {
-      /* Wait for event (device interrupt, user request or waitdog timer) */
+      /* Check if RX/TX frames are available */
 
-      ret = nxsem_wait_uninterruptible(&sbus->thread_signal);
-      if (ret < 0)
+      if ((sbus->intstatus & I_HMB_FRAME_IND) == 0 &&
+          (sbus->tx_queue.tail == NULL) &&
+          !sbus->irq_pending)
         {
-          wlerr("Error while waiting for semaphore\n");
-          break;
-        }
+          /* Wait for event (device interrupt or user request) */
+
+          if (timeout == UINT_MAX)
+            {
+              ret = nxsem_wait_uninterruptible(&sbus->thread_signal);
+            }
+          else
+            {
+              ret = nxsem_tickwait_uninterruptible(&sbus->thread_signal,
+                                                   timeout);
+            }
 
-      /* Restart the waitdog timer */
+          if (ret == -ETIMEDOUT)
+            {
+              /* Turn off clock request. */
+
+              timeout = UINT_MAX;
+              bcmf_sdio_bus_lowpower(sbus, true);
+              continue;

Review Comment:
   oops... sorry, missed where the scope ends. I thought that it will drop to 
the end of while, but it is end of `if ((sbus->intstatus & I_HMB_FRAME_IND) == 
0 && ...`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to