poll: pollsetup should notify only one fd passd by caller

since it's redundant to iterate the whole fds array in setup

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-11-19 19:19:53 +08:00 committed by Alin Jerpelea
parent 11b3adf17f
commit eddd90de78
84 changed files with 373 additions and 396 deletions

View File

@ -3097,7 +3097,7 @@ static int cxd56_gnss_poll(struct file *filep, struct pollfd *fds,
if (priv->has_event)
{
cxd56_gnss_pollnotify(priv);
poll_notify(&fds, 1, POLLIN);
}
}
else if (fds->priv)

View File

@ -1194,7 +1194,7 @@ static int sam_tsd_poll(struct file *filep, struct pollfd *fds, bool setup)
if (priv->penchange)
{
sam_tsd_notify(priv);
poll_notify(&fds, 1, POLLIN);
}
}
else if (fds->priv)

View File

@ -2037,7 +2037,7 @@ static int cxd5610_gnss_poll(struct file *filep, struct pollfd *fds,
if (priv->has_event)
{
cxd5610_gnss_pollnotify(priv);
poll_notify(&fds, 1, POLLIN);
}
}
else if (fds->priv)

View File

@ -1406,7 +1406,7 @@ static int tc_poll(struct file *filep, struct pollfd *fds, bool setup)
if (priv->penchange)
{
tc_notify(priv);
poll_notify(&fds, 1, POLLIN);
}
}
else if (fds->priv)

View File

@ -1283,7 +1283,7 @@ static int tc_poll(struct file *filep, struct pollfd *fds, bool setup)
if (priv->penchange)
{
tc_notify(priv);
poll_notify(&fds, 1, POLLIN);
}
}
else if (fds->priv)

View File

@ -576,7 +576,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)
{
poll_notify(dev->fds, CONFIG_ADC_NPOLLWAITERS, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
}
else if (fds->priv)

View File

@ -1199,7 +1199,7 @@ static int can_poll(FAR struct file *filep, FAR struct pollfd *fds,
}
}
poll_notify(dev->cd_fds, CONFIG_CAN_NPOLLWAITERS, eventset);
poll_notify(&fds, 1, eventset);
}
else if (fds->priv != NULL)
{

View File

@ -1043,7 +1043,7 @@ static int ads7843e_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->penchange)
{
ads7843e_notify(priv);
poll_notify(&fds, 1, POLLIN);
}
}
else if (fds->priv)

View File

@ -1034,9 +1034,7 @@ static int mbr3108_poll(FAR struct file *filep, FAR struct pollfd *fds,
pending = priv->int_pending;
if (pending)
{
poll_notify(priv->fds,
CONFIG_INPUT_CYPRESS_MBR3108_NPOLLWAITERS,
POLLIN);
poll_notify(&fds, 1, POLLIN);
}
}
}

View File

@ -1022,7 +1022,7 @@ static int ft5x06_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->valid)
{
ft5x06_notify(priv);
poll_notify(&fds, 1, POLLIN);
}
}
else if (fds->priv)

View File

@ -813,9 +813,7 @@ static int gt9xx_poll(FAR struct file *filep, FAR struct pollfd *fds,
pending = priv->int_pending;
if (pending)
{
poll_notify(priv->fds,
CONFIG_INPUT_GT9XX_NPOLLWAITERS,
POLLIN);
poll_notify(&fds, 1, POLLIN);
}
}
}

View File

@ -276,7 +276,7 @@ static int keyboard_poll(FAR struct file *filep,
if (!circbuf_is_empty(&opriv->circ))
{
poll_notify(&opriv->fds, 1, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
}
else

View File

@ -1036,7 +1036,7 @@ static int max11802_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->penchange)
{
max11802_notify(priv);
poll_notify(&fds, 1, POLLIN);
}
}
else if (fds->priv)

View File

@ -218,7 +218,8 @@ out:
* Name: mouse_poll
****************************************************************************/
static int mouse_poll(FAR struct file *filep, struct pollfd *fds, bool setup)
static int mouse_poll(FAR struct file *filep,
FAR struct pollfd *fds, bool setup)
{
FAR struct mouse_openpriv_s *openpriv = filep->f_priv;
pollevent_t eventset = 0;
@ -248,7 +249,7 @@ static int mouse_poll(FAR struct file *filep, struct pollfd *fds, bool setup)
eventset |= POLLIN;
}
poll_notify(&openpriv->fds, 1, eventset);
poll_notify(&fds, 1, eventset);
}
else if (fds->priv)
{

View File

@ -1573,7 +1573,7 @@ static int mxt_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->event)
{
mxt_notify(priv);
poll_notify(&fds, 1, POLLIN);
}
}
else if (fds->priv)

View File

