poll: add poll_notify() api and call it in all drivers

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
This commit is contained in:
wangbowen6
2022-09-19 11:08:57 +08:00
committed by Xiang Xiao
parent 74842880f9
commit 344c8be049
83 changed files with 289 additions and 1441 deletions
+2 -28
View File
@@ -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
{