mirror of
https://github.com/apache/nuttx.git
synced 2025-12-11 04:47:47 +08:00
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:
committed by
Alin Jerpelea
parent
11b3adf17f
commit
eddd90de78
@@ -175,10 +175,11 @@ 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_window_s *wndo,
|
||||
FAR const struct nxterm_operations_s *ops,
|
||||
int minor);
|
||||
FAR struct nxterm_state_s *
|
||||
nxterm_register(NXTERM handle,
|
||||
FAR struct nxterm_window_s *wndo,
|
||||
FAR const struct nxterm_operations_s *ops,
|
||||
int minor);
|
||||
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||
void nxterm_unregister(FAR struct nxterm_state_s *priv);
|
||||
#endif
|
||||
@@ -213,7 +214,7 @@ FAR const
|
||||
struct nxterm_bitmap_s *nxterm_addchar(FAR struct nxterm_state_s *priv,
|
||||
uint8_t ch);
|
||||
int nxterm_hidechar(FAR struct nxterm_state_s *priv,
|
||||
FAR const struct nxterm_bitmap_s *bm);
|
||||
FAR const struct nxterm_bitmap_s *bm);
|
||||
int nxterm_backspace(FAR struct nxterm_state_s *priv);
|
||||
void nxterm_fillchar(FAR struct nxterm_state_s *priv,
|
||||
FAR const struct nxgl_rect_s *rect,
|
||||
|
||||
@@ -50,16 +50,12 @@ 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);
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
flags = enter_critical_section();
|
||||
poll_notify(priv->fds, CONFIG_NXTERM_NPOLLWAITERS, eventset);
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -260,7 +256,7 @@ int nxterm_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
|
||||
/* Bind the poll structure and this slot */
|
||||
|
||||
priv->fds[i] = fds;
|
||||
fds->priv = &priv->fds[i];
|
||||
fds->priv = &priv->fds[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -269,8 +265,8 @@ int nxterm_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
|
||||
{
|
||||
gerr("ERROR: Too many poll waiters\n");
|
||||
|
||||
fds->priv = NULL;
|
||||
ret = -EBUSY;
|
||||
fds->priv = NULL;
|
||||
ret = -EBUSY;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user