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
+1 -12
View File
@@ -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.