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


##########
include/sys/poll.h:
##########
@@ -82,6 +82,16 @@
 #define POLLSOCK     (0x80)
 #define POLLMASK     (0xC0)
 
+/* poll_notify option definitions */
+
+#define POLL_NOTIFY_NOCHECK (0x00000001)
+
+#define poll_notify(sfds, nfds, eventset)           \

Review Comment:
   ```suggestion
   #define poll_notify(sfds, nfds, eventset) \
   ```



##########
fs/vfs/fs_poll.c:
##########
@@ -276,6 +277,62 @@ static inline int poll_teardown(FAR struct pollfd *fds, 
nfds_t nfds,
  * Public Functions
  ****************************************************************************/
 
+/****************************************************************************
+ * Name: poll_notify_common
+ *
+ * Description:
+ *   Notify the poll, this function should be called by drivers to notify
+ *   the caller the poll is ready.
+ *
+ * Input Parameters:
+ *   afds     - The fds array
+ *   nfds     - Number of fds array
+ *   eventset - List of events to check for activity
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+void poll_notify_common(FAR struct pollfd **afds, int nfds,
+                        pollevent_t eventset, uint32_t option)
+{
+  int i;
+  int semcount;
+  FAR struct pollfd *fds;
+
+  DEBUGASSERT(nfds >= 1);
+
+  for (i = 0; i < nfds; i++)
+    {
+      fds = afds[i];
+      if (fds == NULL)
+        {
+          continue;
+        }

Review Comment:
   minor / optional:
   I would better use `if (fds != NULL)` and avoid `continue`.



##########
include/sys/poll.h:
##########
@@ -82,6 +82,16 @@
 #define POLLSOCK     (0x80)
 #define POLLMASK     (0xC0)
 
+/* poll_notify option definitions */
+
+#define POLL_NOTIFY_NOCHECK (0x00000001)
+
+#define poll_notify(sfds, nfds, eventset)           \
+  poll_notify_common(sfds, nfds, eventset, 0)
+
+#define poll_notify_nocheck(sfds, nfds, eventset)   \

Review Comment:
   ```suggestion
   #define poll_notify_nocheck(sfds, nfds, eventset) \
   ```



##########
net/netlink/netlink_sockif.c:
##########
@@ -595,7 +593,7 @@ static int netlink_poll(FAR struct socket *psock, FAR 
struct pollfd *fds,
       if (revents != 0)
         {
           fds->revents = revents;
-          nxsem_post(fds->sem);
+          poll_notify_nocheck(&fds, 1, 0);

Review Comment:
   Should it be
   ```suggestion
             poll_notify_nocheck(&fds, 1, revents);
   ```
   ?



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