mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
poll: add poll_notify() api and call it in all drivers
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
This commit is contained in:
+2
-15
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user