@ -651,7 +651,7 @@ static int spq10kbd_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->headndx != priv->tailndx)
{
poll_notify(priv->fds, CONFIG_SPQ10KBD_NPOLLWAITERS, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
}
else

View File

@ -686,7 +686,7 @@ static int stmpe811_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->penchange)
{
stmpe811_notify(priv);
poll_notify(&fds, 1, POLLIN);
}
}
else if (fds->priv)

View File

@ -308,7 +308,7 @@ static int touch_poll(FAR struct file *filep, struct pollfd *fds, bool setup)
eventset |= POLLIN;
}
poll_notify(&openpriv->fds, 1, eventset);
poll_notify(&fds, 1, eventset);
}
else if (fds->priv)
{

View File

@ -1129,7 +1129,7 @@ static int tsc2007_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->penchange)
{
tsc2007_notify(priv);
poll_notify(&fds, 1, POLLIN);
}
}
else if (fds->priv)

View File

@ -144,7 +144,7 @@ int ipcc_poll(FAR struct file *filep, FAR struct pollfd *fds,
}
#endif
poll_notify(priv->fds, CONFIG_IPCC_NPOLLWAITERS, eventset);
poll_notify(&fds, 1, eventset);
nxmutex_unlock(&priv->lock);
return OK;

View File

@ -129,7 +129,8 @@ static int tda19988_fetch_edid_block(FAR struct tda1988_dev_s *priv,
FAR uint8_t *buf, int block);
static int tda19988_fetch_edid(struct tda1988_dev_s *priv);
static ssize_t tda19988_read_internal(FAR struct tda1988_dev_s *priv,
off_t offset, FAR uint8_t *buffer, size_t buflen);
off_t offset, FAR uint8_t *buffer,
size_t buflen);
/* Character driver methods */

View File

