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


##########
include/sys/poll.h:
##########
@@ -117,7 +122,8 @@ struct pollfd
   /* Non-standard fields used internally by NuttX. */
 
   FAR void    *ptr;     /* The psock or file being polled */
-  FAR sem_t   *sem;     /* Pointer to semaphore used to post output event */
+  FAR void    *args;    /* The poll callback function arguments */
+  FAR pollcb_t cb;      /* The poll callback function */

Review Comment:
   ```suggestion
     pollcb_t cb;          /* The poll callback function */
   ```



##########
fs/vfs/fs_poll.c:
##########
@@ -277,6 +279,37 @@ static inline int poll_teardown(FAR struct pollfd *fds, 
nfds_t nfds,
  * Public Functions
  ****************************************************************************/
 
+/****************************************************************************
+ * Name: poll_default_cb
+ *
+ * Description:
+ *   The default poll callback function, this function do the final step of
+ *   poll notification.
+ *
+ * Input Parameters:
+ *   fds - The fds
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+void poll_default_cb(FAR struct pollfd *fds)
+{
+  int semcount = 0;
+  FAR sem_t *pollsem;

Review Comment:
   Optionally. This can be moved inside `if (fds->args != NULL)`



##########
fs/vfs/fs_poll.c:
##########
@@ -317,15 +349,10 @@ void poll_notify(FAR struct pollfd **afds, int nfds, 
pollevent_t eventset)
               fds->revents &= ~POLLOUT;
             }
 
-          if (fds->revents != 0)
+          if (fds->revents != 0 && fds->cb)

Review Comment:
   Optional
   ```suggestion
             if (fds->revents != 0 && fds->cb != NULL)
   ```



##########
fs/vfs/fs_poll.c:
##########
@@ -277,6 +279,37 @@ static inline int poll_teardown(FAR struct pollfd *fds, 
nfds_t nfds,
  * Public Functions
  ****************************************************************************/
 
+/****************************************************************************
+ * Name: poll_default_cb
+ *
+ * Description:
+ *   The default poll callback function, this function do the final step of
+ *   poll notification.
+ *
+ * Input Parameters:
+ *   fds - The fds
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+void poll_default_cb(FAR struct pollfd *fds)
+{
+  int semcount = 0;
+  FAR sem_t *pollsem;
+
+  if (fds->args != NULL)
+    {
+      pollsem = (FAR sem_t *)fds->args;

Review Comment:
   ```suggestion
         pollsem = fds->args;
   ```



-- 
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