You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by da...@apache.org on 2021/06/02 22:47:02 UTC
[incubator-nuttx] branch master updated: serial: Remove the
unnecessary critical section in uart_pollnotify
This is an automated email from the ASF dual-hosted git repository.
davids5 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 81e63e3 serial: Remove the unnecessary critical section in uart_pollnotify
81e63e3 is described below
commit 81e63e3a63ccf2c5ceaac9ee52b60f9fa01e413f
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Jun 2 11:16:34 2021 +0800
serial: Remove the unnecessary critical section in uart_pollnotify
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
drivers/serial/serial.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 84cc249..4690d30 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -166,24 +166,15 @@ static void uart_pollnotify(FAR uart_dev_t *dev, pollevent_t eventset)
#endif
if (fds->revents != 0)
{
- irqstate_t flags;
int semcount;
finfo("Report events: %02x\n", fds->revents);
- /* Limit the number of times that the semaphore is posted.
- * The critical section is needed to make the following
- * operation atomic.
- */
-
- flags = enter_critical_section();
nxsem_get_value(fds->sem, &semcount);
if (semcount < 1)
{
nxsem_post(fds->sem);
}
-
- leave_critical_section(flags);
}
}
}
@@ -1515,8 +1506,8 @@ static int uart_poll(FAR struct file *filep,
if (i >= CONFIG_SERIAL_NPOLLWAITERS)
{
- fds->priv = NULL;
- ret = -EBUSY;
+ fds->priv = NULL;
+ ret = -EBUSY;
goto errout;
}
@@ -1582,15 +1573,15 @@ static int uart_poll(FAR struct file *filep,
#ifdef CONFIG_DEBUG_FEATURES
if (!slot)
{
- ret = -EIO;
+ ret = -EIO;
goto errout;
}
#endif
/* Remove all memory of the poll setup */
- *slot = NULL;
- fds->priv = NULL;
+ *slot = NULL;
+ fds->priv = NULL;
}
errout: