You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/09/26 04:06:37 UTC

[incubator-nuttx] branch master updated: poll: add poll_notify() api and call it in all drivers

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 344c8be049 poll: add poll_notify() api and call it in all drivers
344c8be049 is described below

commit 344c8be049df5a90556dffa3a68ad90c9883d66b
Author: wangbowen6 <wa...@xiaomi.com>
AuthorDate: Mon Sep 19 11:08:57 2022 +0800

    poll: add poll_notify() api and call it in all drivers
    
    Signed-off-by: wangbowen6 <wa...@xiaomi.com>
---
 arch/arm/src/cxd56xx/cxd56_geofence.c              | 12 +---
 arch/arm/src/cxd56xx/cxd56_gnss.c                  | 12 +---
 arch/arm/src/sama5/sam_tsd.c                       | 13 +----
 arch/arm/src/stm32/stm32_bbsram.c                  |  6 +-
 arch/arm/src/stm32f7/stm32_bbsram.c                |  6 +-
 arch/arm/src/stm32h7/stm32_bbsram.c                |  6 +-
 arch/renesas/src/rx65n/rx65n_sbram.c               |  6 +-
 boards/arm/sam34/sam4l-xplained/src/sam_slcd.c     |  6 +-
 .../stm32/mikroe-stm32f4/src/stm32_touchscreen.c   | 14 +----
 boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c   |  6 +-
 .../pic32mx/pic32mx7mmb/src/pic32_touchscreen.c    | 14 +----
 .../pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c     |  6 +-
 drivers/analog/adc.c                               | 23 +-------
 drivers/analog/comp.c                              | 44 +--------------
 drivers/bch/bchdev_driver.c                        |  6 +-
 drivers/can/can.c                                  | 42 ++------------
 drivers/crypto/dev_urandom.c                       |  6 +-
 drivers/input/ads7843e.c                           | 13 +----
 drivers/input/ajoystick.c                          | 23 +-------
 drivers/input/button_upper.c                       | 23 +-------
 drivers/input/cypress_mbr3108.c                    | 25 ++-------
 drivers/input/djoystick.c                          | 23 +-------
 drivers/input/ft5x06.c                             | 13 +----
 drivers/input/keyboard_upper.c                     | 29 +---------
 drivers/input/max11802.c                           | 13 +----
 drivers/input/mxt.c                                | 13 +----
 drivers/input/spq10kbd.c                           | 25 +--------
 drivers/input/stmpe811_tsc.c                       | 13 +----
 drivers/input/touchscreen_upper.c                  | 34 +-----------
 drivers/input/tsc2007.c                            | 13 +----
 drivers/ipcc/ipcc_poll.c                           | 60 +-------------------
 drivers/lcd/pcf8574_lcd_backpack.c                 |  6 +-
 drivers/lcd/tda19988.c                             |  6 +-
 drivers/misc/dev_null.c                            |  6 +-
 drivers/misc/dev_zero.c                            |  6 +-
 drivers/modem/u-blox.c                             |  6 +-
 drivers/mtd/mtd_config.c                           |  6 +-
 drivers/mtd/mtd_config_fs.c                        |  6 +-
 drivers/net/telnet.c                               |  6 +-
 drivers/net/tun.c                                  | 17 ++----
 drivers/pipes/pipe_common.c                        | 54 +++---------------
 drivers/power/battery/battery_charger.c            |  7 +--
 drivers/power/battery/battery_gauge.c              |  7 +--
 drivers/power/battery/battery_monitor.c            |  7 +--
 drivers/rc/lirc_dev.c                              | 38 ++-----------
 drivers/sensors/hc_sr04.c                          | 28 +---------
 drivers/sensors/hts221.c                           | 28 +---------
 drivers/sensors/lis2dh.c                           | 31 +----------
 drivers/sensors/max44009.c                         |  4 +-
 drivers/sensors/sensor.c                           | 31 ++---------
 drivers/serial/serial.c                            | 50 ++---------------
 drivers/serial/uart_bth4.c                         | 26 ++-------
 drivers/syslog/ramlog.c                            | 17 +-----
 drivers/usbdev/adb.c                               | 45 ++-------------
 drivers/usbhost/usbhost_cdcmbim.c                  | 32 +----------
 drivers/usbhost/usbhost_hidkbd.c                   | 31 +----------
 drivers/usbhost/usbhost_hidmouse.c                 | 42 +-------------
 drivers/usbhost/usbhost_xboxcontroller.c           | 13 +----
 drivers/usbmisc/fusb301.c                          | 37 +------------
 drivers/usbmisc/fusb303.c                          | 37 +------------
 drivers/usrsock/usrsock_dev.c                      | 30 +---------
 drivers/wireless/cc1101.c                          |  8 +--
 drivers/wireless/gs2200m.c                         |  7 +--
 drivers/wireless/lpwan/sx127x/sx127x.c             | 13 +----
 drivers/wireless/nrf24l01.c                        |  8 +--
 fs/mqueue/mq_open.c                                | 37 +------------
 fs/vfs/fs_epoll.c                                  |  3 +-
 fs/vfs/fs_eventfd.c                                | 35 +-----------
 fs/vfs/fs_poll.c                                   | 64 +++++++++++++++++++---
 fs/vfs/fs_timerfd.c                                | 32 ++---------
 graphics/nxterm/nxterm_kbdin.c                     | 17 +-----
 include/nuttx/mqueue.h                             | 29 +++-------
 include/sys/poll.h                                 |  2 +
 net/can/can_sockif.c                               | 22 +++-----
 net/icmp/icmp_netpoll.c                            | 20 ++-----
 net/icmpv6/icmpv6_netpoll.c                        | 20 ++-----
 net/local/local_netpoll.c                          | 37 ++++---------
 net/netlink/netlink.h                              |  3 +-
 net/netlink/netlink_sockif.c                       | 25 +++------
 net/rpmsg/rpmsg_sockif.c                           | 43 ++++-----------
 net/tcp/tcp_netpoll.c                              | 27 ++++-----
 net/udp/udp_netpoll.c                              | 22 +++-----
 net/usrsock/usrsock_poll.c                         | 48 +++-------------
 83 files changed, 289 insertions(+), 1441 deletions(-)

diff --git a/arch/arm/src/cxd56xx/cxd56_geofence.c b/arch/arm/src/cxd56xx/cxd56_geofence.c
index 813dc33b41..9d17e43f18 100644
--- a/arch/arm/src/cxd56xx/cxd56_geofence.c
+++ b/arch/arm/src/cxd56xx/cxd56_geofence.c
@@ -433,7 +433,6 @@ static void cxd56_geofence_sighandler(uint32_t data, void *userdata)
 {
   struct cxd56_geofence_dev_s *priv =
     (struct cxd56_geofence_dev_s *)userdata;
-  int i;
   int ret;
 
   ret = nxsem_wait(&priv->devsem);
@@ -442,16 +441,7 @@ static void cxd56_geofence_sighandler(uint32_t data, void *userdata)
       return;
     }
 