@ -246,11 +246,6 @@ static void tun_pollnotify(FAR struct tun_device_s *priv,
nxsem_post(&priv->write_wait_sem);
}
if (fds == NULL)
{
return;
}
poll_notify(&fds, 1, eventset);
}
@ -1186,7 +1181,7 @@ static int tun_poll(FAR struct file *filep,
eventset |= POLLIN;
}
tun_pollnotify(priv, eventset);
poll_notify(&fds, 1, eventset);
}
else
{

View File

@ -741,7 +741,7 @@ int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds,
eventset |= POLLERR;
}
poll_notify(dev->d_fds, CONFIG_DEV_PIPE_NPOLLWAITERS, eventset);
poll_notify(&fds, 1, eventset);
}
else
{

View File

@ -103,15 +103,10 @@ static const struct file_operations g_batteryops =
static int battery_charger_notify(FAR struct battery_charger_priv_s *priv,
uint32_t mask)
{
FAR struct pollfd *fd = priv->fds;
FAR struct pollfd *fds = priv->fds;
int semcnt;
int ret;
if (!fd)
{
return OK;
}
ret = nxmutex_lock(&priv->lock);
if (ret < 0)
{
@ -121,7 +116,7 @@ static int battery_charger_notify(FAR struct battery_charger_priv_s *priv,
priv->mask |= mask;
if (priv->mask)
{
poll_notify(&fd, 1, POLLIN);
poll_notify(&fds, 1, POLLIN);
nxsem_get_value(&priv->wait, &semcnt);
if (semcnt < 1)
@ -433,6 +428,10 @@ static int bat_charger_poll(FAR struct file *filep,
{
priv->fds = fds;
fds->priv = &priv->fds;
if (priv->mask)
{
poll_notify(&fds, 1, POLLIN);
}
}
else
{
@ -446,12 +445,6 @@ static int bat_charger_poll(FAR struct file *filep,
}
nxmutex_unlock(&priv->lock);
if (setup)
{
battery_charger_notify(priv, 0);
}
return ret;
}

View File

@ -105,15 +105,10 @@ static const struct file_operations g_batteryops =
static int battery_gauge_notify(FAR struct battery_gauge_priv_s *priv,
uint32_t mask)
{
FAR struct pollfd *fd = priv->fds;
FAR struct pollfd *fds = priv->fds;
int semcnt;
int ret;
if (!fd)
{
return OK;
}
ret = nxmutex_lock(&priv->lock);
if (ret < 0)
{
@ -123,7 +118,7 @@ static int battery_gauge_notify(FAR struct battery_gauge_priv_s *priv,
priv->mask |= mask;
if (priv->mask)
{
poll_notify(&fd, 1, POLLIN);
poll_notify(&fds, 1, POLLIN);
nxsem_get_value(&priv->wait, &semcnt);
if (semcnt < 1)
@ -391,6 +386,10 @@ static int bat_gauge_poll(FAR struct file *filep,
{
priv->fds = fds;
fds->priv = &priv->fds;
if (priv->mask)
{
poll_notify(&fds, 1, POLLIN);
}
}
else
{
@ -404,12 +403,6 @@ static int bat_gauge_poll(FAR struct file *filep,
}
nxmutex_unlock(&priv->lock);
if (setup)
{
battery_gauge_notify(priv, 0);
}
return ret;
}

View File

@ -104,15 +104,10 @@ static const struct file_operations g_batteryops =
static int battery_monitor_notify(FAR struct battery_monitor_priv_s *priv,
uint32_t mask)
{
FAR struct pollfd *fd = priv->fds;
FAR struct pollfd *fds = priv->fds;
int semcnt;
int ret;
if (!fd)
{
return OK;
}
ret = nxmutex_lock(&priv->lock);
if (ret < 0)
{
@ -122,7 +117,7 @@ static int battery_monitor_notify(FAR struct battery_monitor_priv_s *priv,
priv->mask |= mask;
if (priv->mask)
{
poll_notify(&fd, 1, POLLIN);
poll_notify(&fds, 1, POLLIN);
nxsem_get_value(&priv->wait, &semcnt);
if (semcnt < 1)
@ -470,6 +465,10 @@ static int bat_monitor_poll(FAR struct file *filep,
{
priv->fds = fds;
fds->priv = &priv->fds;
if (priv->mask)
{
poll_notify(&fds, 1, POLLIN);
}
}
else
{
@ -483,12 +482,6 @@ static int bat_monitor_poll(FAR struct file *filep,
}
nxmutex_unlock(&priv->lock);
if (setup)
{
battery_monitor_notify(priv, 0);
}
return ret;
}

View File

@ -67,7 +67,7 @@ struct lirc_fh_s
struct list_node node; /* list of open file handles */
FAR struct lirc_lowerhalf_s *lower; /* the pointer to lirc_lowerhalf_s */
struct circbuf_s buffer; /* buffer for incoming IR */
FAR struct pollfd *fd; /* poll structures of threads waiting for driver events */
FAR struct pollfd *fds; /* poll structures of threads waiting for driver events */
sem_t waitsem; /* sem of wait buffer for ready */
int carrier_low; /* when setting the carrier range, first the low end must be
* set with an ioctl and then the high end with another ioctl
@ -216,21 +216,21 @@ static int lirc_poll(FAR struct file *filep,
flags = enter_critical_section();
if (setup)
{
if (fh->fd)
if (fh->fds)
{
ret = -EBUSY;
goto errout;
}
fh->fd = fds;
fds->priv = &fh->fd;
fh->fds = fds;
fds->priv = &fh->fds;
if (!circbuf_is_empty(&fh->buffer))
{
eventset |= POLLIN | POLLRDNORM;
}
poll_notify(&fh->fd, 1, eventset);
poll_notify(&fds, 1, eventset);
}
else if (fds->priv != NULL)
{
@ -914,7 +914,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)
{
poll_notify(&fh->fd, 1, POLLIN | POLLRDNORM);
poll_notify(&fh->fds, 1, POLLIN | POLLRDNORM);
nxsem_get_value(&fh->waitsem, &semcount);
if (semcount < 1)
{
@ -944,7 +944,7 @@ void lirc_raw_event(FAR struct lirc_lowerhalf_s *lower,
if (circbuf_write(&fh->buffer, &sample, sizeof(unsigned int)) > 0)
{
poll_notify(&fh->fd, 1, POLLIN | POLLRDNORM);
poll_notify(&fh->fds, 1, POLLIN | POLLRDNORM);
nxsem_get_value(&fh->waitsem, &semcount);
if (semcount < 1)
{
@ -988,7 +988,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)
{
poll_notify(&fh->fd, 1, POLLIN | POLLRDNORM);
poll_notify(&fh->fds, 1, POLLIN | POLLRDNORM);
nxsem_get_value(&fh->waitsem, &semcount);
if (semcount < 1)
{
@ -1034,7 +1034,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)
{
poll_notify(&fh->fd, 1, POLLIN | POLLRDNORM);
poll_notify(&fh->fds, 1, POLLIN | POLLRDNORM);
nxsem_get_value(&fh->waitsem, &semcount);
if (semcount < 1)
{

View File

@ -386,7 +386,7 @@ static int gps_poll(FAR struct file *filep, FAR struct pollfd *fds,
fds->priv = filep;
if (upper->buffer.head > user->pos)
{
poll_notify(&user->fds, 1, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
}
else if (user->fds)

View File

@ -332,7 +332,7 @@ static int hcsr04_poll(FAR struct file *filep, FAR struct pollfd *fds,
flags = enter_critical_section();
if (hcsr04_sample(priv))
{
poll_notify(priv->fds, CONFIG_HCSR04_NPOLLWAITERS, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
leave_critical_section(flags);

View File

@ -1115,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))
{
poll_notify(priv->fds, CONFIG_HTS221_NPOLLWAITERS, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
leave_critical_section(flags);

View File

@ -112,9 +112,11 @@ static ssize_t lis2dh_write(FAR struct file *filep,
static int lis2dh_ioctl(FAR struct file *filep, int cmd,
unsigned long arg);
static int lis2dh_access(FAR struct lis2dh_dev_s *dev,
uint8_t subaddr, FAR uint8_t *buf, int length);
uint8_t subaddr, FAR uint8_t *buf,
int length);
static int lis2dh_get_reading(FAR struct lis2dh_dev_s *dev,
FAR struct lis2dh_vector_s *res, bool force_read);
FAR struct lis2dh_vector_s *res,
bool force_read);
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,
@ -713,7 +715,7 @@ static int lis2dh_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->int_pending)
{
poll_notify(priv->fds, CONFIG_LIS2DH_NPOLLWAITERS, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
}
else if (fds->priv)

View File

@ -828,7 +828,8 @@ static int max44009_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->int_pending)
{
max44009_notify(priv);
poll_notify(&fds, 1, POLLIN);
priv->int_pending = false;
}
}
else if (fds->priv)

View File

@ -936,7 +936,7 @@ static int sensor_poll(FAR struct file *filep,
eventset |= POLLPRI;
}
sensor_pollnotify_one(user, eventset);
poll_notify(&fds, 1, eventset);
}
else
{

View File

@ -1678,7 +1678,7 @@ static int uart_poll(FAR struct file *filep,
}
#endif
poll_notify(dev->fds, CONFIG_SERIAL_NPOLLWAITERS, eventset);
poll_notify(&fds, 1, eventset);
}
else if (fds->priv != NULL)
{

View File

@ -388,7 +388,7 @@ static int uart_bth4_poll(FAR struct file *filep, FAR struct pollfd *fds,
eventset |= POLLOUT;
uart_bth4_pollnotify(dev, eventset);
poll_notify(&fds, 1, eventset);
}
else if (fds->priv != NULL)
{

View File

@ -1209,7 +1209,7 @@ uart_bth5_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
nxmutex_unlock(&dev->recvlock);
eventset |= POLLOUT;
uart_bth5_pollnotify(dev, eventset);
poll_notify(&fds, 1, eventset);
}
else if (fds->priv != NULL)
{

View File

@ -490,7 +490,7 @@ static int spi_slave_poll(FAR struct file *filep, FAR struct pollfd *fds,
eventset |= POLLOUT;
}
poll_notify(&priv->fds, 1, eventset);
poll_notify(&fds, 1, eventset);
}
else if (fds->priv != NULL)
{

View File

@ -204,17 +204,13 @@ static void ramlog_pollnotify(FAR struct ramlog_dev_s *priv,
pollevent_t eventset)
{
irqstate_t flags;
int i;
/* This function may be called from an interrupt handler */
for (i = 0; i < CONFIG_RAMLOG_NPOLLWAITERS; i++)
{
flags = enter_critical_section();
poll_notify(&priv->rl_fds[i], 1, eventset);
poll_notify(priv->rl_fds, CONFIG_RAMLOG_NPOLLWAITERS, eventset);
leave_critical_section(flags);
}
}
/****************************************************************************
* Name: ramlog_initbuf
@ -741,7 +737,7 @@ static int ramlog_file_poll(FAR struct file *filep, FAR struct pollfd *fds,
leave_critical_section(flags);
ramlog_pollnotify(priv, eventset);
poll_notify(&fds, 1, eventset);
}
else if (fds->priv)
{

View File

@ -856,7 +856,7 @@ static int usbdev_fs_poll(FAR struct file *filep, FAR struct pollfd *fds,
}
}
poll_notify(fs_ep->fds, CONFIG_USBDEV_FS_NPOLLWAITERS, eventset);
poll_notify(&fds, 1, eventset);
exit_leave_critical:
leave_critical_section(flags);

View File

@ -583,8 +583,7 @@ static int cdcwdm_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->comm_rxlen > 0)
{
poll_notify(priv->fds, CONFIG_USBHOST_CDCMBIM_NPOLLWAITERS,
POLLIN);
poll_notify(&fds, 1, POLLIN);
}
}
else

View File

@ -277,7 +277,8 @@ static inline uint8_t usbhost_mapscancode(uint8_t scancode,
uint8_t modifier);
#ifdef CONFIG_HIDKBD_ENCODED
static inline void usbhost_encodescancode(FAR struct usbhost_state_s *priv,
uint8_t scancode, uint8_t modifier);
uint8_t scancode,
uint8_t modifier);
#endif
static int usbhost_kbdpoll(int argc, char *argv[]);
@ -298,7 +299,8 @@ static inline void usbhost_toggle_capslock(void);
/* Helpers for usbhost_connect() */
static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
FAR const uint8_t *configdesc, int desclen);
FAR const uint8_t *configdesc,
int desclen);
static inline int usbhost_devinit(FAR struct usbhost_state_s *priv);
/* (Little Endian) Data helpers */
@ -318,8 +320,8 @@ static int usbhost_crfree(FAR struct usbhost_state_s *priv);
/* struct usbhost_registry_s methods */
static FAR struct usbhost_class_s *usbhost_create(
FAR struct usbhost_hubport_s *hport,
static FAR struct usbhost_class_s *
usbhost_create(FAR struct usbhost_hubport_s *hport,
FAR const struct usbhost_id_s *id);
/* struct usbhost_class_s methods */
@ -2843,7 +2845,7 @@ static int usbhost_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->headndx != priv->tailndx)
{
poll_notify(priv->fds, CONFIG_HIDKBD_NPOLLWAITERS, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
}
else

View File

@ -2389,7 +2389,7 @@ static int usbhost_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->valid)
{
poll_notify(priv->fds, CONFIG_HIDMOUSE_NPOLLWAITERS, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
}
else

View File

@ -2150,7 +2150,7 @@ static int usbhost_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->valid)
{
usbhost_pollnotify(priv);
poll_notify(&fds, 1, POLLIN);
}
}
else

View File

@ -705,7 +705,7 @@ static int fusb301_poll(FAR struct file *filep,
flags = enter_critical_section();
if (priv->int_pending)
{
poll_notify(priv->fds, CONFIG_FUSB301_NPOLLWAITERS, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
leave_critical_section(flags);

View File

@ -456,6 +456,7 @@ void enableccmeas(FAR struct fusb302_dev_s *priv,
void set_switches(FAR struct fusb302_dev_s *priv,
uint8_t toggsval);
static int set_int_mask(struct fusb302_dev_s *priv);
/****************************************************************************
* Private Data
****************************************************************************/

View File

@ -893,7 +893,7 @@ static int fusb303_poll(FAR struct file *filep, FAR struct pollfd *fds,
flags = enter_critical_section();
if (priv->int_pending)
{
poll_notify(priv->fds, CONFIG_FUSB303_NPOLLWAITERS, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
leave_critical_section(flags);

View File

@ -77,17 +77,12 @@ struct usrsockdev_s
static ssize_t usrsockdev_read(FAR struct file *filep, FAR char *buffer,
size_t len);
static ssize_t usrsockdev_write(FAR struct file *filep,
FAR const char *buffer, size_t len);
static off_t usrsockdev_seek(FAR struct file *filep, off_t offset,
int whence);
static int usrsockdev_open(FAR struct file *filep);
static int usrsockdev_close(FAR struct file *filep);
static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup);
@ -395,7 +390,6 @@ static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
{
FAR struct inode *inode = filep->f_inode;
FAR struct usrsockdev_s *dev;
pollevent_t eventset;
int ret;
int i;
@ -447,18 +441,14 @@ static int usrsockdev_poll(FAR struct file *filep, FAR struct pollfd *fds,
/* Should immediately notify on any of the requested events? */
eventset = 0;
/* Notify the POLLIN event if pending request. */
if (dev->req.iov != NULL &&
!(usrsock_iovec_get(NULL, 0, dev->req.iov,
dev->req.iovcnt, dev->req.pos, NULL) < 0))
{
eventset |= POLLIN;
poll_notify(&fds, 1, POLLIN);
}
poll_notify(dev->pollfds, nitems(dev->pollfds), eventset);
}
else
{

View File

@ -1068,7 +1068,7 @@ static int fb_poll(FAR struct file *filep, struct pollfd *fds, bool setup)
panbuf = fb_get_panbuf(fb, priv->overlay);
if (!circbuf_is_full(panbuf))
{
poll_notify(pollfds, 1, POLLOUT);
poll_notify(&fds, 1, POLLOUT);
}
}
else if (fds->priv != NULL)
@ -1177,19 +1177,12 @@ static void fb_do_pollnotify(wdparm_t arg)
{
FAR struct fb_paninfo_s *paninfo = (FAR struct fb_paninfo_s *)arg;
irqstate_t flags;
int i;
flags = enter_critical_section();
for (i = 0; i < CONFIG_VIDEO_FB_NPOLLWAITERS; i++)
{
if (paninfo->fds[i] != NULL)
{
/* Notify framebuffer is writable. */
poll_notify(&paninfo->fds[i], 1, POLLOUT);
}
}
poll_notify(paninfo->fds, CONFIG_VIDEO_FB_NPOLLWAITERS, POLLOUT);
leave_critical_section(flags);
}

View File

@ -3280,7 +3280,7 @@ static int video_poll(FAR struct file *filep, struct pollfd *fds, bool setup)
fds->priv = &type_inf->fds;
if (!video_framebuff_is_empty(&type_inf->bufinf))
{
poll_notify(&type_inf->fds, 1, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
}
else

View File

@ -623,7 +623,7 @@ static int cc1101_file_poll(FAR struct file *filep, FAR struct pollfd *fds,
nxmutex_lock(&dev->lock_rx_buffer);
if (dev->fifo_len > 0)
{
poll_notify(&dev->pfd, 1, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
nxmutex_unlock(&dev->lock_rx_buffer);

View File

@ -3143,7 +3143,7 @@ static int gs2200m_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (0 < n)
{
poll_notify(&dev->pfd, 1, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
}
else

View File

@ -1220,7 +1220,7 @@ static int sx127x_poll(FAR struct file *filep, FAR struct pollfd *fds,
{
/* Data available for input */
poll_notify(&dev->pfd, 1, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
nxmutex_unlock(&dev->rx_buffer_lock);

View File

@ -1403,7 +1403,7 @@ static int nrf24l01_poll(FAR struct file *filep, FAR struct pollfd *fds,
nxmutex_lock(&dev->lock_fifo);
if (dev->fifo_len > 0)
{
poll_notify(&dev->pfd, 1, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
nxmutex_unlock(&dev->lock_fifo);

View File

@ -134,7 +134,7 @@ static int nxmq_file_poll(FAR struct file *filep,
eventset |= POLLIN;
}
nxmq_pollnotify(msgq, eventset);
poll_notify(&fds, 1, eventset);
}
else if (fds->priv != NULL)
{

View File

@ -489,7 +489,7 @@ static int eventfd_do_poll(FAR struct file *filep, FAR struct pollfd *fds,
eventset |= POLLIN;
}
poll_notify(dev->fds, CONFIG_EVENT_FD_NPOLLWAITERS, eventset);
poll_notify(&fds, 1, eventset);
out:
nxmutex_unlock(&dev->lock);

View File

@ -271,7 +271,7 @@ static int signalfd_file_poll(FAR struct file *filep,
sigandset(&mask, &mask, &dev->sigmask);
if (!sigisemptyset(&mask))
{
poll_notify(dev->fds, CONFIG_SIGNAL_FD_NPOLLWAITERS, POLLIN);
poll_notify(&fds, 1, POLLIN);
}
out:

View File

@ -370,7 +370,7 @@ static int timerfd_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (dev->counter > 0)
{
#ifdef CONFIG_TIMER_FD_POLL
poll_notify(dev->fds, CONFIG_TIMER_FD_NPOLLWAITERS, POLLIN);
poll_notify(&fds, 1, POLLIN);
#endif
}

View File

@ -175,7 +175,8 @@ extern const struct file_operations g_nxterm_drvrops;
/* Common device registration/un-registration */
FAR struct nxterm_state_s *nxterm_register(NXTERM handle,
FAR struct nxterm_state_s *
nxterm_register(NXTERM handle,
FAR struct nxterm_window_s *wndo,
FAR const struct nxterm_operations_s *ops,
int minor);

View File

@ -50,17 +50,13 @@ static void nxterm_pollnotify(FAR struct nxterm_state_s *priv,
pollevent_t eventset)
{
irqstate_t flags;
int i;
/* This function may be called from an interrupt handler */
for (i = 0; i < CONFIG_NXTERM_NPOLLWAITERS; i++)
{
flags = enter_critical_section();
poll_notify(&priv->fds[i], 1, eventset);
poll_notify(priv->fds, CONFIG_NXTERM_NPOLLWAITERS, eventset);
leave_critical_section(flags);
}
}
/****************************************************************************
* Public Functions
@ -287,7 +283,7 @@ int nxterm_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
eventset |= POLLIN;
}
nxterm_pollnotify(priv, eventset);
poll_notify(&fds, 1, eventset);
}
else if (fds->priv)
{

View File

@ -395,7 +395,7 @@ static int can_poll_local(FAR struct socket *psock, FAR struct pollfd *fds,
*/
cb->flags = NETDEV_DOWN;
cb->priv = (FAR void *)info;
cb->priv = info;
cb->event = can_poll_eventhandler;
if ((fds->events & POLLOUT) != 0)
@ -412,7 +412,7 @@ static int can_poll_local(FAR struct socket *psock, FAR struct pollfd *fds,
* for use during poll teardown as well.
*/
fds->priv = (FAR void *)info;
fds->priv = info;
/* Check for read data availability now */

View File

@ -190,7 +190,7 @@ int icmp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
*/
cb->flags = NETDEV_DOWN;
cb->priv = (FAR void *)info;
cb->priv = info;
cb->event = icmp_poll_eventhandler;
if ((fds->events & POLLIN) != 0)
@ -202,7 +202,7 @@ int icmp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
* for use during poll teardown as well.
*/
fds->priv = (FAR void *)info;
fds->priv = info;
/* Check for read data availability now */

View File

@ -54,9 +54,11 @@ static int icmp_netpoll(FAR struct socket *psock,
static int icmp_close(FAR struct socket *psock);
#ifdef CONFIG_NET_SOCKOPTS
static int icmp_getsockopt(FAR struct socket *psock, int level,
int option, FAR void *value, FAR socklen_t *value_len);
int option, FAR void *value,
FAR socklen_t *value_len);
static int icmp_setsockopt(FAR struct socket *psock, int level,
int option, FAR const void *value, socklen_t value_len);
int option, FAR const void *value,
socklen_t value_len);
#endif
/****************************************************************************

View File

@ -189,7 +189,7 @@ int icmpv6_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
*/
cb->flags = NETDEV_DOWN;
cb->priv = (FAR void *)info;
cb->priv = info;
cb->event = icmpv6_poll_eventhandler;
if ((fds->events & POLLIN) != 0)
@ -201,7 +201,7 @@ int icmpv6_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
* for use during poll teardown as well.
*/
fds->priv = (FAR void *)info;
fds->priv = info;
/* Check for read data availability now */

View File

@ -66,23 +66,29 @@ static int inet_setup(FAR struct socket *psock);
static sockcaps_t inet_sockcaps(FAR struct socket *psock);
static void inet_addref(FAR struct socket *psock);
static int inet_bind(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen);
FAR const struct sockaddr *addr,
socklen_t addrlen);
static int inet_getsockname(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
FAR struct sockaddr *addr,
FAR socklen_t *addrlen);
static int inet_getpeername(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
FAR struct sockaddr *addr,
FAR socklen_t *addrlen);
static int inet_listen(FAR struct socket *psock, int backlog);
static int inet_connect(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen);
FAR const struct sockaddr *addr,
socklen_t addrlen);
static int inet_accept(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen,
FAR struct sockaddr *addr,
FAR socklen_t *addrlen,
FAR struct socket *newsock, int flags);
static int inet_poll(FAR struct socket *psock,
FAR struct pollfd *fds, bool setup);
static ssize_t inet_send(FAR struct socket *psock, FAR const void *buf,
size_t len, int flags);
static ssize_t inet_sendto(FAR struct socket *psock, FAR const void *buf,
size_t len, int flags, FAR const struct sockaddr *to,
size_t len, int flags,
FAR const struct sockaddr *to,
socklen_t tolen);
static ssize_t inet_sendmsg(FAR struct socket *psock,
FAR struct msghdr *msg, int flags);
@ -94,9 +100,11 @@ static int inet_socketpair(FAR struct socket *psocks[2]);
static int inet_shutdown(FAR struct socket *psock, int how);
#ifdef CONFIG_NET_SOCKOPTS
static int inet_getsockopt(FAR struct socket *psock, int level,
int option, FAR void *value, FAR socklen_t *value_len);
int option, FAR void *value,
FAR socklen_t *value_len);
static int inet_setsockopt(FAR struct socket *psock, int level,
int option, FAR const void *value, socklen_t value_len);
int option, FAR const void *value,
socklen_t value_len);
#endif
#ifdef CONFIG_NET_SENDFILE
static ssize_t inet_sendfile(FAR struct socket *psock,

View File

@ -87,7 +87,7 @@ static int local_event_pollsetup(FAR struct local_conn_s *conn,
eventset |= POLLIN;
}
local_event_pollnotify(conn, eventset);
poll_notify(&fds, 1, eventset);
}
else
{

View File

@ -51,13 +51,17 @@ static int local_setup(FAR struct socket *psock);
static sockcaps_t local_sockcaps(FAR struct socket *psock);
static void local_sockaddref(FAR struct socket *psock);
static int local_bind(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen);
FAR const struct sockaddr *addr,
socklen_t addrlen);
static int local_getsockname(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
FAR struct sockaddr *addr,
FAR socklen_t *addrlen);
static int local_getpeername(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
FAR struct sockaddr *addr,
FAR socklen_t *addrlen);
static int local_connect(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen);
FAR const struct sockaddr *addr,
socklen_t addrlen);
static int local_poll(FAR struct socket *psock,
FAR struct pollfd *fds, bool setup);
static int local_close(FAR struct socket *psock);
@ -67,9 +71,11 @@ static int local_socketpair(FAR struct socket *psocks[2]);
static int local_shutdown(FAR struct socket *psock, int how);
#ifdef CONFIG_NET_SOCKOPTS
static int local_getsockopt(FAR struct socket *psock, int level,
int option, FAR void *value, FAR socklen_t *value_len);
int option, FAR void *value,
FAR socklen_t *value_len);
static int local_setsockopt(FAR struct socket *psock, int level,
int option, FAR const void *value, socklen_t value_len);
int option, FAR const void *value,
socklen_t value_len);
#endif
/****************************************************************************

View File

@ -53,11 +53,14 @@ static void netlink_addref(FAR struct socket *psock);
static int netlink_bind(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen);
static int netlink_getsockname(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
FAR struct sockaddr *addr,
FAR socklen_t *addrlen);
static int netlink_getpeername(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
FAR struct sockaddr *addr,
FAR socklen_t *addrlen);
static int netlink_connect(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen);
FAR const struct sockaddr *addr,
socklen_t addrlen);
static int netlink_poll(FAR struct socket *psock, FAR struct pollfd *fds,
bool setup);
static ssize_t netlink_sendmsg(FAR struct socket *psock,

View File

@ -141,16 +141,21 @@ static int rpmsg_socket_setup(FAR struct socket *psock);
static sockcaps_t rpmsg_socket_sockcaps(FAR struct socket *psock);
static void rpmsg_socket_addref(FAR struct socket *psock);
static int rpmsg_socket_bind(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen);
FAR const struct sockaddr *addr,
socklen_t addrlen);
static int rpmsg_socket_getsockname(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
FAR struct sockaddr *addr,
FAR socklen_t *addrlen);
static int rpmsg_socket_getconnname(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen);
FAR struct sockaddr *addr,
FAR socklen_t *addrlen);
static int rpmsg_socket_listen(FAR struct socket *psock, int backlog);
static int rpmsg_socket_connect(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen);
FAR const struct sockaddr *addr,
socklen_t addrlen);
static int rpmsg_socket_accept(FAR struct socket *psock,
FAR struct sockaddr *addr, FAR socklen_t *addrlen,
FAR struct sockaddr *addr,
FAR socklen_t *addrlen,
FAR struct socket *newsock, int flags);
static int rpmsg_socket_poll(FAR struct socket *psock,
FAR struct pollfd *fds, bool setup);
@ -163,7 +168,8 @@ static int rpmsg_socket_ioctl(FAR struct socket *psock,
int cmd, unsigned long arg);
#ifdef CONFIG_NET_SOCKOPTS
static int rpmsg_socket_getsockopt(FAR struct socket *psock,
int level, int option, FAR void *value,
int level, int option,
FAR void *value,
FAR socklen_t *value_len);
#endif
@ -943,7 +949,7 @@ static int rpmsg_socket_poll(FAR struct socket *psock,
}
}
rpmsg_socket_poll_notify(conn, eventset);
poll_notify(&fds, 1, eventset);
}
else
{

View File

@ -257,16 +257,15 @@ int tcp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
*/
cb->flags = TCP_DISCONN_EVENTS;
cb->priv = (FAR void *)info;
cb->priv = info;
cb->event = tcp_poll_eventhandler;
if ((fds->events & POLLOUT) != 0)
{
cb->flags |= TCP_POLL
cb->flags |= TCP_POLL;
#if defined(CONFIG_NET_TCP_WRITE_BUFFERS)
| TCP_ACKDATA
cb->flags |= TCP_ACKDATA;
#endif
;
/* Monitor the connected event */
@ -285,7 +284,7 @@ int tcp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
* for use during poll teardown as well.
*/
fds->priv = (FAR void *)info;
fds->priv = info;
/* Check for read data or backlogged connection availability now */

View File

@ -187,7 +187,7 @@ int udp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
*/
cb->flags = NETDEV_DOWN;
cb->priv = (FAR void *)info;
cb->priv = info;
cb->event = udp_poll_eventhandler;
if ((fds->events & POLLOUT) != 0)
@ -204,7 +204,7 @@ int udp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
* for use during poll teardown as well.
*/
fds->priv = (FAR void *)info;
fds->priv = info;
/* Check for read data availability now */

View File

@ -177,14 +177,14 @@ static int usrsock_pollsetup(FAR struct socket *psock,
cb->flags = USRSOCK_EVENT_ABORT | USRSOCK_EVENT_CONNECT_READY |
USRSOCK_EVENT_SENDTO_READY | USRSOCK_EVENT_RECVFROM_AVAIL |
USRSOCK_EVENT_REMOTE_CLOSED;
cb->priv = (FAR void *)info;
cb->priv = info;
cb->event = poll_event;
/* Save the reference in the poll info structure as fds private as well
* for use during poll teardown as well.
*/
fds->priv = (FAR void *)info;
fds->priv = info;
/* Check if socket is in error state */