-  for (i = 0; i < CONFIG_GEOFENCE_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          gnssinfo("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
+  poll_notify(priv->fds, CONFIG_GEOFENCE_NPOLLWAITERS, POLLIN);
 
   nxsem_post(&priv->devsem);
 }
diff --git a/arch/arm/src/cxd56xx/cxd56_gnss.c b/arch/arm/src/cxd56xx/cxd56_gnss.c
index 41fb3cb5ae..16a87356a6 100644
--- a/arch/arm/src/cxd56xx/cxd56_gnss.c
+++ b/arch/arm/src/cxd56xx/cxd56_gnss.c
@@ -2318,7 +2318,6 @@ static void cxd56_gnss_default_sighandler(uint32_t data, void *userdata)
 {
   struct cxd56_gnss_dev_s *priv =
                           (struct cxd56_gnss_dev_s *)userdata;
-  int                      i;
   int                      ret;
   int                      dtype = CXD56_CPU1_GET_DATA(data);
 
@@ -2385,16 +2384,7 @@ static void cxd56_gnss_default_sighandler(uint32_t data, void *userdata)
       return;
     }
 
-  for (i = 0; i < CONFIG_CXD56_GNSS_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          gnssinfo("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
+  poll_notify(priv->fds, CONFIG_CXD56_GNSS_NPOLLWAITERS, POLLIN);
 
   nxsem_post(&priv->devsem);
 
diff --git a/arch/arm/src/sama5/sam_tsd.c b/arch/arm/src/sama5/sam_tsd.c
index 6db5af7d67..68333c1014 100644
--- a/arch/arm/src/sama5/sam_tsd.c
+++ b/arch/arm/src/sama5/sam_tsd.c
@@ -257,24 +257,13 @@ static struct sam_tsd_s g_tsd;
 
 static void sam_tsd_notify(struct sam_tsd_s *priv)
 {
-  int i;
-
   /* If there are threads waiting on poll() for touchscreen data to become
    * available, then wake them up now.  NOTE: we wake up all waiting threads
    * because we do not know that they are going to do.  If they all try to
    * read the data, then some make end up blocking after all.
    */
 
-  for (i = 0; i < CONFIG_SAMA5_TSD_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
+  poll_notify(priv->fds, CONFIG_SAMA5_TSD_NPOLLWAITERS, POLLIN);
 
   /* If there are threads waiting for read data, then signal one of them
    * that the read data is available.
diff --git a/arch/arm/src/stm32/stm32_bbsram.c b/arch/arm/src/stm32/stm32_bbsram.c
index 6f2cdf3fa3..75ddeca366 100644
--- a/arch/arm/src/stm32/stm32_bbsram.c
+++ b/arch/arm/src/stm32/stm32_bbsram.c
@@ -544,11 +544,7 @@ static int stm32_bbsram_poll(struct file *filep, struct pollfd *fds,
 {
   if (setup)
     {
-      fds->revents |= (fds->events & (POLLIN | POLLOUT));
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   return OK;
diff --git a/arch/arm/src/stm32f7/stm32_bbsram.c b/arch/arm/src/stm32f7/stm32_bbsram.c
index 4cc6111ee4..d02125386a 100644
--- a/arch/arm/src/stm32f7/stm32_bbsram.c
+++ b/arch/arm/src/stm32f7/stm32_bbsram.c
@@ -544,11 +544,7 @@ static int stm32_bbsram_poll(struct file *filep, struct pollfd *fds,
 {
   if (setup)
     {
-      fds->revents |= (fds->events & (POLLIN | POLLOUT));
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   return OK;
diff --git a/arch/arm/src/stm32h7/stm32_bbsram.c b/arch/arm/src/stm32h7/stm32_bbsram.c
index d05b56d58f..e8b48250d9 100644
--- a/arch/arm/src/stm32h7/stm32_bbsram.c
+++ b/arch/arm/src/stm32h7/stm32_bbsram.c
@@ -591,11 +591,7 @@ static int stm32_bbsram_poll(struct file *filep, struct pollfd *fds,
 {
   if (setup)
     {
-      fds->revents |= (fds->events & (POLLIN | POLLOUT));
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   return OK;
diff --git a/arch/renesas/src/rx65n/rx65n_sbram.c b/arch/renesas/src/rx65n/rx65n_sbram.c
index e36d8ec8e6..08874f1b51 100644
--- a/arch/renesas/src/rx65n/rx65n_sbram.c
+++ b/arch/renesas/src/rx65n/rx65n_sbram.c
@@ -488,11 +488,7 @@ static int rx65n_sbram_poll(FAR struct file *filep, FAR struct pollfd *fds,
 {
   if (setup)
     {
-      fds->revents |= (fds->events & (POLLIN | POLLOUT));
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   return OK;
diff --git a/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c b/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c
index ed6971e8ef..1d45a118de 100644
--- a/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c
+++ b/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c
@@ -1168,11 +1168,7 @@ static int slcd_poll(struct file *filep, struct pollfd *fds,
     {
       /* Data is always available to be read / Data can always be written */
 
-      fds->revents |= (fds->events & (POLLIN | POLLOUT));
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   return OK;
diff --git a/boards/arm/stm32/mikroe-stm32f4/src/stm32_touchscreen.c b/boards/arm/stm32/mikroe-stm32f4/src/stm32_touchscreen.c
index 0a52a57fcf..c09c122634 100644
--- a/boards/arm/stm32/mikroe-stm32f4/src/stm32_touchscreen.c
+++ b/boards/arm/stm32/mikroe-stm32f4/src/stm32_touchscreen.c
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
+#include <poll.h>
 #include <sched.h>
 #include <assert.h>
 #include <errno.h>
@@ -575,8 +576,6 @@ static inline bool tc_valid_sample(uint16_t sample)
 
 static void tc_notify(struct tc_dev_s *priv)
 {
-  int i;
-
   /* If no threads have the driver open, then just dump the state */
 
 #ifdef CONFIG_TOUCHSCREEN_REFCNT
@@ -595,16 +594,7 @@ static void tc_notify(struct tc_dev_s *priv)
    * read the data, then some make end up blocking after all.
    */
 
-  for (i = 0; i < CONFIG_TOUCHSCREEN_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
+  poll_notify(priv->fds, CONFIG_TOUCHSCREEN_NPOLLWAITERS, POLLIN);
 
   /* If there are threads waiting for read data, then signal one of them
    * that the read data is available.
diff --git a/boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c b/boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c
index 38ed31f696..7a0ac5dcaf 100644
--- a/boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c
+++ b/boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c
@@ -1502,11 +1502,7 @@ static int slcd_poll(struct file *filep, struct pollfd *fds,
     {
       /* Data is always available to be read / Data can always be written */
 
-      fds->revents |= (fds->events & (POLLIN | POLLOUT));
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   return OK;
diff --git a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c
index d36dee946d..8d5c8fcb96 100644
--- a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c
+++ b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
+#include <poll.h>
 #include <sched.h>
 #include <assert.h>
 #include <errno.h>
@@ -475,8 +476,6 @@ static inline bool tc_valid_sample(uint16_t sample)
 
 static void tc_notify(struct tc_dev_s *priv)
 {
-  int i;
-
   /* If there are threads waiting on poll() for touchscreen data to become
    * available, then wake them up now.  NOTE: we wake up all waiting threads
    * because we do not know that they are going to do.
@@ -484,16 +483,7 @@ static void tc_notify(struct tc_dev_s *priv)
    * all.
    */
 
-  for (i = 0; i < CONFIG_TOUCHSCREEN_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
+  poll_notify(priv->fds, CONFIG_TOUCHSCREEN_NPOLLWAITERS, POLLIN);
 
   /* If there are threads waiting for read data, then signal one of them
    * that the read data is available.
diff --git a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c
index d9e8208345..3d8f0d73da 100644
--- a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c
+++ b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c
@@ -1024,11 +1024,7 @@ static int lcd_poll(struct file *filep, struct pollfd *fds,
     {
       /* Data is always available to be read */
 
-      fds->revents |= (fds->events & (POLLIN | POLLOUT));
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   return OK;
diff --git a/drivers/analog/adc.c b/drivers/analog/adc.c
index 02b2f37d69..b4fefdfb45 100644
--- a/drivers/analog/adc.c
+++ b/drivers/analog/adc.c
@@ -496,25 +496,6 @@ static int adc_receive(FAR struct adc_dev_s *dev, uint8_t ch, int32_t data)
   return errcode;
 }
 
-/****************************************************************************
- * Name: adc_pollnotify
- ****************************************************************************/
-
-static void adc_pollnotify(FAR struct adc_dev_s *dev, uint32_t type)
-{
-  int i;
-
-  for (i = 0; i < CONFIG_ADC_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = dev->fds[i];
-      if (fds)
-        {
-          fds->revents |= type;
-          nxsem_post(fds->sem);
-        }
-    }
-}
-
 /****************************************************************************
  * Name: adc_notify
  ****************************************************************************/
@@ -527,7 +508,7 @@ static void adc_notify(FAR struct adc_dev_s *dev)
    * then wake them up now.
    */
 
-  adc_pollnotify(dev, POLLIN);
+  poll_notify(dev->fds, CONFIG_ADC_NPOLLWAITERS, POLLIN);
 
   /* If there are threads waiting for read data, then signal one of them
    * that the read data is available.
@@ -596,7 +577,7 @@ static int adc_poll(FAR struct file *filep, struct pollfd *fds, bool setup)
 
       if (dev->ad_recv.af_head != dev->ad_recv.af_tail)
         {
-          adc_pollnotify(dev, POLLIN);
+          poll_notify(dev->fds, CONFIG_ADC_NPOLLWAITERS, POLLIN);
         }
     }
   else if (fds->priv)
diff --git a/drivers/analog/comp.c b/drivers/analog/comp.c
index 74908d93aa..833fe5d2bc 100644
--- a/drivers/analog/comp.c
+++ b/drivers/analog/comp.c
@@ -80,48 +80,6 @@ static const struct comp_callback_s g_comp_callback =
  * Private Functions
  ****************************************************************************/
 
-/****************************************************************************
- * Name: comp_pollnotify
- *
- * Description:
- *   This function is called to notify any waiters of poll-reated events.
- *
- ****************************************************************************/
-
-static void comp_pollnotify(FAR struct comp_dev_s *dev,
-                            pollevent_t eventset)
-{
-  int i;
-
-  if (eventset & POLLERR)
-    {
-      eventset &= ~(POLLOUT | POLLIN);
-    }
-
-  for (i = 0; i < CONFIG_DEV_COMP_NPOLLWAITERS; i++)
-    {
-      FAR struct pollfd *fds = dev->d_fds[i];
-
-      if (fds)
-        {
-          fds->revents |= eventset & (fds->events | POLLERR | POLLHUP);
-
-          if ((fds->revents & (POLLOUT | POLLHUP)) == (POLLOUT | POLLHUP))
-            {
-              /* POLLOUT and POLLHUP are mutually exclusive. */
-
-              fds->revents &= ~POLLOUT;
-            }
-
-          if (fds->revents != 0)
-            {
-              ainfo("Report events: %08" PRIx32 "\n", fds->revents);
-              nxsem_post(fds->sem);
-            }
-        }
-    }
-}
-
 /****************************************************************************
  * Name: comp_semtake
  ****************************************************************************/
@@ -220,7 +178,7 @@ static int comp_notify(FAR struct comp_dev_s *dev, uint8_t val)
 
   dev->val = val;
 
-  comp_pollnotify(dev, POLLIN);
+  poll_notify(dev->d_fds, CONFIG_DEV_COMP_NPOLLWAITERS, POLLIN);
   nxsem_post(&dev->ad_readsem);
 
   return 0;
diff --git a/drivers/bch/bchdev_driver.c b/drivers/bch/bchdev_driver.c
index b51e73a0a2..872311fa44 100644
--- a/drivers/bch/bchdev_driver.c
+++ b/drivers/bch/bchdev_driver.c
@@ -97,11 +97,7 @@ static int bch_poll(FAR struct file *filep, FAR struct pollfd *fds,
 {
   if (setup)
     {
-      fds->revents |= (fds->events & (POLLIN | POLLOUT));
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   return OK;
diff --git a/drivers/can/can.c b/drivers/can/can.c
index 6793af58ff..052caa5fc2 100644
--- a/drivers/can/can.c
+++ b/drivers/can/can.c
@@ -100,11 +100,6 @@
 
 static int            can_takesem(FAR sem_t *sem);
 
-/* Poll helpers */
-
-static void           can_pollnotify(FAR struct can_dev_s *dev,
-                                     pollevent_t eventset);
-
 /* CAN helpers */
 
 static uint8_t        can_dlc2bytes(uint8_t dlc);
@@ -169,30 +164,6 @@ static int can_takesem(FAR sem_t *sem)
 
 #define can_givesem(sem) nxsem_post(sem)
 
-/****************************************************************************
- * Name: can_pollnotify
- ****************************************************************************/
-
-static void can_pollnotify(FAR struct can_dev_s *dev, pollevent_t eventset)
-{
-  FAR struct pollfd *fds;
-  int i;
-
-  for (i = 0; i < CONFIG_CAN_NPOLLWAITERS; i++)
-    {
-      fds = dev->cd_fds[i];
-      if (fds != NULL)
-        {
-          fds->revents |= fds->events & eventset;
-          if (fds->revents != 0)
-            {
-              caninfo("Report events: %08" PRIx32 "\n", fds->revents);
-              nxsem_post(fds->sem);
-            }
-        }
-    }
-}
-
 /****************************************************************************
  * Name: can_dlc2bytes
  *
@@ -1154,7 +1125,7 @@ static int can_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
       if (ndx != dev->cd_xmit.tx_head)
         {
-          eventset |= fds->events & POLLOUT;
+          eventset |= POLLOUT;
         }
 
       can_givesem(&dev->cd_xmit.tx_sem);
@@ -1174,7 +1145,7 @@ static int can_poll(FAR struct file *filep, FAR struct pollfd *fds,
             {
               /* No need to wait, just notify the application immediately */
 
-              eventset |= fds->events & POLLIN;
+              eventset |= POLLIN;
             }
           else
             {
@@ -1182,10 +1153,7 @@ static int can_poll(FAR struct file *filep, FAR struct pollfd *fds,
             }
         }
 
-      if (eventset != 0)
-        {
-          can_pollnotify(dev, eventset);
-        }
+      poll_notify(dev->cd_fds, CONFIG_CAN_NPOLLWAITERS, eventset);
     }
   else if (fds->priv != NULL)
     {
@@ -1401,7 +1369,7 @@ int can_receive(FAR struct can_dev_s *dev, FAR struct can_hdr_s *hdr,
            * cd_recv buffer
            */
 
-          can_pollnotify(dev, POLLIN);
+          poll_notify(dev->cd_fds, CONFIG_CAN_NPOLLWAITERS, POLLIN);
 
           sval = 0;
           if (nxsem_get_value(&fifo->rx_sem, &sval) < 0)
@@ -1546,7 +1514,7 @@ int can_txdone(FAR struct can_dev_s *dev)
        * buffer
        */
 
-      can_pollnotify(dev, POLLOUT);
+      poll_notify(dev->cd_fds, CONFIG_CAN_NPOLLWAITERS, POLLOUT);
 
       /* Are there any threads waiting for space in the TX FIFO? */
 
diff --git a/drivers/crypto/dev_urandom.c b/drivers/crypto/dev_urandom.c
index 0960399163..0137fdfaf3 100644
--- a/drivers/crypto/dev_urandom.c
+++ b/drivers/crypto/dev_urandom.c
@@ -292,11 +292,7 @@ static int devurand_poll(FAR struct file *filep, FAR struct pollfd *fds,
 {
   if (setup)
     {
-      fds->revents |= (fds->events & (POLLIN | POLLOUT));
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   return OK;
diff --git a/drivers/input/ads7843e.c b/drivers/input/ads7843e.c
index e7e204bb12..0f94ce0a89 100644
--- a/drivers/input/ads7843e.c
+++ b/drivers/input/ads7843e.c
@@ -279,24 +279,13 @@ static uint16_t ads7843e_sendcmd(FAR struct ads7843e_dev_s *priv,
 
 static void ads7843e_notify(FAR struct ads7843e_dev_s *priv)
 {
-  int i;
-
   /* If there are threads waiting on poll() for ADS7843E data to become
    * available, then wake them up now.  NOTE: we wake up all waiting threads
    * because we do not know that they are going to do.  If they all try to
    * read the data, then some make end up blocking after all.
    */
 
-  for (i = 0; i < CONFIG_ADS7843E_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
+  poll_notify(priv->fds, CONFIG_ADS7843E_NPOLLWAITERS, POLLIN);
 
   /* If there are threads waiting for read data, then signal one of them
    * that the read data is available.
diff --git a/drivers/input/ajoystick.c b/drivers/input/ajoystick.c
index a0f04597cc..ef81fd8674 100644
--- a/drivers/input/ajoystick.c
+++ b/drivers/input/ajoystick.c
@@ -223,7 +223,6 @@ static void ajoy_sample(FAR struct ajoy_upperhalf_s *priv)
   ajoy_buttonset_t press;
   ajoy_buttonset_t release;
   irqstate_t flags;
-  int i;
 
   DEBUGASSERT(priv);
   lower = priv->au_lower;
@@ -265,19 +264,8 @@ static void ajoy_sample(FAR struct ajoy_upperhalf_s *priv)
 
           /* Yes.. Notify all waiters */
 
-          for (i = 0; i < CONFIG_INPUT_AJOYSTICK_NPOLLWAITERS; i++)
-            {
-              FAR struct pollfd *fds = opriv->ao_fds[i];
-              if (fds)
-                {
-                  fds->revents |= (fds->events & POLLIN);
-                  if (fds->revents != 0)
-                    {
-                      iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-                      nxsem_post(fds->sem);
-                    }
-                }
-            }
+          poll_notify(opriv->ao_fds, CONFIG_INPUT_AJOYSTICK_NPOLLWAITERS,
+                      POLLIN);
         }
 
       /* Have any signal events occurred? */
@@ -635,12 +623,7 @@ static int ajoy_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
               if (opriv->ao_pollpending)
                 {
-                  fds->revents |= (fds->events & POLLIN);
-                  if (fds->revents != 0)
-                    {
-                      iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-                      nxsem_post(fds->sem);
-                    }
+                  poll_notify(&fds, 1, POLLIN);
                 }
 
               break;
diff --git a/drivers/input/button_upper.c b/drivers/input/button_upper.c
index 0b572e4633..10117aa2d4 100644
--- a/drivers/input/button_upper.c
+++ b/drivers/input/button_upper.c
@@ -230,7 +230,6 @@ static void btn_sample(FAR struct btn_upperhalf_s *priv)
   btn_buttonset_t change;
   btn_buttonset_t press;
   btn_buttonset_t release;
-  int i;
 
   DEBUGASSERT(priv && priv->bu_lower);
   lower = priv->bu_lower;
@@ -267,19 +266,8 @@ static void btn_sample(FAR struct btn_upperhalf_s *priv)
         {
           /* Yes.. Notify all waiters */
 
-          for (i = 0; i < CONFIG_INPUT_BUTTONS_NPOLLWAITERS; i++)
-            {
-              FAR struct pollfd *fds = opriv->bo_fds[i];
-              if (fds)
-                {
-                  fds->revents |= (fds->events & POLLIN);
-                  if (fds->revents != 0)
-                    {
-                      iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-                      nxsem_post(fds->sem);
-                    }
-                }
-            }
+          poll_notify(opriv->bo_fds, CONFIG_INPUT_BUTTONS_NPOLLWAITERS,
+                      POLLIN);
         }
 
       /* Have any signal events occurred? */
@@ -687,12 +675,7 @@ static int btn_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
               if (opriv->bo_pending)
                 {
-                  fds->revents |= (fds->events & POLLIN);
-                  if (fds->revents != 0)
-                    {
-                      iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-                      nxsem_post(fds->sem);
-                    }
+                  poll_notify(&fds, 1, POLLIN);
                 }
 
               break;
diff --git a/drivers/input/cypress_mbr3108.c b/drivers/input/cypress_mbr3108.c
index 26073fbfa7..8e803cb034 100644
--- a/drivers/input/cypress_mbr3108.c
+++ b/drivers/input/cypress_mbr3108.c
@@ -981,25 +981,6 @@ static int mbr3108_close(FAR struct file *filep)
   return 0;
 }
 
-static void mbr3108_poll_notify(FAR struct mbr3108_dev_s *priv)
-{
-  int i;
-
-  DEBUGASSERT(priv != NULL);
-
-  for (i = 0; i < CONFIG_INPUT_CYPRESS_MBR3108_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          mbr3108_dbg("Report events: %08" PRIx32 "\n", fds->revents);
-
-          fds->revents |= POLLIN;
-          nxsem_post(fds->sem);
-        }
-    }
-}
-
 static int mbr3108_poll(FAR struct file *filep, FAR struct pollfd *fds,
                         bool setup)
 {
@@ -1059,7 +1040,9 @@ static int mbr3108_poll(FAR struct file *filep, FAR struct pollfd *fds,
           pending = priv->int_pending;
           if (pending)
             {
-              mbr3108_poll_notify(priv);
+              poll_notify(priv->fds,
+                          CONFIG_INPUT_CYPRESS_MBR3108_NPOLLWAITERS,
+                          POLLIN);
             }
         }
     }
@@ -1092,7 +1075,7 @@ static int mbr3108_isr_handler(int irq, FAR void *context, FAR void *arg)
   priv->int_pending = true;
   leave_critical_section(flags);
 
-  mbr3108_poll_notify(priv);
+  poll_notify(priv->fds, CONFIG_INPUT_CYPRESS_MBR3108_NPOLLWAITERS, POLLIN);
   return 0;
 }
 
diff --git a/drivers/input/djoystick.c b/drivers/input/djoystick.c
index a62a411016..d2ba83a841 100644
--- a/drivers/input/djoystick.c
+++ b/drivers/input/djoystick.c
@@ -223,7 +223,6 @@ static void djoy_sample(FAR struct djoy_upperhalf_s *priv)
   djoy_buttonset_t press;
   djoy_buttonset_t release;
   irqstate_t flags;
-  int i;
 
   DEBUGASSERT(priv);
   lower = priv->du_lower;
@@ -265,19 +264,8 @@ static void djoy_sample(FAR struct djoy_upperhalf_s *priv)
 
           /* Yes.. Notify all waiters */
 
-          for (i = 0; i < CONFIG_INPUT_DJOYSTICK_NPOLLWAITERS; i++)
-            {
-              FAR struct pollfd *fds = opriv->do_fds[i];
-              if (fds)
-                {
-                  fds->revents |= (fds->events & POLLIN);
-                  if (fds->revents != 0)
-                    {
-                      iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-                      nxsem_post(fds->sem);
-                    }
-                }
-            }
+          poll_notify(opriv->do_fds, CONFIG_INPUT_DJOYSTICK_NPOLLWAITERS,
+                      POLLIN);
         }
 
       /* Have any signal events occurred? */
@@ -629,12 +617,7 @@ static int djoy_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
               if (opriv->do_pollpending)
                 {
-                  fds->revents |= (fds->events & POLLIN);
-                  if (fds->revents != 0)
-                    {
-                      iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-                      nxsem_post(fds->sem);
-                    }
+                  poll_notify(&fds, 1, POLLIN);
                 }
 
               break;
diff --git a/drivers/input/ft5x06.c b/drivers/input/ft5x06.c
index f278bc3f9c..b1c10ce3cd 100644
--- a/drivers/input/ft5x06.c
+++ b/drivers/input/ft5x06.c
@@ -201,24 +201,13 @@ static const uint8_t g_event_map[4] =
 
 static void ft5x06_notify(FAR struct ft5x06_dev_s *priv)
 {
-  int i;
-
   /* If there are threads waiting on poll() for FT5x06 data to become
    * available, then wake them up now.  NOTE: we wake up all waiting threads
    * because we do not know that they are going to do.  If they all try to
    * read the data, then some make end up blocking after all.
    */
 
-  for (i = 0; i < CONFIG_FT5X06_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
+  poll_notify(priv->fds, CONFIG_FT5X06_NPOLLWAITERS, POLLIN);
 
   /* If there are threads waiting for read data, then signal one of them
    * that the read data is available.
diff --git a/drivers/input/keyboard_upper.c b/drivers/input/keyboard_upper.c
index 2ff5d2b3d6..762d028de9 100644
--- a/drivers/input/keyboard_upper.c
+++ b/drivers/input/keyboard_upper.c
@@ -75,7 +75,6 @@ static ssize_t keyboard_write(FAR struct file *filep, FAR const char *buffer,
                               size_t len);
 static int     keyboard_poll(FAR struct file *filep, FAR struct pollfd *fds,
                              bool setup);
-static void    keyboard_notify(FAR struct keyboard_opriv_s *buffer);
 
 /****************************************************************************
  * Private Data
@@ -99,30 +98,6 @@ static const struct file_operations g_keyboard_fops =
  * Private Functions
  ****************************************************************************/
 
-/****************************************************************************
- * Name: keyboard_notify
- ****************************************************************************/
-
-static void keyboard_notify(FAR struct keyboard_opriv_s *opriv)
-{
-  FAR struct pollfd *fds = opriv->fds;
-  if (fds != NULL)
-    {
-      fds->revents |= (fds->events & POLLIN);
-      if (fds->revents != 0)
-        {
-          /* report event log */
-
-          int semcount;
-          nxsem_get_value(fds->sem, &semcount);
-          if (semcount < 1)
-            {
-              nxsem_post(fds->sem);
-            }
-        }
-    }
-}
-
 /****************************************************************************
  * Name: keyboard_open
  ****************************************************************************/
@@ -301,7 +276,7 @@ static int keyboard_poll(FAR struct file *filep,
 
       if (!circbuf_is_empty(&opriv->circ))
         {
-          keyboard_notify(opriv);
+          poll_notify(&opriv->fds, 1, POLLIN);
         }
     }
   else
@@ -437,7 +412,7 @@ void keyboard_event(FAR struct keyboard_lowerhalf_s *lower, uint32_t keycode,
               nxsem_post(&opriv->waitsem);
             }
 
-          keyboard_notify(opriv);
+          poll_notify(&opriv->fds, 1, POLLIN);
           nxsem_post(&opriv->locksem);
         }
     }
diff --git a/drivers/input/max11802.c b/drivers/input/max11802.c
index 53fa899ba5..1d40432d8c 100644
--- a/drivers/input/max11802.c
+++ b/drivers/input/max11802.c
@@ -236,24 +236,13 @@ static uint16_t max11802_sendcmd(FAR struct max11802_dev_s *priv,
 
 static void max11802_notify(FAR struct max11802_dev_s *priv)
 {
-  int i;
-
   /* If there are threads waiting on poll() for MAX11802 data to become
    * available, then wake them up now.  NOTE: we wake up all waiting
    * threads because we do not know that they are going to do.  If they
    * all try to read the data, then some make end up blocking after all.
    */
 
-  for (i = 0; i < CONFIG_MAX11802_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
+  poll_notify(priv->fds, CONFIG_MAX11802_NPOLLWAITERS, POLLIN);
 
   /* If there are threads waiting for read data, then signal one of them
    * that the read data is available.
diff --git a/drivers/input/mxt.c b/drivers/input/mxt.c
index d26721e0e5..76d2629a90 100644
--- a/drivers/input/mxt.c
+++ b/drivers/input/mxt.c
@@ -584,24 +584,13 @@ static int mxt_flushmsgs(FAR struct mxt_dev_s *priv)
 
 static void mxt_notify(FAR struct mxt_dev_s *priv)
 {
-  int i;
-
   /* If there are threads waiting on poll() for maXTouch data to become
    * available, then wake them up now.  NOTE: we wake up all waiting threads
    * because we do not know that they are going to do.  If they all try to
    * read the data, then some make end up blocking after all.
    */
 
-  for (i = 0; i < CONFIG_MXT_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
+  poll_notify(priv->fds, CONFIG_MXT_NPOLLWAITERS, POLLIN);
 
   /* If there are threads waiting for read data, then signal one of them
    * that the read data is available.
diff --git a/drivers/input/spq10kbd.c b/drivers/input/spq10kbd.c
index cbde80cd70..e491c50de8 100644
--- a/drivers/input/spq10kbd.c
+++ b/drivers/input/spq10kbd.c
@@ -440,29 +440,6 @@ static int spq10kbd_interrupt(int irq, FAR void *context, FAR void *arg)
   return OK;
 }
 
-/****************************************************************************
- * Name: spq10kbd_pollnotify
- ****************************************************************************/
-
-static void spq10kbd_pollnotify(FAR struct spq10kbd_dev_s *priv)
-{
-  int i;
-
-  for (i = 0; i < CONFIG_SPQ10KBD_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= (fds->events & POLLIN);
-          if (fds->revents != 0)
-            {
-              uinfo("Report events: %08" PRIx32 "\n", fds->revents);
-              nxsem_post(fds->sem);
-            }
-        }
-    }
-}
-
 /****************************************************************************
  * Name: spq10kbd_open
  *
@@ -676,7 +653,7 @@ static int spq10kbd_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
       if (priv->headndx != priv->tailndx)
         {
-          spq10kbd_pollnotify(priv);
+          poll_notify(priv->fds, CONFIG_SPQ10KBD_NPOLLWAITERS, POLLIN);
         }
     }
   else
diff --git a/drivers/input/stmpe811_tsc.c b/drivers/input/stmpe811_tsc.c
index ec68333632..3baaa16212 100644
--- a/drivers/input/stmpe811_tsc.c
+++ b/drivers/input/stmpe811_tsc.c
@@ -145,24 +145,13 @@ static const struct file_operations g_stmpe811fops =
 
 static void stmpe811_notify(FAR struct stmpe811_dev_s *priv)
 {
-  int i;
-
   /* If there are threads waiting on poll() for STMPE811 data to become
    * available, then wake them up now.  NOTE: we wake up all waiting threads
    * because we do not know that they are going to do.  If they all try to
    * read the data, then some make end up blocking after all.
    */
 
-  for (i = 0; i < CONFIG_STMPE811_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
+  poll_notify(priv->fds, CONFIG_STMPE811_NPOLLWAITERS, POLLIN);
 
   /* If there are threads waiting for read data, then signal one of them
    * that the read data is available.
diff --git a/drivers/input/touchscreen_upper.c b/drivers/input/touchscreen_upper.c
index 6740d24ac6..ae1ed01c95 100644
--- a/drivers/input/touchscreen_upper.c
+++ b/drivers/input/touchscreen_upper.c
@@ -66,8 +66,6 @@ struct touch_upperhalf_s
  * Private Function Prototypes
  ****************************************************************************/
 
-static void    touch_notify(FAR struct touch_openpriv_s *openpriv,
-                            pollevent_t eventset);
 static int     touch_open(FAR struct file *filep);
 static int     touch_close(FAR struct file *filep);
 static ssize_t touch_read(FAR struct file *filep, FAR char *buffer,
@@ -101,29 +99,6 @@ static const struct file_operations g_touch_fops =
  * Private Functions
  ****************************************************************************/
 
-static void touch_notify(FAR struct touch_openpriv_s *openpriv,
-                         pollevent_t eventset)
-{
-  FAR struct pollfd *fd = openpriv->fds;
-
-  fd = openpriv->fds;
-  if (fd)
-    {
-      fd->revents |= (fd->events & eventset);
-      if (fd->revents != 0)
-        {
-          /* report event log */
-
-          int semcount;
-          nxsem_get_value(fd->sem, &semcount);
-          if (semcount < 1)
-            {
-              nxsem_post(fd->sem);
-            }
-        }
-    }
-}
-
 /****************************************************************************
  * Name: touch_open
  ****************************************************************************/
@@ -323,13 +298,10 @@ static int touch_poll(FAR struct file *filep, struct pollfd *fds, bool setup)
 
       if (!circbuf_is_empty(&openpriv->circbuf))
         {
-          eventset |= (fds->events & POLLIN);
+          eventset |= POLLIN;
         }
 
-      if (eventset)
-        {
-          touch_notify(openpriv, POLLIN);
-        }
+      poll_notify(&openpriv->fds, 1, eventset);
     }
   else if (fds->priv)
     {
@@ -368,7 +340,7 @@ void touch_event(FAR void *priv, FAR const struct touch_sample_s *sample)
           nxsem_post(&openpriv->waitsem);
         }
 
-      touch_notify(openpriv, POLLIN);
+      poll_notify(&openpriv->fds, 1, POLLIN);
     }
 
   nxsem_post(&upper->exclsem);
diff --git a/drivers/input/tsc2007.c b/drivers/input/tsc2007.c
index 8ca4c8a3a1..eefccda8e5 100644
--- a/drivers/input/tsc2007.c
+++ b/drivers/input/tsc2007.c
@@ -237,24 +237,13 @@ static struct tsc2007_dev_s *g_tsc2007list;
 
 static void tsc2007_notify(FAR struct tsc2007_dev_s *priv)
 {
-  int i;
-
   /* If there are threads waiting on poll() for TSC2007 data to become
    * available, then wake them up now.  NOTE: we wake up all waiting
    * threads because we do not know that they are going to do.  If they
    * all try to read the data, then some make end up blocking after all.
    */
 
-  for (i = 0; i < CONFIG_TSC2007_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
+  poll_notify(priv->fds, CONFIG_TSC2007_NPOLLWAITERS, POLLIN);
 
   /* If there are threads waiting for read data, then signal one of them
    * that the read data is available.
diff --git a/drivers/ipcc/ipcc_poll.c b/drivers/ipcc/ipcc_poll.c
index ccea384e78..aa986121de 100644
--- a/drivers/ipcc/ipcc_poll.c
+++ b/drivers/ipcc/ipcc_poll.c
@@ -136,71 +136,17 @@ int ipcc_poll(FAR struct file *filep, FAR struct pollfd *fds,
 #ifdef CONFIG_IPCC_BUFFERED
   if (circbuf_used(&priv->ipcc->rxbuf) > 0)
     {
-      eventset |= (fds->events & POLLIN);
+      eventset |= POLLIN;
     }
 
   if (circbuf_space(&priv->ipcc->txbuf) > 0)
     {
-      eventset |= (fds->events & POLLOUT);
+      eventset |= POLLOUT;
     }
 #endif
 
-  if (eventset)
-    {
-      ipcc_pollnotify(priv, eventset);
-    }
+  poll_notify(priv->fds, CONFIG_IPCC_NPOLLWAITERS, eventset);
 
   nxsem_post(&priv->exclsem);
   return OK;
 }
-
-/****************************************************************************
- * Name: ipcc_pollnotify
- *
- * Description:
- *   Wakes up all sleeping threads waiting for event associated with ipcc
- *   driver.
- *
- * Input Parameters:
- *   ipcc - driver instance to check for poll events
- *   eventset - list of events to check for activity
- *
- * Returned Value:
- *   None
- *
- * Assumptions/Limitations:
- *   This function may be called from interrupt handler.
- *
- ****************************************************************************/
-
-void ipcc_pollnotify(FAR struct ipcc_driver_s *priv, pollevent_t eventset)
-{
-  struct pollfd *fds;
-  int semcount;
-  int i;
-
-  for (i = 0; i < CONFIG_IPCC_NPOLLWAITERS; i++)
-    {
-      if ((fds = priv->fds[i]) == NULL)
-        {
-          /* Slot empty, move to next one */
-
-          continue;
-        }
-
-      if ((fds->revents |= fds->events & eventset) == 0)
-        {
-          /* No event */
-
-          continue;
-        }
-
-      finfo("Report events: %08" PRIx32 "\n", fds->revents);
-
-      nxsem_get_value(fds->sem, &semcount);
-      if (semcount < 1)
-        {
-          nxsem_post(fds->sem);
-        }
-    }
-}
diff --git a/drivers/lcd/pcf8574_lcd_backpack.c b/drivers/lcd/pcf8574_lcd_backpack.c
index ce589f428b..346195ce7c 100644
--- a/drivers/lcd/pcf8574_lcd_backpack.c
+++ b/drivers/lcd/pcf8574_lcd_backpack.c
@@ -1558,11 +1558,7 @@ static int pcf8574_lcd_poll(FAR struct file *filep, FAR struct pollfd *fds,
     {
       /* Data is always available to be read */
 
-      fds->revents |= (fds->events & (POLLIN | POLLOUT));
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   return OK;
diff --git a/drivers/lcd/tda19988.c b/drivers/lcd/tda19988.c
index 4b362a455e..462305f373 100644
--- a/drivers/lcd/tda19988.c
+++ b/drivers/lcd/tda19988.c
@@ -1180,11 +1180,7 @@ static int tda19988_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
   if (setup)
     {
-      fds->revents |= (fds->events & (POLLIN | POLLOUT));
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   nxsem_post(&priv->exclsem);
diff --git a/drivers/misc/dev_null.c b/drivers/misc/dev_null.c
index 8e7c5e90d7..da6fc34863 100644
--- a/drivers/misc/dev_null.c
+++ b/drivers/misc/dev_null.c
@@ -105,11 +105,7 @@ static int devnull_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
   if (setup)
     {
-      fds->revents |= (fds->events & (POLLIN | POLLOUT));
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   return OK;
diff --git a/drivers/misc/dev_zero.c b/drivers/misc/dev_zero.c
index 882fb60a5f..097e79d1c5 100644
--- a/drivers/misc/dev_zero.c
+++ b/drivers/misc/dev_zero.c
@@ -104,11 +104,7 @@ static int devzero_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
   if (setup)
     {
-      fds->revents |= (fds->events & (POLLIN | POLLOUT));
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   return OK;
diff --git a/drivers/modem/u-blox.c b/drivers/modem/u-blox.c
index ecb8df0b80..b858a4a072 100644
--- a/drivers/modem/u-blox.c
+++ b/drivers/modem/u-blox.c
@@ -260,11 +260,7 @@ static int ubxmdm_poll(FAR struct file * filep,
 {
   if (setup)
     {
-      fds->revents |= (fds->events & (POLLIN | POLLOUT));
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   return OK;
diff --git a/drivers/mtd/mtd_config.c b/drivers/mtd/mtd_config.c
index ade51d77f2..f4d02abc51 100644
--- a/drivers/mtd/mtd_config.c
+++ b/drivers/mtd/mtd_config.c
@@ -1713,11 +1713,7 @@ static int mtdconfig_poll(FAR struct file *filep, FAR struct pollfd *fds,
 {
   if (setup)
     {
-      fds->revents |= (fds->events & (POLLIN | POLLOUT));
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   return OK;
diff --git a/drivers/mtd/mtd_config_fs.c b/drivers/mtd/mtd_config_fs.c
index 1a1e066543..ccfeb250a5 100644
--- a/drivers/mtd/mtd_config_fs.c
+++ b/drivers/mtd/mtd_config_fs.c
@@ -1985,11 +1985,7 @@ static int mtdconfig_poll(FAR struct file *filep, FAR struct pollfd *fds,
 {
   if (setup)
     {
-      fds->revents |= fds->events & (POLLIN | POLLOUT);
-      if (fds->revents != 0)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLIN | POLLOUT);
     }
 
   return OK;
diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c
index 5b7dec309d..5a283b2e91 100644
--- a/drivers/net/telnet.c
+++ b/drivers/net/telnet.c
@@ -1247,11 +1247,7 @@ static int telnet_poll(FAR struct file *filep, FAR struct pollfd *fds,
     {
       /* Yes.. then signal the poll logic */
 
-      fds->revents |= (POLLRDNORM & fds->events);
-      if (fds->revents)
-        {
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, POLLRDNORM);
     }
 
   /* Then let psock_poll() do the heavy lifting */
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 6e54c11760..967305e26d 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -295,13 +295,7 @@ static void tun_pollnotify(FAR struct tun_device_s *priv,
       return;
     }
 
-  eventset &= fds->events;
-
-  if (eventset != 0)
-    {
-      fds->revents |= eventset;
-      nxsem_post(fds->sem);
-    }
+  poll_notify(&fds, 1, eventset);
 }
 
 /****************************************************************************
@@ -1261,7 +1255,7 @@ int tun_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
 
       if (priv->write_d_len == 0)
         {
-          eventset |= (fds->events & POLLOUT);
+          eventset |= POLLOUT;
         }
 
       /* The write buffer sometimes could be used for TX.
@@ -1270,13 +1264,10 @@ int tun_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
 
       if (priv->read_d_len != 0 || priv->write_d_len != 0)
         {
-          eventset |= (fds->events & POLLIN);
+          eventset |= POLLIN;
         }
 
-      if (eventset)
-        {
-          tun_pollnotify(priv, eventset);
-        }
+      tun_pollnotify(priv, eventset);
     }
   else
     {
diff --git a/drivers/pipes/pipe_common.c b/drivers/pipes/pipe_common.c
index 9974dc3723..24350af1fa 100644
--- a/drivers/pipes/pipe_common.c
+++ b/drivers/pipes/pipe_common.c
@@ -73,44 +73,6 @@ static int pipecommon_semtake(FAR sem_t *sem)
   return nxsem_wait_uninterruptible(sem);
 }
 
-/****************************************************************************
- * Name: pipecommon_pollnotify
- ****************************************************************************/
-
-static void pipecommon_pollnotify(FAR struct pipe_dev_s *dev,
-                                  pollevent_t eventset)
-{
-  int i;
-
-  if (eventset & POLLERR)
-    {
-      eventset &= ~(POLLOUT | POLLIN);
-    }
-
-  for (i = 0; i < CONFIG_DEV_PIPE_NPOLLWAITERS; i++)
-    {
-      FAR struct pollfd *fds = dev->d_fds[i];
-
-      if (fds)
-        {
-          fds->revents |= eventset & (fds->events | POLLERR | POLLHUP);
-
-          if ((fds->revents & (POLLOUT | POLLHUP)) == (POLLOUT | POLLHUP))
-            {
-              /* POLLOUT and POLLHUP are mutually exclusive. */
-
-              fds->revents &= ~POLLOUT;
-            }
-
-          if (fds->revents != 0)
-            {
-              finfo("Report events: %08" PRIx32 "\n", fds->revents);
-              nxsem_post(fds->sem);
-            }
-        }
-    }
-}
-
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -321,7 +283,7 @@ int pipecommon_close(FAR struct file *filep)
             {
               /* Inform poll readers that other end closed. */
 
-              pipecommon_pollnotify(dev, POLLHUP);
+              poll_notify(dev->d_fds, CONFIG_DEV_PIPE_NPOLLWAITERS, POLLHUP);
 
               while (nxsem_get_value(&dev->d_rdsem, &sval) == 0 && sval <= 0)
                 {
@@ -342,7 +304,8 @@ int pipecommon_close(FAR struct file *filep)
                 {
                   /* Inform poll writers that other end closed. */
 
-                  pipecommon_pollnotify(dev, POLLERR);
+                  poll_notify(dev->d_fds, CONFIG_DEV_PIPE_NPOLLWAITERS,
+                              POLLERR);
                   while (nxsem_get_value(&dev->d_wrsem, &sval) == 0
                          && sval <= 0)
                     {
@@ -477,7 +440,7 @@ ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len)
 
   /* Notify all poll/select waiters that they can write to the FIFO */
 
-  pipecommon_pollnotify(dev, POLLOUT);
+  poll_notify(dev->d_fds, CONFIG_DEV_PIPE_NPOLLWAITERS, POLLOUT);
 
   /* Notify all waiting writers that bytes have been removed from the
    * buffer.
@@ -588,7 +551,7 @@ ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer,
                * FIFO.
                */
 
-              pipecommon_pollnotify(dev, POLLIN);
+              poll_notify(dev->d_fds, CONFIG_DEV_PIPE_NPOLLWAITERS, POLLIN);
 
               /* Yes.. Notify all of the waiting readers that more data is
                * available.
@@ -617,7 +580,7 @@ ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer,
                * FIFO.
                */
 
-              pipecommon_pollnotify(dev, POLLIN);
+              poll_notify(dev->d_fds, CONFIG_DEV_PIPE_NPOLLWAITERS, POLLIN);
 
               /* Yes.. Notify all of the waiting readers that more data is
                * available.
@@ -761,10 +724,7 @@ int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds,
           eventset |= POLLERR;
         }
 
-      if (eventset)
-        {
-          pipecommon_pollnotify(dev, eventset);
-        }
+      poll_notify(dev->d_fds, CONFIG_DEV_PIPE_NPOLLWAITERS, eventset);
     }
   else
     {
diff --git a/drivers/power/battery/battery_charger.c b/drivers/power/battery/battery_charger.c
index 5aa74c435c..4e4c8769f1 100644
--- a/drivers/power/battery/battery_charger.c
+++ b/drivers/power/battery/battery_charger.c
@@ -122,12 +122,7 @@ static int battery_charger_notify(FAR struct battery_charger_priv_s *priv,
   priv->mask |= mask;
   if (priv->mask)
     {
-      fd->revents |= POLLIN;
-      nxsem_get_value(fd->sem, &semcnt);
-      if (semcnt < 1)
-        {
-          nxsem_post(fd->sem);
-        }
+      poll_notify(&fd, 1, POLLIN);
 
       nxsem_get_value(&priv->wait, &semcnt);
       if (semcnt < 1)
diff --git a/drivers/power/battery/battery_gauge.c b/drivers/power/battery/battery_gauge.c
index bf93c2422b..17d79f5704 100644
--- a/drivers/power/battery/battery_gauge.c
+++ b/drivers/power/battery/battery_gauge.c
@@ -124,12 +124,7 @@ static int battery_gauge_notify(FAR struct battery_gauge_priv_s *priv,
   priv->mask |= mask;
   if (priv->mask)
     {
-      fd->revents |= POLLIN;
-      nxsem_get_value(fd->sem, &semcnt);
-      if (semcnt < 1)
-        {
-          nxsem_post(fd->sem);
-        }
+      poll_notify(&fd, 1, POLLIN);
 
       nxsem_get_value(&priv->wait, &semcnt);
       if (semcnt < 1)
diff --git a/drivers/power/battery/battery_monitor.c b/drivers/power/battery/battery_monitor.c
index b277e753b5..235faec335 100644
--- a/drivers/power/battery/battery_monitor.c
+++ b/drivers/power/battery/battery_monitor.c
@@ -123,12 +123,7 @@ static int battery_monitor_notify(FAR struct battery_monitor_priv_s *priv,
   priv->mask |= mask;
   if (priv->mask)
     {
-      fd->revents |= POLLIN;
-      nxsem_get_value(fd->sem, &semcnt);
-      if (semcnt < 1)
-        {
-          nxsem_post(fd->sem);
-        }
+      poll_notify(&fd, 1, POLLIN);
 
       nxsem_get_value(&priv->wait, &semcnt);
       if (semcnt < 1)
diff --git a/drivers/rc/lirc_dev.c b/drivers/rc/lirc_dev.c
index cff75262c7..793b8f2048 100644
--- a/drivers/rc/lirc_dev.c
+++ b/drivers/rc/lirc_dev.c
@@ -80,7 +80,6 @@ struct lirc_fh_s
  * Private Function Prototypes
  ****************************************************************************/
 
-static void lirc_pollnotify(FAR struct lirc_fh_s *fh, pollevent_t eventset);
 static int lirc_open(FAR struct file *filep);
 static int lirc_close(FAR struct file *filep);
 static int lirc_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
@@ -113,28 +112,6 @@ static const struct file_operations g_lirc_fops =
  * Private Functions
  ****************************************************************************/
 
-static void lirc_pollnotify(FAR struct lirc_fh_s *fh,
-                            pollevent_t eventset)
-{
-  int semcount;
-
-  if (fh->fd)
-    {
-      fh->fd->revents |= (fh->fd->events & eventset);
-
-      if (fh->fd->revents != 0)
-        {
-          rcinfo("Report events: %08" PRIx32 "\n", fh->fd->revents);
-
-          nxsem_get_value(fh->fd->sem, &semcount);
-          if (semcount < 1)
-            {
-              nxsem_post(fh->fd->sem);
-            }
-        }
-    }
-}
-
 static int lirc_open(FAR struct file *filep)
 {
   FAR struct inode *inode = filep->f_inode;
@@ -251,13 +228,10 @@ static int lirc_poll(FAR struct file *filep,
 
       if (!circbuf_is_empty(&fh->buffer))
         {
-          eventset = (fds->events & (POLLIN | POLLRDNORM));
+          eventset |= POLLIN | POLLRDNORM;
         }
 
-      if (eventset)
-        {
-          lirc_pollnotify(fh, eventset);
-        }
+      poll_notify(&fh->fd, 1, eventset);
     }
   else if (fds->priv != NULL)
     {
@@ -941,7 +915,7 @@ void lirc_raw_event(FAR struct lirc_lowerhalf_s *lower,
               fh = (FAR struct lirc_fh_s *)node;
               if (circbuf_write(&fh->buffer, &gap, sizeof(int)) > 0)
                 {
-                  lirc_pollnotify(fh, POLLIN | POLLRDNORM);
+                  poll_notify(&fh->fd, 1, POLLIN | POLLRDNORM);
                   nxsem_get_value(&fh->waitsem, &semcount);
                   if (semcount < 1)
                     {
@@ -971,7 +945,7 @@ void lirc_raw_event(FAR struct lirc_lowerhalf_s *lower,
 
       if (circbuf_write(&fh->buffer, &sample, sizeof(unsigned int)) > 0)
         {
-          lirc_pollnotify(fh, POLLIN | POLLRDNORM);
+          poll_notify(&fh->fd, 1, POLLIN | POLLRDNORM);
           nxsem_get_value(&fh->waitsem, &semcount);
           if (semcount < 1)
             {
@@ -1015,7 +989,7 @@ void lirc_scancode_event(FAR struct lirc_lowerhalf_s *lower,
       fh = (FAR struct lirc_fh_s *)node;
       if (circbuf_write(&fh->buffer, lsc, sizeof(*lsc)) > 0)
         {
-          lirc_pollnotify(fh, POLLIN | POLLRDNORM);
+          poll_notify(&fh->fd, 1, POLLIN | POLLRDNORM);
           nxsem_get_value(&fh->waitsem, &semcount);
           if (semcount < 1)
             {
@@ -1061,7 +1035,7 @@ void lirc_sample_event(FAR struct lirc_lowerhalf_s *lower,
       fh = (FAR struct lirc_fh_s *)node;
       if (circbuf_write(&fh->buffer, &sample, sizeof(unsigned int)) > 0)
         {
-          lirc_pollnotify(fh, POLLIN | POLLRDNORM);
+          poll_notify(&fh->fd, 1, POLLIN | POLLRDNORM);
           nxsem_get_value(&fh->waitsem, &semcount);
           if (semcount < 1)
             {
diff --git a/drivers/sensors/hc_sr04.c b/drivers/sensors/hc_sr04.c
index 49313a86bc..413adf18f3 100644
--- a/drivers/sensors/hc_sr04.c
+++ b/drivers/sensors/hc_sr04.c
@@ -271,30 +271,6 @@ static bool hcsr04_sample(FAR struct hcsr04_dev_s *priv)
   return (done == 0);
 }
 
-static void hcsr04_notify(FAR struct hcsr04_dev_s *priv)
-{
-  DEBUGASSERT(priv != NULL);
-
-  int i;
-
-  /* If there are threads waiting on poll() for data to become available,
-   * then wake them up now.  NOTE: we wake up all waiting threads because we
-   * do not know that they are going to do.  If they all try to read the
-   * data, then some make end up blocking after all.
-   */
-
-  for (i = 0; i < CONFIG_HCSR04_NPOLLWAITERS; i++)
-    {
-      FAR struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          hcsr04_dbg("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
-}
-
 static int hcsr04_poll(FAR struct file *filep, FAR struct pollfd *fds,
                        bool setup)
 {
@@ -356,7 +332,7 @@ static int hcsr04_poll(FAR struct file *filep, FAR struct pollfd *fds,
       flags = enter_critical_section();
       if (hcsr04_sample(priv))
         {
-          hcsr04_notify(priv);
+          poll_notify(priv->fds, CONFIG_HCSR04_NPOLLWAITERS, POLLIN);
         }
 
       leave_critical_section(flags);
@@ -415,7 +391,7 @@ static int hcsr04_int_handler(int irq, FAR void *context, FAR void *arg)
     }
 
   hcsr04_dbg("HC-SR04 interrupt\n");
-  hcsr04_notify(priv);
+  poll_notify(priv->fds, CONFIG_HCSR04_NPOLLWAITERS, POLLIN);
 
   return OK;
 }
diff --git a/drivers/sensors/hts221.c b/drivers/sensors/hts221.c
index d22c9aa5cf..7547ab3ba1 100644
--- a/drivers/sensors/hts221.c
+++ b/drivers/sensors/hts221.c
@@ -1054,30 +1054,6 @@ static bool hts221_sample(FAR struct hts221_dev_s *priv)
   return status.is_humid_ready || status.is_temp_ready;
 }
 
-static void hts221_notify(FAR struct hts221_dev_s *priv)
-{
-  DEBUGASSERT(priv != NULL);
-
-  int i;
-
-  /* If there are threads waiting on poll() for data to become available,
-   * then wake them up now.  NOTE: we wake up all waiting threads because we
-   * do not know that they are going to do.  If they all try to read the
-   * data, then some make end up blocking after all.
-   */
-
-  for (i = 0; i < CONFIG_HTS221_NPOLLWAITERS; i++)
-    {
-      FAR struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          hts221_dbg("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
-}
-
 static int hts221_poll(FAR struct file *filep, FAR struct pollfd *fds,
                        bool setup)
 {
@@ -1139,7 +1115,7 @@ static int hts221_poll(FAR struct file *filep, FAR struct pollfd *fds,
       flags = enter_critical_section();
       if (priv->int_pending || hts221_sample(priv))
         {
-          hts221_notify(priv);
+          poll_notify(priv->fds, CONFIG_HTS221_NPOLLWAITERS, POLLIN);
         }
 
       leave_critical_section(flags);
@@ -1170,7 +1146,7 @@ static int hts221_int_handler(int irq, FAR void *context, FAR void *arg)
 
   priv->int_pending = true;
   hts221_dbg("Hts221 interrupt\n");
-  hts221_notify(priv);
+  poll_notify(priv->fds, CONFIG_HTS221_NPOLLWAITERS, POLLIN);
 
   return OK;
 }
diff --git a/drivers/sensors/lis2dh.c b/drivers/sensors/lis2dh.c
index fd10b9536e..4147e805d3 100644
--- a/drivers/sensors/lis2dh.c
+++ b/drivers/sensors/lis2dh.c
@@ -118,7 +118,6 @@ static int            lis2dh_powerdown(FAR struct lis2dh_dev_s *dev);
 static int            lis2dh_reboot(FAR struct lis2dh_dev_s *dev);
 static int            lis2dh_poll(FAR struct file *filep,
                         FAR struct pollfd *fds, bool setup);
-static void           lis2dh_notify(FAR struct lis2dh_dev_s *priv);
 static int            lis2dh_int_handler(int irq, FAR void *context,
                         FAR void *arg);
 static int            lis2dh_setup(FAR struct lis2dh_dev_s *dev,
@@ -439,7 +438,7 @@ static ssize_t lis2dh_read(FAR struct file *filep, FAR char *buffer,
           priv->int_pending = true;
 #endif
 
-          lis2dh_notify(priv);
+          poll_notify(priv->fds, CONFIG_LIS2DH_NPOLLWAITERS, POLLIN);
           leave_critical_section(flags);
         }
       else if (fifo_mode != LIS2DH_STREAM_MODE && priv->fifo_stopped)
@@ -715,7 +714,7 @@ static int lis2dh_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
       if (priv->int_pending)
         {
-          lis2dh_notify(priv);
+          poll_notify(priv->fds, CONFIG_LIS2DH_NPOLLWAITERS, POLLIN);
         }
     }
   else if (fds->priv)
@@ -736,30 +735,6 @@ out:
   return ret;
 }
 
-static void lis2dh_notify(FAR struct lis2dh_dev_s *priv)
-{
-  DEBUGASSERT(priv != NULL);
-
-  int i;
-
-  /* If there are threads waiting on poll() for LIS2DH data to become
-   * available, then wake them up now.  NOTE: we wake up all waiting threads
-   * because we do not know that they are going to do.  If they all try to
-   * read the data, then some make end up blocking after all.
-   */
-
-  for (i = 0; i < CONFIG_LIS2DH_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          lis2dh_dbg("lis2dh: Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
-}
-
 /****************************************************************************
  * Name: lis2dh_callback
  *
@@ -783,7 +758,7 @@ static int lis2dh_int_handler(int irq, FAR void *context, FAR void *arg)
   priv->int_pending = true;
 #endif
 
-  lis2dh_notify(priv);
+  poll_notify(priv->fds, CONFIG_LIS2DH_NPOLLWAITERS, POLLIN);
   leave_critical_section(flags);
 
   return OK;
diff --git a/drivers/sensors/max44009.c b/drivers/sensors/max44009.c
index fdb7babddf..1358fdee4e 100644
--- a/drivers/sensors/max44009.c
+++ b/drivers/sensors/max44009.c
@@ -769,9 +769,7 @@ static void max44009_notify(FAR struct max44009_dev_s *priv)
       FAR struct pollfd *fds = priv->fds[i];
       if (fds)
         {
-          fds->revents |= POLLIN;
-          max44009_dbg("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
+          poll_notify(&fds, 1, POLLIN);
           priv->int_pending = false;
         }
     }
diff --git a/drivers/sensors/sensor.c b/drivers/sensors/sensor.c
index fde9cf619d..c0c55e6260 100644
--- a/drivers/sensors/sensor.c
+++ b/drivers/sensors/sensor.c
@@ -488,28 +488,12 @@ static ssize_t sensor_do_samples(FAR struct sensor_upperhalf_s *upper,
 static void sensor_pollnotify_one(FAR struct sensor_user_s *user,
                                   pollevent_t eventset)
 {
-  int semcount;
-
   if (eventset == POLLPRI)
     {
       user->changed = true;
     }
 
-  if (!user->fds)
-    {
-      return;
-    }
-
-  user->fds->revents |= (user->fds->events & eventset);
-  if (user->fds->revents != 0)
-    {
-      sninfo("Report events: %08" PRIx32 "\n", user->fds->revents);
-      nxsem_get_value(user->fds->sem, &semcount);
-      if (semcount < 1)
-        {
-          nxsem_post(user->fds->sem);
-        }
-    }
+  poll_notify(&user->fds, 1, eventset);
 }
 
 static void sensor_pollnotify(FAR struct sensor_upperhalf_s *upper,
@@ -899,31 +883,28 @@ static int sensor_poll(FAR struct file *filep,
 
           if (filep->f_oflags & O_NONBLOCK)
             {
-              eventset |= (fds->events & POLLIN);
+              eventset |= POLLIN;
             }
           else
             {
               nxsem_get_value(&user->buffersem, &semcount);
               if (semcount > 0)
                 {
-                  eventset |= (fds->events & POLLIN);
+                  eventset |= POLLIN;
                 }
             }
         }
       else if (sensor_is_updated(upper, user))
         {
-          eventset |= (fds->events & POLLIN);
+          eventset |= POLLIN;
         }
 
       if (user->changed)
         {
-          eventset |= (fds->events & POLLPRI);
+          eventset |= POLLPRI;
         }
 
-      if (eventset)
-        {
-          sensor_pollnotify_one(user, eventset);
-        }
+        sensor_pollnotify_one(user, eventset);
     }
   else
     {
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 7b2c8b8622..b61e4b09b8 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -81,7 +81,6 @@
  ****************************************************************************/
 
 static int     uart_takesem(FAR sem_t *sem, bool errout);
-static void    uart_pollnotify(FAR uart_dev_t *dev, pollevent_t eventset);
 
 /* Write support */
 
@@ -165,40 +164,6 @@ static int uart_takesem(FAR sem_t *sem, bool errout)
 
 #define uart_givesem(sem) nxsem_post(sem)
 
-/****************************************************************************
- * Name: uart_pollnotify
- ****************************************************************************/
-
-static void uart_pollnotify(FAR uart_dev_t *dev, pollevent_t eventset)
-{
-  int i;
-
-  for (i = 0; i < CONFIG_SERIAL_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = dev->fds[i];
-      if (fds)
-        {
-#ifdef CONFIG_SERIAL_REMOVABLE
-          fds->revents |= ((fds->events | (POLLERR | POLLHUP)) & eventset);
-#else
-          fds->revents |= (fds->events & eventset);
-#endif
-          if (fds->revents != 0)
-            {
-              int semcount;
-
-              finfo("Report events: %08" PRIx32 "\n", fds->revents);
-
-              nxsem_get_value(fds->sem, &semcount);
-              if (semcount < 1)
-                {
-                  nxsem_post(fds->sem);
-                }
-            }
-        }
-    }
-}
-
 /****************************************************************************
  * Name: uart_putxmitchar
  ****************************************************************************/
@@ -1570,7 +1535,7 @@ static int uart_poll(FAR struct file *filep,
 
       if (ndx != dev->xmit.tail)
         {
-          eventset |= (fds->events & POLLOUT);
+          eventset |= POLLOUT;
         }
 
       uart_givesem(&dev->xmit.sem);
@@ -1585,7 +1550,7 @@ static int uart_poll(FAR struct file *filep,
       uart_takesem(&dev->recv.sem, false);
       if (dev->recv.head != dev->recv.tail)
         {
-          eventset |= (fds->events & POLLIN);
+          eventset |= POLLIN;
         }
 
       uart_givesem(&dev->recv.sem);
@@ -1599,10 +1564,7 @@ static int uart_poll(FAR struct file *filep,
         }
 #endif
 
-      if (eventset)
-        {
-          uart_pollnotify(dev, eventset);
-        }
+      poll_notify(dev->fds, CONFIG_SERIAL_NPOLLWAITERS, eventset);
     }
   else if (fds->priv != NULL)
     {
@@ -1757,7 +1719,7 @@ void uart_datareceived(FAR uart_dev_t *dev)
 {
   /* Notify all poll/select waiters that they can read from the recv buffer */
 
-  uart_pollnotify(dev, POLLIN);
+  poll_notify(dev->fds, CONFIG_SERIAL_NPOLLWAITERS, POLLIN);
 
   /* Is there a thread waiting for read data?  */
 
@@ -1795,7 +1757,7 @@ void uart_datasent(FAR uart_dev_t *dev)
 {
   /* Notify all poll/select waiters that they can write to xmit buffer */
 
-  uart_pollnotify(dev, POLLOUT);
+  poll_notify(dev->fds, CONFIG_SERIAL_NPOLLWAITERS, POLLOUT);
 
   /* Is there a thread waiting for space in xmit.buffer?  */
 
@@ -1845,7 +1807,7 @@ void uart_connected(FAR uart_dev_t *dev, bool connected)
     {
       /* Notify all poll/select waiters that a hangup occurred */
 
-      uart_pollnotify(dev, (POLLERR | POLLHUP));
+      poll_notify(dev->fds, CONFIG_SERIAL_NPOLLWAITERS, POLLERR | POLLHUP);
 
       /* Yes.. wake up all waiting threads.  Each thread should detect the
        * disconnection and return the ENOTCONN error.
diff --git a/drivers/serial/uart_bth4.c b/drivers/serial/uart_bth4.c
index eb204d00f0..017a294908 100644
--- a/drivers/serial/uart_bth4.c
+++ b/drivers/serial/uart_bth4.c
@@ -113,22 +113,7 @@ static inline void uart_bth4_post(FAR sem_t *sem)
 static void uart_bth4_pollnotify(FAR struct uart_bth4_s *dev,
                                  pollevent_t eventset)
 {
-  int i;
-
-  for (i = 0; i < CONFIG_UART_BTH4_NPOLLWAITERS; i++)
-    {
-      FAR struct pollfd *fds = dev->fds[i];
-
-      if (fds)
-        {
-          fds->revents |= (fds->events & eventset);
-
-          if (fds->revents != 0)
-            {
-              uart_bth4_post(fds->sem);
-            }
-        }
-    }
+  poll_notify(dev->fds, CONFIG_UART_BTH4_NPOLLWAITERS, eventset);
 
   if ((eventset & POLLIN) != 0)
     {
@@ -398,15 +383,12 @@ static int uart_bth4_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
       if (!circbuf_is_empty(&dev->circbuf))
         {
-          eventset |= (fds->events & POLLIN);
+          eventset |= POLLIN;
         }
 
-      eventset |= (fds->events & POLLOUT);
+      eventset |= POLLOUT;
 
-      if (eventset)
-        {
-          uart_bth4_pollnotify(dev, eventset);
-        }
+      uart_bth4_pollnotify(dev, eventset);
     }
   else if (fds->priv != NULL)
     {
diff --git a/drivers/syslog/ramlog.c b/drivers/syslog/ramlog.c
index 8146f986f2..e1efd42770 100644
--- a/drivers/syslog/ramlog.c
+++ b/drivers/syslog/ramlog.c
@@ -199,7 +199,6 @@ static int ramlog_readnotify(FAR struct ramlog_dev_s *priv)
 static void ramlog_pollnotify(FAR struct ramlog_dev_s *priv,
                               pollevent_t eventset)
 {
-  FAR struct pollfd *fds;
   irqstate_t flags;
   int i;
 
@@ -208,16 +207,7 @@ static void ramlog_pollnotify(FAR struct ramlog_dev_s *priv,
   for (i = 0; i < CONFIG_RAMLOG_NPOLLWAITERS; i++)
     {
       flags = enter_critical_section();
-      fds = priv->rl_fds[i];
-      if (fds)
-        {
-          fds->revents |= (fds->events & eventset);
-          if (fds->revents != 0)
-            {
-              nxsem_post(fds->sem);
-            }
-        }
-
+      poll_notify(&priv->rl_fds[i], 1, eventset);
       leave_critical_section(flags);
     }
 }
@@ -741,10 +731,7 @@ static int ramlog_file_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
       leave_critical_section(flags);
 
-      if (eventset)
-        {
-          ramlog_pollnotify(priv, eventset);
-        }
+      ramlog_pollnotify(priv, eventset);
     }
   else if (fds->priv)
     {
diff --git a/drivers/usbdev/adb.c b/drivers/usbdev/adb.c
index c18b427284..f6259746e4 100644
--- a/drivers/usbdev/adb.c
+++ b/drivers/usbdev/adb.c
@@ -225,8 +225,6 @@ static int adb_char_poll(FAR struct file *filep, FAR struct pollfd *fds,
                        bool setup);
 
 static void adb_char_notify_readers(FAR struct usbdev_adb_s *priv);
-static void adb_char_pollnotify(FAR struct usbdev_adb_s *dev,
-                                pollevent_t eventset);
 
 static void adb_char_on_connect(FAR struct usbdev_adb_s *priv, int connect);
 
@@ -545,7 +543,7 @@ static void usb_adb_wrcomplete(FAR struct usbdev_ep_s *ep,
 
         /* Notify all poll/select waiters */
 
-        adb_char_pollnotify(priv, POLLOUT);
+        poll_notify(priv->fds, CONFIG_USBADB_NPOLLWAITERS, POLLOUT);
       }
       break;
 
@@ -1538,37 +1536,7 @@ static void adb_char_notify_readers(FAR struct usbdev_adb_s *priv)
 
   /* Notify all poll/select waiters */
 
-  adb_char_pollnotify(priv, POLLIN);
-}
-
-/****************************************************************************
- * Name: adb_char_pollnotify
- *
- * Description:
- *   Notify threads waiting for device event. This function must be called
- *   with interrupt disabled.
- *
- ****************************************************************************/
-
-static void adb_char_pollnotify(FAR struct usbdev_adb_s *dev,
-                                pollevent_t eventset)
-{
-  FAR struct pollfd *fds;
-  int i;
-
-  for (i = 0; i < CONFIG_USBADB_NPOLLWAITERS; i++)
-    {
-      fds = dev->fds[i];
-      if (fds)
-        {
-          fds->revents |= eventset & (fds->events | POLLERR | POLLHUP);
-
-          if (fds->revents != 0)
-            {
-              nxsem_post(fds->sem);
-            }
-        }
-    }
+  poll_notify(priv->fds, CONFIG_USBADB_NPOLLWAITERS, POLLIN);
 }
 
 /****************************************************************************
@@ -2038,10 +2006,7 @@ static int adb_char_poll(FAR struct file *filep, FAR struct pollfd *fds,
       eventset |= POLLIN;
     }
 
-  if (eventset)
-    {
-      adb_char_pollnotify(priv, eventset);
-    }
+  poll_notify(priv->fds, CONFIG_USBADB_NPOLLWAITERS, eventset);
 
 exit_leave_critical:
   leave_critical_section(flags);
@@ -2061,7 +2026,7 @@ static void adb_char_on_connect(FAR struct usbdev_adb_s *priv, int connect)
     {
       /* Notify poll/select with POLLIN */
 
-      adb_char_pollnotify(priv, POLLIN);
+      poll_notify(priv->fds, CONFIG_USBADB_NPOLLWAITERS, POLLIN);
     }
   else
     {
@@ -2089,7 +2054,7 @@ static void adb_char_on_connect(FAR struct usbdev_adb_s *priv, int connect)
 
       /* Notify all poll/select waiters that a hangup occurred */
 
-      adb_char_pollnotify(priv, (POLLERR | POLLHUP));
+      poll_notify(priv->fds, CONFIG_USBADB_NPOLLWAITERS, POLLERR | POLLHUP);
     }
 
     leave_critical_section(flags);
diff --git a/drivers/usbhost/usbhost_cdcmbim.c b/drivers/usbhost/usbhost_cdcmbim.c
index c7e1c7c528..7d257186f3 100644
--- a/drivers/usbhost/usbhost_cdcmbim.c
+++ b/drivers/usbhost/usbhost_cdcmbim.c
@@ -241,10 +241,6 @@ struct usbhost_cdcmbim_s
 static void usbhost_takesem(sem_t *sem);
 #define usbhost_givesem(s) nxsem_post(s);
 
-/* Polling support */
-
-static void usbhost_pollnotify(FAR struct usbhost_cdcmbim_s *priv);
-
 /* Memory allocation services */
 
 static inline FAR struct usbhost_cdcmbim_s *usbhost_allocclass(void);
@@ -399,29 +395,6 @@ static int usbhost_ctrl_cmd(FAR struct usbhost_cdcmbim_s *priv,
   return ret;
 }
 
-/****************************************************************************
- * Name: usbhost_pollnotify
- ****************************************************************************/
-
-static void usbhost_pollnotify(FAR struct usbhost_cdcmbim_s *priv)
-{
-  int i;
-
-  for (i = 0; i < CONFIG_USBHOST_CDCMBIM_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= (fds->events & POLLIN);
-          if (fds->revents != 0)
-            {
-              uinfo("Report events: %08" PRIx32 "\n", fds->revents);
-              nxsem_post(fds->sem);
-            }
-        }
-    }
-}
-
 static ssize_t usbhost_readmessage(FAR struct usbhost_cdcmbim_s *priv,
                                    FAR char *buffer, size_t buflen)
 {
@@ -614,7 +587,8 @@ static int cdcwdm_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
       if (priv->comm_rxlen > 0)
         {
-          usbhost_pollnotify(priv);
+          poll_notify(priv->fds, CONFIG_USBHOST_CDCMBIM_NPOLLWAITERS,
+                      POLLIN);
         }
     }
   else
@@ -956,7 +930,7 @@ static void usbhost_rxdata_work(FAR void *arg)
 
   /* Notify any poll waiters we have data */
 
-  usbhost_pollnotify(priv);
+  poll_notify(priv->fds, CONFIG_USBHOST_CDCMBIM_NPOLLWAITERS, POLLIN);
 
 errout:
   usbhost_givesem(&priv->exclsem);
diff --git a/drivers/usbhost/usbhost_hidkbd.c b/drivers/usbhost/usbhost_hidkbd.c
index 008547d771..091d1e9968 100644
--- a/drivers/usbhost/usbhost_hidkbd.c
+++ b/drivers/usbhost/usbhost_hidkbd.c
@@ -243,10 +243,6 @@ static int  usbhost_takesem(FAR sem_t *sem);
 static void usbhost_forcetake(FAR sem_t *sem);
 #define usbhost_givesem(s) nxsem_post(s);
 
-/* Polling support */
-
-static void usbhost_pollnotify(FAR struct usbhost_state_s *dev);
-
 /* Memory allocation services */
 
 static inline FAR struct usbhost_state_s *usbhost_allocclass(void);
@@ -680,29 +676,6 @@ static void usbhost_forcetake(FAR sem_t *sem)
   while (ret < 0);
 }
 
-/****************************************************************************
- * Name: usbhost_pollnotify
- ****************************************************************************/
-
-static void usbhost_pollnotify(FAR struct usbhost_state_s *priv)
-{
-  int i;
-
-  for (i = 0; i < CONFIG_HIDKBD_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= (fds->events & POLLIN);
-          if (fds->revents != 0)
-            {
-              uinfo("Report events: %08" PRIx32 "\n", fds->revents);
-              nxsem_post(fds->sem);
-            }
-        }
-    }
-}
-
 /****************************************************************************
  * Name: usbhost_allocclass
  *
@@ -1294,7 +1267,7 @@ static int usbhost_kbdpoll(int argc, char *argv[])
 
               if (empty)
                 {
-                  usbhost_pollnotify(priv);
+                  poll_notify(priv->fds, CONFIG_HIDKBD_NPOLLWAITERS, POLLIN);
                 }
 
               /* Yes.. Is there a thread waiting for keyboard data now? */
@@ -2532,7 +2505,7 @@ static int usbhost_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
       if (priv->headndx != priv->tailndx)
         {
-          usbhost_pollnotify(priv);
+          poll_notify(priv->fds, CONFIG_HIDKBD_NPOLLWAITERS, POLLIN);
         }
     }
   else
diff --git a/drivers/usbhost/usbhost_hidmouse.c b/drivers/usbhost/usbhost_hidmouse.c
index 0292197122..e3017d424f 100644
--- a/drivers/usbhost/usbhost_hidmouse.c
+++ b/drivers/usbhost/usbhost_hidmouse.c
@@ -292,10 +292,6 @@ static int usbhost_takesem(FAR sem_t *sem);
 static void usbhost_forcetake(FAR sem_t *sem);
 #define usbhost_givesem(s) nxsem_post(s);
 
-/* Polling support */
-
-static void usbhost_pollnotify(FAR struct usbhost_state_s *dev);
-
 /* Memory allocation services */
 
 static inline FAR struct usbhost_state_s *usbhost_allocclass(void);
@@ -467,29 +463,6 @@ static void usbhost_forcetake(FAR sem_t *sem)
   while (ret < 0);
 }
 
-/****************************************************************************
- * Name: usbhost_pollnotify
- ****************************************************************************/
-
-static void usbhost_pollnotify(FAR struct usbhost_state_s *priv)
-{
-  int i;
-
-  for (i = 0; i < CONFIG_HIDMOUSE_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= (fds->events & POLLIN);
-          if (fds->revents != 0)
-            {
-              uinfo("Report events: %08" PRIx32 "\n", fds->revents);
-              nxsem_post(fds->sem);
-            }
-        }
-    }
-}
-
 /****************************************************************************
  * Name: usbhost_allocclass
  *
@@ -677,8 +650,6 @@ static void usbhost_destroy(FAR void *arg)
 
 static void usbhost_notify(FAR struct usbhost_state_s *priv)
 {
-  int i;
-
   /* If there are threads waiting for read data, then signal one of them
    * that the read data is available.
    */
@@ -694,16 +665,7 @@ static void usbhost_notify(FAR struct usbhost_state_s *priv)
    * all try to read the data, then some make end up blocking after all.
    */
 
-  for (i = 0; i < CONFIG_HIDMOUSE_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
+  poll_notify(priv->fds, CONFIG_HIDMOUSE_NPOLLWAITERS, POLLIN);
 }
 
 /****************************************************************************
@@ -2558,7 +2520,7 @@ static int usbhost_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
       if (priv->valid)
         {
-          usbhost_pollnotify(priv);
+          poll_notify(priv->fds, CONFIG_HIDMOUSE_NPOLLWAITERS, POLLIN);
         }
     }
   else
diff --git a/drivers/usbhost/usbhost_xboxcontroller.c b/drivers/usbhost/usbhost_xboxcontroller.c
index 3f15e8f896..ccc0456196 100644
--- a/drivers/usbhost/usbhost_xboxcontroller.c
+++ b/drivers/usbhost/usbhost_xboxcontroller.c
@@ -561,8 +561,6 @@ static void usbhost_destroy(FAR void *arg)
 
 static void usbhost_pollnotify(FAR struct usbhost_state_s *priv)
 {
-  int i;
-
   /* If there are threads waiting for read data, then signal one of them
    * that the read data is available.
    */
@@ -578,16 +576,7 @@ static void usbhost_pollnotify(FAR struct usbhost_state_s *priv)
    * read the data, then some make end up blocking after all.
    */
 
-  for (i = 0; i < CONFIG_XBOXCONTROLLER_NPOLLWAITERS; i++)
-    {
-      FAR struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          iinfo("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
+  poll_notify(priv->fds, CONFIG_XBOXCONTROLLER_NPOLLWAITERS, POLLIN);
 }
 
 /****************************************************************************
diff --git a/drivers/usbmisc/fusb301.c b/drivers/usbmisc/fusb301.c
index 57ecc85ff4..d0654d805d 100644
--- a/drivers/usbmisc/fusb301.c
+++ b/drivers/usbmisc/fusb301.c
@@ -80,7 +80,6 @@ static ssize_t fusb301_write(FAR struct file *filep, FAR const char *buffer,
 static int fusb301_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
 static int fusb301_poll(FAR struct file *filep, FAR struct pollfd *fds,
                         bool setup);
-static void fusb301_notify(FAR struct fusb301_dev_s *priv);
 
 /****************************************************************************
  * Private Data
@@ -706,7 +705,7 @@ static int fusb301_poll(FAR struct file *filep,
       flags = enter_critical_section();
       if (priv->int_pending)
         {
-          fusb301_notify(priv);
+          poll_notify(priv->fds, CONFIG_FUSB301_NPOLLWAITERS, POLLIN);
         }
 
       leave_critical_section(flags);
@@ -729,38 +728,6 @@ out:
   return ret;
 }
 
-/****************************************************************************
- * Name: fusb301_notify
- *
- * Description:
- *   Notify thread about data to be available
- *
- ****************************************************************************/
-
-static void fusb301_notify(FAR struct fusb301_dev_s *priv)
-{
-  DEBUGASSERT(priv != NULL);
-
-  int i;
-
-  /* If there are threads waiting on poll() for FUSB301 data to become
-   * available, then wake them up now.  NOTE: we wake up all waiting threads
-   * because we do not know that they are going to do.  If they all try to
-   * read the data, then some make end up blocking after all.
-   */
-
-  for (i = 0; i < CONFIG_FUSB301_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          fusb301_info("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
-}
-
 /****************************************************************************
  * Name: fusb301_callback
  *
@@ -779,7 +746,7 @@ static int fusb301_int_handler(int irq, FAR void *context, FAR void *arg)
   flags = enter_critical_section();
   priv->int_pending = true;
 
-  fusb301_notify(priv);
+  poll_notify(priv->fds, CONFIG_FUSB301_NPOLLWAITERS, POLLIN);
   leave_critical_section(flags);
 
   return OK;
diff --git a/drivers/usbmisc/fusb303.c b/drivers/usbmisc/fusb303.c
index a61028a1a7..cc52ae9d74 100644
--- a/drivers/usbmisc/fusb303.c
+++ b/drivers/usbmisc/fusb303.c
@@ -114,7 +114,6 @@ static ssize_t fusb303_write(FAR struct file *filep, FAR const char *buffer,
 static int fusb303_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
 static int fusb303_poll(FAR struct file *filep, FAR struct pollfd *fds,
                         bool setup);
-static void fusb303_notify(FAR struct fusb303_dev_s *priv);
 
 /****************************************************************************
  * Private Data
@@ -894,7 +893,7 @@ static int fusb303_poll(FAR struct file *filep, FAR struct pollfd *fds,
       flags = enter_critical_section();
       if (priv->int_pending)
         {
-          fusb303_notify(priv);
+          poll_notify(priv->fds, CONFIG_FUSB303_NPOLLWAITERS, POLLIN);
         }
 
       leave_critical_section(flags);
@@ -917,38 +916,6 @@ out:
   return ret;
 }
 
-/****************************************************************************
- * Name: fusb303_notify
- *
- * Description:
- *   Notify thread about data to be available
- *
- ****************************************************************************/
-
-static void fusb303_notify(FAR struct fusb303_dev_s *priv)
-{
-  int i;
-
-  DEBUGASSERT(priv != NULL);
-
-  /* If there are threads waiting on poll() for FUSB303 data to become
-   * available, then wake them up now.  NOTE: we wake up all waiting threads
-   * because we do not know that they are going to do.  If they all try to
-   * read the data, then some make end up blocking after all.
-   */
-
-  for (i = 0; i < CONFIG_FUSB303_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= POLLIN;
-          fusb303_info("Report events: %08" PRIx32 "\n", fds->revents);
-          nxsem_post(fds->sem);
-        }
-    }
-}
-
 /****************************************************************************
  * Name: fusb303_callback
  *
@@ -967,7 +934,7 @@ static int fusb303_int_handler(int irq, FAR void *context, FAR void *arg)
   flags = enter_critical_section();
   priv->int_pending = true;
 
-  fusb303_notify(priv);
+  poll_notify(priv->fds, CONFIG_FUSB303_NPOLLWAITERS, POLLIN);
   leave_critical_section(flags);
 
   return OK;
diff --git a/drivers/usrsock/usrsock_dev.c b/drivers/usrsock/usrsock_dev.c
index b93d02df0d..f9c3fa3e77 100644
--- a/drivers/usrsock/usrsock_dev.c
+++ b/drivers/usrsock/usrsock_dev.c
@@ -152,29 +152,6 @@ static bool usrsockdev_is_opened(FAR struct usrsockdev_s *dev)
   return ret;
 }
 
-/****************************************************************************
- * Name: usrsockdev_pollnotify
- ****************************************************************************/
-
-static void usrsockdev_pollnotify(FAR struct usrsockdev_s *dev,
-                                  pollevent_t eventset)
-{
-  int i;
-  for (i = 0; i < ARRAY_SIZE(dev->pollfds); i++)
-    {
-      struct pollfd *fds = dev->pollfds[i];
-      if (fds)
-        {
-          fds->revents |= (fds->events & eventset);
-          if (fds->revents != 0)
-            {
-              ninfo("Report events: %08" PRIx32 "\n", fds->revents);
-              nxsem_post(fds->sem);
-            }
-        }
-    }
-}
-
 /****************************************************************************
  * Name: usrsockdev_read
  ****************************************************************************/
@@ -512,10 +489,7 @@ static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
           eventset |= POLLIN;
         }
 
-      if (eventset)
-        {
-          usrsockdev_pollnotify(dev, eventset);
-        }
+      poll_notify(dev->pollfds, ARRAY_SIZE(dev->pollfds), eventset);
     }
   else
     {
@@ -566,7 +540,7 @@ int usrsock_request(FAR struct iovec *iov, unsigned int iovcnt)
 
       /* Notify daemon of new request. */
 
-      usrsockdev_pollnotify(dev, POLLIN);
+      poll_notify(dev->pollfds, ARRAY_SIZE(dev->pollfds), POLLIN);
     }
   else
     {
diff --git a/drivers/wireless/cc1101.c b/drivers/wireless/cc1101.c
index d511b390ff..6b876f69d3 100644
--- a/drivers/wireless/cc1101.c
+++ b/drivers/wireless/cc1101.c
@@ -92,6 +92,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <fcntl.h>
+#include <poll.h>
 #include <assert.h>
 #include <errno.h>
 #include <debug.h>
@@ -638,8 +639,7 @@ static int cc1101_file_poll(FAR struct file *filep, FAR struct pollfd *fds,
       cc1101_takesem(&dev->sem_rx_buffer);
       if (dev->fifo_len > 0)
         {
-          dev->pfd->revents |= POLLIN; /* Data available for input */
-          nxsem_post(dev->pfd->sem);
+          poll_notify(&dev->pfd, 1, POLLIN);
         }
 
       nxsem_post(&dev->sem_rx_buffer);
@@ -1540,9 +1540,7 @@ void cc1101_isr_process(FAR void *arg)
 
           if (dev->pfd)
             {
-              dev->pfd->revents |= POLLIN; /* Data available for input */
-              wlinfo("Wake up polled fd\n");
-              nxsem_post(dev->pfd->sem);
+              poll_notify(&dev->pfd, 1, POLLIN);
             }
         }
         break;
diff --git a/drivers/wireless/gs2200m.c b/drivers/wireless/gs2200m.c
index 9e650a86f4..a529689f87 100644
--- a/drivers/wireless/gs2200m.c
+++ b/drivers/wireless/gs2200m.c
@@ -423,8 +423,7 @@ static void _notif_q_push(FAR struct gs2200m_dev_s *dev, char cid)
     {
       /* If poll() waits and cid has been pushed to the queue, notify  */
 
-      dev->pfd->revents |= POLLIN;
-      nxsem_post(dev->pfd->sem);
+      poll_notify(&dev->pfd, 1, POLLIN);
     }
 
   wlinfo("+++ pushed %c count=%d\n", cid, dev->notif_q.count);
@@ -3187,9 +3186,7 @@ static int gs2200m_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
       if (0 < n)
         {
-          dev->pfd->revents |= POLLIN;
-          nxsem_post(dev->pfd->sem);
-          wlinfo("==== _notif_q_count=%d\n", n);
+          poll_notify(&dev->pfd, 1, POLLIN);
         }
     }
   else
diff --git a/drivers/wireless/lpwan/sx127x/sx127x.c b/drivers/wireless/lpwan/sx127x/sx127x.c
index 7841cc710e..d04653d116 100644
--- a/drivers/wireless/lpwan/sx127x/sx127x.c
+++ b/drivers/wireless/lpwan/sx127x/sx127x.c
@@ -1229,8 +1229,7 @@ static int sx127x_poll(FAR struct file *filep, FAR struct pollfd *fds,
         {
           /* Data available for input */
 
-          dev->pfd->revents |= POLLIN;
-          nxsem_post(dev->pfd->sem);
+          poll_notify(&dev->pfd, 1, POLLIN);
         }
 
       nxsem_post(&dev->rx_buffer_sem);
@@ -1313,10 +1312,7 @@ static int sx127x_lora_isr0_process(FAR struct sx127x_dev_s *dev)
                     {
                       /* Data available for input */
 
-                      dev->pfd->revents |= POLLIN;
-
-                      wlinfo("Wake up polled fd\n");
-                      nxsem_post(dev->pfd->sem);
+                      poll_notify(&dev->pfd, 1, POLLIN);
                     }
 
                   /* Wake-up any thread waiting in recv */
@@ -1448,10 +1444,7 @@ static int sx127x_fskook_isr0_process(FAR struct sx127x_dev_s *dev)
                     {
                       /* Data available for input */
 
-                      dev->pfd->revents |= POLLIN;
-
-                      wlinfo("Wake up polled fd\n");
-                      nxsem_post(dev->pfd->sem);
+                      poll_notify(&dev->pfd, 1, POLLIN);
                     }
 
                   /* Wake-up any thread waiting in recv */
diff --git a/drivers/wireless/nrf24l01.c b/drivers/wireless/nrf24l01.c
index 824b5a49c1..9920686a4c 100644
--- a/drivers/wireless/nrf24l01.c
+++ b/drivers/wireless/nrf24l01.c
@@ -714,10 +714,7 @@ static void nrf24l01_worker(FAR void *arg)
 
       if (dev->pfd && has_data)
         {
-          dev->pfd->revents |= POLLIN;  /* Data available for input */
-
-          wlinfo("Wake up polled fd\n");
-          nxsem_post(dev->pfd->sem);
+          poll_notify(&dev->pfd, 1, POLLIN);
         }
 
       /* Clear interrupt sources */
@@ -1410,8 +1407,7 @@ static int nrf24l01_poll(FAR struct file *filep, FAR struct pollfd *fds,
       nxsem_wait(&dev->sem_fifo);
       if (dev->fifo_len > 0)
         {
-          dev->pfd->revents |= POLLIN;  /* Data available for input */
-          nxsem_post(dev->pfd->sem);
+          poll_notify(&dev->pfd, 1, POLLIN);
         }
 
       nxsem_post(&dev->sem_fifo);
diff --git a/fs/mqueue/mq_open.c b/fs/mqueue/mq_open.c
index 6f421a3166..47e853c51a 100644
--- a/fs/mqueue/mq_open.c
+++ b/fs/mqueue/mq_open.c
@@ -127,18 +127,15 @@ static int nxmq_file_poll(FAR struct file *filep,
 
       if (msgq->nmsgs < msgq->maxmsgs)
         {
-          eventset |= (fds->events & POLLOUT);
+          eventset |= POLLOUT;
         }
 
       if (msgq->nmsgs)
         {
-          eventset |= (fds->events & POLLIN);
+          eventset |= POLLIN;
         }
 
-      if (eventset)
-        {
-          nxmq_pollnotify(msgq, eventset);
-        }
+      nxmq_pollnotify(msgq, eventset);
     }
   else if (fds->priv != NULL)
     {
@@ -370,34 +367,6 @@ static mqd_t nxmq_vopen(FAR const char *mq_name, int oflags, va_list ap)
  * Public Functions
  ****************************************************************************/
 
-#if CONFIG_FS_MQUEUE_NPOLLWAITERS > 0
-void nxmq_pollnotify(FAR struct mqueue_inode_s *msgq, pollevent_t eventset)
-{
-  int i;
-
-  for (i = 0; i < CONFIG_FS_MQUEUE_NPOLLWAITERS; i++)
-    {
-      FAR struct pollfd *fds = msgq->fds[i];
-
-      if (fds)
-        {
-          fds->revents |= (fds->events & eventset);
-
-          if (fds->revents != 0)
-            {
-              int semcount;
-
-              nxsem_get_value(fds->sem, &semcount);
-              if (semcount < 1)
-                {
-                  nxsem_post(fds->sem);
-                }
-            }
-        }
-    }
-}
-#endif
-
 /****************************************************************************
  * Name: file_mq_open
  *
diff --git a/fs/vfs/fs_epoll.c b/fs/vfs/fs_epoll.c
index 5eceb21fbd..f835acde0e 100644
--- a/fs/vfs/fs_epoll.c
+++ b/fs/vfs/fs_epoll.c
@@ -367,8 +367,7 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *ev)
 
   if (eph->poll[0].sem)
     {
-      eph->poll[0].revents |= eph->poll[0].events;
-      nxsem_post(eph->poll[0].sem);
+      poll_notify(&eph->poll, 1, eph->poll[0].events);
     }
 
   return 0;
diff --git a/fs/vfs/fs_eventfd.c b/fs/vfs/fs_eventfd.c
index a34e55a648..ef56686bde 100644
--- a/fs/vfs/fs_eventfd.c
+++ b/fs/vfs/fs_eventfd.c
@@ -81,9 +81,6 @@ static ssize_t eventfd_do_write(FAR struct file *filep,
 #ifdef CONFIG_EVENT_FD_POLL
 static int eventfd_do_poll(FAR struct file *filep, FAR struct pollfd *fds,
                        bool setup);
-
-static void eventfd_pollnotify(FAR struct eventfd_priv_s *dev,
-                               pollevent_t eventset);
 #endif
 
 static int eventfd_blocking_io(FAR struct eventfd_priv_s *dev,
@@ -144,29 +141,6 @@ static void eventfd_destroy(FAR struct eventfd_priv_s *dev)
   kmm_free(dev);
 }
 
-#ifdef CONFIG_EVENT_FD_POLL
-static void eventfd_pollnotify(FAR struct eventfd_priv_s *dev,
-                               pollevent_t eventset)
-{
-  FAR struct pollfd *fds;
-  int i;
-
-  for (i = 0; i < CONFIG_EVENT_FD_NPOLLWAITERS; i++)
-    {
-      fds = dev->fds[i];
-      if (fds)
-        {
-          fds->revents |= eventset & fds->events;
-
-          if (fds->revents != 0)
-            {
-              nxsem_post(fds->sem);
-            }
-        }
-    }
-}
-#endif
-
 static unsigned int eventfd_get_unique_minor(void)
 {
   static unsigned int minor;
@@ -370,7 +344,7 @@ static ssize_t eventfd_do_read(FAR struct file *filep, FAR char *buffer,
 #ifdef CONFIG_EVENT_FD_POLL
   /* Notify all poll/select waiters */
 
-  eventfd_pollnotify(dev, POLLOUT);
+  poll_notify(dev->fds, CONFIG_EVENT_FD_NPOLLWAITERS, POLLOUT);
 #endif
 
   /* Notify all waiting writers that counter have been decremented */
@@ -447,7 +421,7 @@ static ssize_t eventfd_do_write(FAR struct file *filep,
 #ifdef CONFIG_EVENT_FD_POLL
   /* Notify all poll/select waiters */
 
-  eventfd_pollnotify(dev, POLLIN);
+  poll_notify(dev->fds, CONFIG_EVENT_FD_NPOLLWAITERS, POLLIN);
 #endif
 
   /* Notify all of the waiting readers */
@@ -538,10 +512,7 @@ static int eventfd_do_poll(FAR struct file *filep, FAR struct pollfd *fds,
       eventset |= POLLIN;
     }
 
-  if (eventset)
-    {
-      eventfd_pollnotify(dev, eventset);
-    }
+  poll_notify(dev->fds, CONFIG_EVENT_FD_NPOLLWAITERS, eventset);
 
 out:
   nxsem_post(&dev->exclsem);
diff --git a/fs/vfs/fs_poll.c b/fs/vfs/fs_poll.c
index 9c784baf81..233ee570ee 100644
--- a/fs/vfs/fs_poll.c
+++ b/fs/vfs/fs_poll.c
@@ -29,6 +29,7 @@
 #include <time.h>
 #include <assert.h>
 #include <errno.h>
+#include <debug.h>
 
 #include <nuttx/clock.h>
 #include <nuttx/semaphore.h>
@@ -276,6 +277,60 @@ static inline int poll_teardown(FAR struct pollfd *fds, nfds_t nfds,
  * Public Functions
  ****************************************************************************/
 
+/****************************************************************************
+ * Name: poll_notify
+ *
+ * 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(FAR struct pollfd **afds, int nfds, pollevent_t eventset)
+{
+  int i;
+  int semcount;
+  FAR struct pollfd *fds;
+
+  DEBUGASSERT(afds != NULL && nfds >= 1);
+
+  for (i = 0; i < nfds && eventset; i++)
+    {
+      fds = afds[i];
+      if (fds != NULL)
+        {
+          /* The error event must be set in fds->revents */
+
+          fds->revents |= eventset & (fds->events | POLLERR | POLLHUP);
+          if ((fds->revents & (POLLERR | POLLHUP)) != 0)
+            {
+              /* Error, clear POLLIN and POLLOUT event */
+
+              fds->revents &= ~(POLLIN | POLLOUT);
+            }
+
+          if (fds->revents != 0)
+            {
+              finfo("Report events: %08" PRIx32 "\n", fds->revents);
+
+              nxsem_get_value(fds->sem, &semcount);
+              if (semcount < 1)
+                {
+                  nxsem_post(fds->sem);
+                }
+            }
+        }
+    }
+}
+
 /****************************************************************************
  * Name: file_poll
  *
@@ -328,11 +383,7 @@ int file_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
         {
           if (setup)
             {
-              fds->revents |= (fds->events & (POLLIN | POLLOUT));
-              if (fds->revents != 0)
-                {
-                  nxsem_post(fds->sem);
-                }
+              poll_notify(&fds, 1, POLLIN | POLLOUT);
             }
 
           ret = OK;
@@ -340,8 +391,7 @@ int file_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
     }
   else
     {
-      fds->revents |= (POLLERR | POLLHUP);
-      nxsem_post(fds->sem);
+      poll_notify(&fds, 1, POLLERR | POLLHUP);
 
       ret = OK;
     }
diff --git a/fs/vfs/fs_timerfd.c b/fs/vfs/fs_timerfd.c
index ef1b50d4ed..2cc37160b0 100644
--- a/fs/vfs/fs_timerfd.c
+++ b/fs/vfs/fs_timerfd.c
@@ -94,9 +94,6 @@ static ssize_t timerfd_read(FAR struct file *filep, FAR char *buffer,
 #ifdef CONFIG_TIMER_FD_POLL
 static int timerfd_poll(FAR struct file *filep, FAR struct pollfd *fds,
                         bool setup);
-
-static void timerfd_pollnotify(FAR struct timerfd_priv_s *dev,
-                               pollevent_t eventset);
 #endif
 
 static int timerfd_blocking_io(FAR struct timerfd_priv_s *dev,
@@ -174,29 +171,6 @@ static timerfd_t timerfd_get_counter(FAR struct timerfd_priv_s *dev)
   return counter;
 }
 
-#ifdef CONFIG_TIMER_FD_POLL
-static void timerfd_pollnotify(FAR struct timerfd_priv_s *dev,
-                               pollevent_t eventset)
-{
-  FAR struct pollfd *fds;
-  int i;
-
-  for (i = 0; i < CONFIG_TIMER_FD_NPOLLWAITERS; i++)
-    {
-      fds = dev->fds[i];
-      if (fds)
-        {
-          fds->revents |= eventset & fds->events;
-
-          if (fds->revents != 0)
-            {
-              nxsem_post(fds->sem);
-            }
-        }
-    }
-}
-#endif
-
 static unsigned int timerfd_get_unique_minor(void)
 {
   static unsigned int minor;
@@ -460,7 +434,9 @@ static int timerfd_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
   if (timerfd_get_counter(dev) > 0)
     {
-      timerfd_pollnotify(dev, POLLIN);
+#ifdef CONFIG_TIMER_FD_POLL
+      poll_notify(dev->fds, CONFIG_TIMER_FD_NPOLLWAITERS, POLLIN);
+#endif
     }
 
 out:
@@ -484,7 +460,7 @@ static void timerfd_timeout_work(FAR void *arg)
 #ifdef CONFIG_TIMER_FD_POLL
   /* Notify all poll/select waiters */
 
-  timerfd_pollnotify(dev, POLLIN);
+  poll_notify(dev->fds, CONFIG_TIMER_FD_NPOLLWAITERS, POLLIN);
 #endif
 
   /* Notify all of the waiting readers */
diff --git a/graphics/nxterm/nxterm_kbdin.c b/graphics/nxterm/nxterm_kbdin.c
index c15f8fde32..3fa3730b77 100644
--- a/graphics/nxterm/nxterm_kbdin.c
+++ b/graphics/nxterm/nxterm_kbdin.c
@@ -49,7 +49,6 @@
 static void nxterm_pollnotify(FAR struct nxterm_state_s *priv,
                               pollevent_t eventset)
 {
-  FAR struct pollfd *fds;
   irqstate_t flags;
   int i;
 
@@ -58,16 +57,7 @@ static void nxterm_pollnotify(FAR struct nxterm_state_s *priv,
   for (i = 0; i < CONFIG_NXTERM_NPOLLWAITERS; i++)
     {
       flags = enter_critical_section();
-      fds   = priv->fds[i];
-      if (fds)
-        {
-          fds->revents |= (fds->events & eventset);
-          if (fds->revents != 0)
-            {
-              nxsem_post(fds->sem);
-            }
-        }
-
+      poll_notify(&priv->fds[i], 1, eventset);
       leave_critical_section(flags);
     }
 }
@@ -304,10 +294,7 @@ int nxterm_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
           eventset |= POLLIN;
         }
 
-      if (eventset)
-        {
-          nxterm_pollnotify(priv, eventset);
-        }
+      nxterm_pollnotify(priv, eventset);
     }
   else if (fds->priv)
     {
diff --git a/include/nuttx/mqueue.h b/include/nuttx/mqueue.h
index a25ff84b03..094a7db1b2 100644
--- a/include/nuttx/mqueue.h
+++ b/include/nuttx/mqueue.h
@@ -79,6 +79,13 @@
 #  define _MQ_TIMEDRECEIVE(d,m,l,p,t) mq_timedreceive(d,m,l,p,t)
 #endif
 
+#if CONFIG_FS_MQUEUE_NPOLLWAITERS > 0
+# define nxmq_pollnotify(msgq, eventset) \
+  poll_notify(msgq->fds, CONFIG_FS_MQUEUE_NPOLLWAITERS, eventset)
+#else
+# define nxmq_pollnotify(msgq, eventset)
+#endif
+
 /****************************************************************************
  * Public Type Declarations
  ****************************************************************************/
@@ -404,28 +411,6 @@ void nxmq_free_msgq(FAR struct mqueue_inode_s *msgq);
 int nxmq_alloc_msgq(FAR struct mq_attr *attr,
                     FAR struct mqueue_inode_s **pmsgq);
 
-/****************************************************************************
- * Name: nxmq_pollnotify
- *
- * Description:
- *   pollnotify, used for notifying the poll
- *
- * Input Parameters:
- *   msgq     - Named message queue
- *   eventset - evnet
- *
- * Returned Value:
- *   The allocated and initialized message queue structure or NULL in the
- *   event of a failure.
- *
- ****************************************************************************/
-
-#if CONFIG_FS_MQUEUE_NPOLLWAITERS > 0
-void nxmq_pollnotify(FAR struct mqueue_inode_s *msgq, pollevent_t eventset);
-#else
-# define nxmq_pollnotify(msgq, eventset)
-#endif
-
 /****************************************************************************
  * Name: file_mq_open
  *
diff --git a/include/sys/poll.h b/include/sys/poll.h
index 4562ac89b5..d7888c1cd4 100644
--- a/include/sys/poll.h
+++ b/include/sys/poll.h
@@ -144,6 +144,8 @@ int ppoll(FAR struct pollfd *fds, nfds_t nfds,
           FAR const struct timespec *timeout_ts,
           FAR const sigset_t *sigmask);
 
+void poll_notify(FAR struct pollfd **afds, int nfds, pollevent_t eventset);
+
 #undef EXTERN
 #if defined(__cplusplus)
 }
diff --git a/net/can/can_sockif.c b/net/can/can_sockif.c
index 01ddf193e9..3e9ccc27b0 100644
--- a/net/can/can_sockif.c
+++ b/net/can/can_sockif.c
@@ -128,7 +128,7 @@ static uint16_t can_poll_eventhandler(FAR struct net_driver_s *dev,
 
       if ((flags & CAN_NEWDATA) != 0)
         {
-          eventset |= (POLLIN & info->fds->events);
+          eventset |= POLLIN;
         }
 
       /* Check for loss of connection events. */
@@ -143,16 +143,12 @@ static uint16_t can_poll_eventhandler(FAR struct net_driver_s *dev,
       else if ((flags & CAN_POLL) != 0 &&
                  psock_can_cansend(info->psock) >= 0)
         {
-          eventset |= (POLLOUT & info->fds->events);
+          eventset |= POLLOUT;
         }
 
       /* Awaken the caller of poll() is requested event occurred. */
 
-      if (eventset)
-        {
-          info->fds->revents |= eventset;
-          nxsem_post(info->fds->sem);
-        }
+      poll_notify(&info->fds, 1, eventset);
     }
 
   return flags;
@@ -542,6 +538,7 @@ static int can_poll_local(FAR struct socket *psock, FAR struct pollfd *fds,
   FAR struct can_conn_s *conn;
   FAR struct can_poll_s *info;
   FAR struct devif_callback_s *cb;
+  pollevent_t eventset = 0;
   int ret = OK;
 
   DEBUGASSERT(psock != NULL && psock->s_conn != NULL);
@@ -602,24 +599,19 @@ static int can_poll_local(FAR struct socket *psock, FAR struct pollfd *fds,
         {
           /* Normal data may be read without blocking. */
 
-          fds->revents |= (POLLRDNORM & fds->events);
+          eventset |= POLLRDNORM;
         }
 
       if (psock_can_cansend(psock) >= 0)
         {
           /* A CAN frame may be sent without blocking. */
 
-          fds->revents |= (POLLWRNORM & fds->events);
+          eventset |= POLLWRNORM;
         }
 
       /* Check if any requested events are already in effect */
 
-      if (fds->revents != 0)
-        {
-          /* Yes.. then signal the poll logic */
-
-          nxsem_post(fds->sem);
-        }
+      poll_notify(&fds, 1, eventset);
 
 errout_with_lock:
       net_unlock();
diff --git a/net/icmp/icmp_netpoll.c b/net/icmp/icmp_netpoll.c
index a5050e3665..57b5626e38 100644
--- a/net/icmp/icmp_netpoll.c
+++ b/net/icmp/icmp_netpoll.c
@@ -97,7 +97,7 @@ static uint16_t icmp_poll_eventhandler(FAR struct net_driver_s *dev,
       eventset = 0;
       if ((flags & ICMP_NEWDATA) != 0)
         {
-          eventset |= (POLLIN & info->fds->events);
+          eventset |= POLLIN;
         }
 
       /* Check for loss of connection events. */
@@ -109,11 +109,7 @@ static uint16_t icmp_poll_eventhandler(FAR struct net_driver_s *dev,
 
       /* Awaken the caller of poll() is requested event occurred. */
 
-      if (eventset)
-        {
-          info->fds->revents |= eventset;
-          nxsem_post(info->fds->sem);
-        }
+      poll_notify(&info->fds, 1, eventset);
     }
 
   return flags;
@@ -144,6 +140,7 @@ int icmp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
   FAR struct icmp_conn_s *conn;
   FAR struct icmp_poll_s *info;
   FAR struct devif_callback_s *cb;
+  pollevent_t eventset = 0;
   int ret = OK;
 
   /* Some of the following must be atomic */
@@ -213,23 +210,18 @@ int icmp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
     {
       /* Normal data may be read without blocking. */
 
-      fds->revents |= (POLLRDNORM & fds->events);
+      eventset |= POLLRDNORM;
     }
 
   /* Always report POLLWRNORM if caller request it because we don't utilize
    * IOB buffer for sending.
    */
 
-  fds->revents |= (POLLWRNORM & fds->events);
+  eventset |= POLLWRNORM;
 
   /* Check if any requested events are already in effect */
 
-  if (fds->revents != 0)
-    {
-      /* Yes.. then signal the poll logic */
-
-      nxsem_post(fds->sem);
-    }
+  poll_notify(&fds, 1, eventset);
 
 errout_with_lock:
   net_unlock();
diff --git a/net/icmpv6/icmpv6_netpoll.c b/net/icmpv6/icmpv6_netpoll.c
index b4cf027e29..e46e0ecaa2 100644
--- a/net/icmpv6/icmpv6_netpoll.c
+++ b/net/icmpv6/icmpv6_netpoll.c
@@ -97,7 +97,7 @@ static uint16_t icmpv6_poll_eventhandler(FAR struct net_driver_s *dev,
       eventset = 0;
       if ((flags & ICMPv6_NEWDATA) != 0)
         {
-          eventset |= (POLLIN & info->fds->events);
+          eventset |= POLLIN;
         }
 
       /* Check for loss of connection events. */
@@ -109,11 +109,7 @@ static uint16_t icmpv6_poll_eventhandler(FAR struct net_driver_s *dev,
 
       /* Awaken the caller of poll() is requested event occurred. */
 
-      if (eventset)
-        {
-          info->fds->revents |= eventset;
-          nxsem_post(info->fds->sem);
-        }
+      poll_notify(&info->fds, 1, eventset);
     }
 
   return flags;
@@ -144,6 +140,7 @@ int icmpv6_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
   FAR struct icmpv6_conn_s *conn;
   FAR struct icmpv6_poll_s *info;
   FAR struct devif_callback_s *cb;
+  pollevent_t eventset = 0;
   int ret = OK;
 
   /* Some of the following must be atomic */
@@ -213,23 +210,18 @@ int icmpv6_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
     {
       /* Normal data may be read without blocking. */
 
-      fds->revents |= (POLLRDNORM & fds->events);
+      eventset |= POLLRDNORM;
     }
 
   /* Always report POLLWRNORM if caller request it because we don't utilize
    * IOB buffer for sending.
    */
 
-  fds->revents |= (POLLWRNORM & fds->events);
+  eventset |= POLLWRNORM;
 
   /* Check if any requested events are already in effect */
 
-  if (fds->revents != 0)
-    {
-      /* Yes.. then signal the poll logic */
-
-      nxsem_post(fds->sem);
-    }
+  poll_notify(&fds, 1, eventset);
 
 errout_with_lock:
   net_unlock();
diff --git a/net/local/local_netpoll.c b/net/local/local_netpoll.c
index 741ffb2060..572f9484e5 100644
--- a/net/local/local_netpoll.c
+++ b/net/local/local_netpoll.c
@@ -28,6 +28,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <debug.h>
+#include <poll.h>
 
 #include <nuttx/semaphore.h>
 #include <nuttx/net/net.h>
@@ -84,10 +85,7 @@ static int local_event_pollsetup(FAR struct local_conn_s *conn,
           eventset |= POLLIN;
         }
 
-      if (eventset)
-        {
-          local_event_pollnotify(conn, eventset);
-        }
+      local_event_pollnotify(conn, eventset);
     }
   else
     {
@@ -125,21 +123,7 @@ void local_event_pollnotify(FAR struct local_conn_s *conn,
                             pollevent_t eventset)
 {
 #ifdef CONFIG_NET_LOCAL_STREAM
-  int i;
-
-  for (i = 0; i < LOCAL_NPOLLWAITERS; i++)
-    {
-      struct pollfd *fds = conn->lc_event_fds[i];
-      if (fds)
-        {
-          fds->revents |= (fds->events & eventset);
-          if (fds->revents != 0)
-            {
-              ninfo("Report events: %08" PRIx32 "\n", fds->revents);
-              nxsem_post(fds->sem);
-            }
-        }
-    }
+  poll_notify(conn->lc_event_fds, LOCAL_NPOLLWAITERS, eventset);
 #endif
 }
 
@@ -215,13 +199,13 @@ int local_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
                 }
             }
 
-          shadowfds[0].fd     = 1; /* Does not matter */
-          shadowfds[0].sem    = fds->sem;
-          shadowfds[0].events = fds->events & ~POLLOUT;
+          shadowfds[0]         = *fds;
+          shadowfds[0].fd      = 1; /* Does not matter */
+          shadowfds[0].events &= ~POLLOUT;
 
-          shadowfds[1].fd     = 0; /* Does not matter */
-          shadowfds[1].sem    = fds->sem;
-          shadowfds[1].events = fds->events & ~POLLIN;
+          shadowfds[1]         = *fds;
+          shadowfds[1].fd      = 0; /* Does not matter */
+          shadowfds[1].events &= ~POLLIN;
 
           net_unlock();
 
@@ -288,8 +272,7 @@ int local_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
 
 #ifdef CONFIG_NET_LOCAL_STREAM
 pollerr:
-  fds->revents |= POLLERR;
-  nxsem_post(fds->sem);
+  poll_notify(&fds, 1, POLLERR);
   return OK;
 #endif
 }
diff --git a/net/netlink/netlink.h b/net/netlink/netlink.h
index 1d12abf70f..1b734c770f 100644
--- a/net/netlink/netlink.h
+++ b/net/netlink/netlink.h
@@ -73,8 +73,7 @@ struct netlink_conn_s
   /* poll() support */
 
   int key;                           /* used to cancel notifications */
-  FAR sem_t *pollsem;                /* Used to wakeup poll() */
-  FAR pollevent_t *pollevent;        /* poll() wakeup event */
+  FAR struct pollfd *fds;            /* Used to wakeup poll() */
 
   /* Queued response data */
 
diff --git a/net/netlink/netlink_sockif.c b/net/netlink/netlink_sockif.c
index d0a6c4f2eb..e3a77fc8f5 100644
--- a/net/netlink/netlink_sockif.c
+++ b/net/netlink/netlink_sockif.c
@@ -516,12 +516,11 @@ static void netlink_response_available(FAR void *arg)
   sched_lock();
   net_lock();
 
-  if (conn->pollsem != NULL && conn->pollevent != NULL)
+  if (conn->fds != NULL)
     {
       /* Wake up the poll() with POLLIN */
 
-       *conn->pollevent |= POLLIN;
-       nxsem_post(conn->pollsem);
+      poll_notify(&conn->fds, 1, POLLIN);
     }
   else
     {
@@ -530,8 +529,7 @@ static void netlink_response_available(FAR void *arg)
 
   /* Allow another poll() */
 
-  conn->pollsem   = NULL;
-  conn->pollevent = NULL;
+  conn->fds = NULL;
 
   net_unlock();
   sched_unlock();
@@ -591,11 +589,9 @@ static int netlink_poll(FAR struct socket *psock, FAR struct pollfd *fds,
        * requested event set.
        */
 
-      revents &= fds->events;
-      if (revents != 0)
+      poll_notify(&fds, 1, revents);
+      if (fds->revents != 0)
         {
-          fds->revents = revents;
-          nxsem_post(fds->sem);
           net_unlock();
           return OK;
         }
@@ -610,7 +606,7 @@ static int netlink_poll(FAR struct socket *psock, FAR struct pollfd *fds,
            * on the Netlink connection.
            */
 
-          if (conn->pollsem != NULL || conn->pollevent != NULL)
+          if (conn->fds != NULL)
             {
               nerr("ERROR: Multiple polls() on socket not supported.\n");
               net_unlock();
@@ -619,16 +615,14 @@ static int netlink_poll(FAR struct socket *psock, FAR struct pollfd *fds,
 
           /* Set up the notification */
 
-          conn->pollsem    = fds->sem;
-          conn->pollevent  = &fds->revents;
+          conn->fds = fds;
 
           ret = netlink_notifier_setup(netlink_response_available,
                                        conn, conn);
           if (ret < 0)
             {
               nerr("ERROR: netlink_notifier_setup() failed: %d\n", ret);
-              conn->pollsem   = NULL;
-              conn->pollevent = NULL;
+              conn->fds = NULL;
             }
         }
 
@@ -639,8 +633,7 @@ static int netlink_poll(FAR struct socket *psock, FAR struct pollfd *fds,
       /* Cancel any response notifications */
 
       netlink_notifier_teardown(conn);
-      conn->pollsem   = NULL;
-      conn->pollevent = NULL;
+      conn->fds = NULL;
     }
 
   return ret;
diff --git a/net/rpmsg/rpmsg_sockif.c b/net/rpmsg/rpmsg_sockif.c
index da861f03c0..6d40d90e1c 100644
--- a/net/rpmsg/rpmsg_sockif.c
+++ b/net/rpmsg/rpmsg_sockif.c
@@ -205,27 +205,6 @@ static inline void rpmsg_socket_post(FAR sem_t *sem)
     }
 }
 
-static void rpmsg_socket_pollnotify(FAR struct rpmsg_socket_conn_s *conn,
-                                    pollevent_t eventset)
-{
-  int i;
-
-  for (i = 0; i < CONFIG_NET_RPMSG_NPOLLWAITERS; i++)
-    {
-      FAR struct pollfd *fds = conn->fds[i];
-
-      if (fds)
-        {
-          fds->revents |= ((fds->events | POLLERR | POLLHUP) & eventset);
-
-          if (fds->revents != 0)
-            {
-              rpmsg_socket_post(fds->sem);
-            }
-        }
-    }
-}
-
 static FAR struct rpmsg_socket_conn_s *rpmsg_socket_alloc(void)
 {
   FAR struct rpmsg_socket_conn_s *conn;
@@ -314,7 +293,7 @@ static int rpmsg_socket_ept_cb(FAR struct rpmsg_endpoint *ept,
         }
 
       rpmsg_socket_post(&conn->sendsem);
-      rpmsg_socket_pollnotify(conn, POLLOUT);
+      poll_notify(conn->fds, CONFIG_NET_RPMSG_NPOLLWAITERS, POLLOUT);
       rpmsg_socket_unlock(&conn->recvlock);
     }
   else
@@ -329,7 +308,7 @@ static int rpmsg_socket_ept_cb(FAR struct rpmsg_endpoint *ept,
       if (rpmsg_socket_get_space(conn) > 0)
         {
           rpmsg_socket_post(&conn->sendsem);
-          rpmsg_socket_pollnotify(conn, POLLOUT);
+          poll_notify(conn->fds, CONFIG_NET_RPMSG_NPOLLWAITERS, POLLOUT);
         }
 
       rpmsg_socket_unlock(&conn->sendlock);
@@ -379,7 +358,7 @@ static int rpmsg_socket_ept_cb(FAR struct rpmsg_endpoint *ept,
                   nerr("circbuf_write overflow, %zu, %zu\n", written, len);
                 }
 
-              rpmsg_socket_pollnotify(conn, POLLIN);
+              poll_notify(conn->fds, CONFIG_NET_RPMSG_NPOLLWAITERS, POLLIN);
             }
 
           rpmsg_socket_unlock(&conn->recvlock);
@@ -411,7 +390,8 @@ static inline void rpmsg_socket_destroy_ept(
       rpmsg_destroy_ept(&conn->ept);
       rpmsg_socket_post(&conn->sendsem);
       rpmsg_socket_post(&conn->recvsem);
-      rpmsg_socket_pollnotify(conn, POLLIN | POLLOUT);
+      poll_notify(conn->fds, CONFIG_NET_RPMSG_NPOLLWAITERS,
+                  POLLIN | POLLOUT);
     }
 
   rpmsg_socket_unlock(&conn->recvlock);
@@ -553,7 +533,7 @@ static void rpmsg_socket_ns_bind(FAR struct rpmsg_device *rdev,
   rpmsg_socket_ns_bound(&new->ept);
 
   rpmsg_socket_post(&server->recvsem);
-  rpmsg_socket_pollnotify(server, POLLIN);
+  poll_notify(server->fds, CONFIG_NET_RPMSG_NPOLLWAITERS, POLLIN);
 }
 
 static int rpmsg_socket_getaddr(FAR struct rpmsg_socket_conn_s *conn,
@@ -868,7 +848,7 @@ static int rpmsg_socket_poll(FAR struct socket *psock,
 
           if (conn->next)
             {
-              eventset |= (fds->events & POLLIN);
+              eventset |= POLLIN;
             }
         }
       else if (_SS_ISCONNECTED(conn->sconn.s_flags))
@@ -883,7 +863,7 @@ static int rpmsg_socket_poll(FAR struct socket *psock,
 
               if (rpmsg_socket_get_space(conn) > 0)
                 {
-                  eventset |= (fds->events & POLLOUT);
+                  eventset |= POLLOUT;
                 }
 
               rpmsg_socket_unlock(&conn->sendlock);
@@ -892,7 +872,7 @@ static int rpmsg_socket_poll(FAR struct socket *psock,
 
               if (!circbuf_is_empty(&conn->recvbuf))
                 {
-                  eventset |= (fds->events & POLLIN);
+                  eventset |= POLLIN;
                 }
 
               rpmsg_socket_unlock(&conn->recvlock);
@@ -908,10 +888,7 @@ static int rpmsg_socket_poll(FAR struct socket *psock,
           eventset |= POLLERR;
         }
 
-      if (eventset)
-        {
-          rpmsg_socket_pollnotify(conn, eventset);
-        }
+      poll_notify(conn->fds, CONFIG_NET_RPMSG_NPOLLWAITERS, eventset);
     }
   else if (fds->priv != NULL)
     {
diff --git a/net/tcp/tcp_netpoll.c b/net/tcp/tcp_netpoll.c
index 6f35b11188..afd65c229d 100644
--- a/net/tcp/tcp_netpoll.c
+++ b/net/tcp/tcp_netpoll.c
@@ -83,14 +83,14 @@ static uint16_t tcp_poll_eventhandler(FAR struct net_driver_s *dev,
 
       if ((flags & (TCP_NEWDATA | TCP_BACKLOG)) != 0)
         {
-          eventset |= POLLIN & info->fds->events;
+          eventset |= POLLIN;
         }
 
       /* Non-blocking connection */
 
       if ((flags & TCP_CONNECTED) != 0)
         {
-          eventset |= POLLOUT & info->fds->events;
+          eventset |= POLLOUT;
         }
 
       /* Check for a loss of connection events. */
@@ -154,21 +154,20 @@ static uint16_t tcp_poll_eventhandler(FAR struct net_driver_s *dev,
 #endif
               )
         {
-          eventset |= (POLLOUT & info->fds->events);
+          eventset |= POLLOUT;
         }
 
       /* Awaken the caller of poll() if requested event occurred. */
 
-      if (eventset != 0)
+      poll_notify(&info->fds, 1, eventset);
+
+      if (info->fds->revents != 0)
         {
           /* Stop further callbacks */
 
           info->cb->flags   = 0;
           info->cb->priv    = NULL;
           info->cb->event   = NULL;
-
-          info->fds->revents |= eventset;
-          nxsem_post(info->fds->sem);
         }
     }
 
@@ -200,6 +199,7 @@ int tcp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
   FAR struct tcp_conn_s *conn;
   FAR struct tcp_poll_s *info;
   FAR struct devif_callback_s *cb;
+  pollevent_t eventset = 0;
   bool nonblock_conn;
   int ret = OK;
 
@@ -291,7 +291,7 @@ int tcp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
     {
       /* Normal data may be read without blocking. */
 
-      fds->revents |= (POLLRDNORM & fds->events);
+      eventset |= POLLRDNORM;
     }
 
   /* Check for a loss of connection events.  We need to be careful here.
@@ -342,22 +342,17 @@ int tcp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
        * exceptional event.
        */
 
-      fds->revents |= (POLLERR | POLLHUP);
+      eventset |= POLLERR | POLLHUP;
     }
   else if (_SS_ISCONNECTED(conn->sconn.s_flags) &&
            psock_tcp_cansend(conn) >= 0)
     {
-      fds->revents |= (POLLWRNORM & fds->events);
+      eventset |= POLLWRNORM;
     }
 
   /* Check if any requested events are already in effect */
 
-  if (fds->revents != 0)
-    {
-      /* Yes.. then signal the poll logic */
-
-      nxsem_post(fds->sem);
-    }
+  poll_notify(&fds, 1, eventset);
 
 errout_with_lock:
   net_unlock();
diff --git a/net/udp/udp_netpoll.c b/net/udp/udp_netpoll.c
index c907f2dd29..e3e2c563c3 100644
--- a/net/udp/udp_netpoll.c
+++ b/net/udp/udp_netpoll.c
@@ -80,7 +80,7 @@ static uint16_t udp_poll_eventhandler(FAR struct net_driver_s *dev,
 
       if ((flags & UDP_NEWDATA) != 0)
         {
-          eventset |= (POLLIN & info->fds->events);
+          eventset |= POLLIN;
         }
 
       /* Check for loss of connection events. */
@@ -94,16 +94,12 @@ static uint16_t udp_poll_eventhandler(FAR struct net_driver_s *dev,
 
       else if (psock_udp_cansend(info->conn) >= 0)
         {
-          eventset |= (POLLOUT & info->fds->events);
+          eventset |= POLLOUT;
         }
 
       /* Awaken the caller of poll() is requested event occurred. */
 
-      if (eventset)
-        {
-          info->fds->revents |= eventset;
-          nxsem_post(info->fds->sem);
-        }
+      poll_notify(&info->fds, 1, eventset);
     }
 
   return flags;
@@ -134,6 +130,7 @@ int udp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
   FAR struct udp_conn_s *conn;
   FAR struct udp_poll_s *info;
   FAR struct devif_callback_s *cb;
+  pollevent_t eventset = 0;
   int ret = OK;
 
   /* Some of the following must be atomic */
@@ -215,24 +212,19 @@ int udp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
     {
       /* Normal data may be read without blocking. */
 
-      fds->revents |= (POLLRDNORM & fds->events);
+      eventset |= POLLRDNORM;
     }
 
   if (psock_udp_cansend(conn) >= 0)
     {
       /* Normal data may be sent without blocking (at least one byte). */
 
-      fds->revents |= (POLLWRNORM & fds->events);
+      eventset |= POLLWRNORM;
     }
 
   /* Check if any requested events are already in effect */
 
-  if (fds->revents != 0)
-    {
-      /* Yes.. then signal the poll logic */
-
-      nxsem_post(fds->sem);
-    }
+  poll_notify(&fds, 1, eventset);
 
 errout_with_lock:
   net_unlock();
diff --git a/net/usrsock/usrsock_poll.c b/net/usrsock/usrsock_poll.c
index 9184b27f6a..8fe11d8b22 100644
--- a/net/usrsock/usrsock_poll.c
+++ b/net/usrsock/usrsock_poll.c
@@ -102,24 +102,7 @@ static uint16_t poll_event(FAR struct net_driver_s *dev,
         }
     }
 
-  /* Filter I/O events depending on requested events. */
-
-  eventset &= (~(POLLOUT | POLLIN) | info->fds->events);
-
-  /* POLLOUT and PULLHUP are mutually exclusive. */
-
-  if ((eventset & POLLOUT) && (eventset & POLLHUP))
-    {
-      eventset &= ~POLLOUT;
-    }
-
-  /* Awaken the caller of poll() is requested event occurred. */
-
-  if (eventset)
-    {
-      info->fds->revents |= eventset;
-      nxsem_post(info->fds->sem);
-    }
+  poll_notify(&info->fds, 1, eventset);
 
   return flags;
 }
@@ -145,6 +128,7 @@ static int usrsock_pollsetup(FAR struct socket *psock,
   FAR struct usrsock_conn_s *conn = psock->s_conn;
   FAR struct usrsock_poll_s *info;
   FAR struct devif_callback_s *cb;
+  pollevent_t eventset = 0;
   int ret = OK;
 
   /* Sanity check */
@@ -211,7 +195,7 @@ static int usrsock_pollsetup(FAR struct socket *psock,
             conn->state == USRSOCK_CONN_STATE_UNINITIALIZED ?
                 "uninitialized" : "aborted");
 
-      fds->revents |= (POLLERR | POLLHUP);
+      eventset |= (POLLERR | POLLHUP);
     }
 
   /* Stream sockets need to be connected or connecting (or listening). */
@@ -223,7 +207,7 @@ static int usrsock_pollsetup(FAR struct socket *psock,
     {
       ninfo("stream socket not connected and not connecting.\n");
 
-      fds->revents |= (POLLOUT | POLLIN | POLLHUP);
+      eventset |= (POLLOUT | POLLIN | POLLHUP);
     }
   else if (conn->flags & USRSOCK_EVENT_REMOTE_CLOSED)
     {
@@ -231,7 +215,7 @@ static int usrsock_pollsetup(FAR struct socket *psock,
 
       /* Remote closed. */
 
-      fds->revents |= (POLLHUP | POLLIN);
+      eventset |= (POLLHUP | POLLIN);
     }
   else
     {
@@ -241,36 +225,20 @@ static int usrsock_pollsetup(FAR struct socket *psock,
         {
           ninfo("socket send ready.\n");
 
-          fds->revents |= POLLOUT;
+          eventset |= POLLOUT;
         }
 
       if (conn->flags & USRSOCK_EVENT_RECVFROM_AVAIL)
         {
           ninfo("socket recv avail.\n");
 
-          fds->revents |= POLLIN;
+          eventset |= POLLIN;
         }
     }
 
-  /* Filter I/O events depending on requested events. */
-
-  fds->revents &= (~(POLLOUT | POLLIN) | info->fds->events);
-
-  /* POLLOUT and PULLHUP are mutually exclusive. */
-
-  if ((fds->revents & POLLOUT) && (fds->revents & POLLHUP))
-    {
-      fds->revents &= ~POLLOUT;
-    }
-
   /* Check if any requested events are already in effect */
 
-  if (fds->revents != 0)
-    {
-      /* Yes.. then signal the poll logic */
-
-      nxsem_post(fds->sem);
-    }
+  poll_notify(&fds, 1, eventset);
 
 errout_unlock:
   net_unlock();