serial: Remove the unnecessary critical section in uart_pollnotify
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
9b29641bf5
commit
81e63e3a63
@ -166,24 +166,15 @@ static void uart_pollnotify(FAR uart_dev_t *dev, pollevent_t eventset)
|
|||||||
#endif
|
#endif
|
||||||
if (fds->revents != 0)
|
if (fds->revents != 0)
|
||||||
{
|
{
|
||||||
irqstate_t flags;
|
|
||||||
int semcount;
|
int semcount;
|
||||||
|
|
||||||
finfo("Report events: %02x\n", fds->revents);
|
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);
|
nxsem_get_value(fds->sem, &semcount);
|
||||||
if (semcount < 1)
|
if (semcount < 1)
|
||||||
{
|
{
|
||||||
nxsem_post(fds->sem);
|
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)
|
if (i >= CONFIG_SERIAL_NPOLLWAITERS)
|
||||||
{
|
{
|
||||||
fds->priv = NULL;
|
fds->priv = NULL;
|
||||||
ret = -EBUSY;
|
ret = -EBUSY;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1582,15 +1573,15 @@ static int uart_poll(FAR struct file *filep,
|
|||||||
#ifdef CONFIG_DEBUG_FEATURES
|
#ifdef CONFIG_DEBUG_FEATURES
|
||||||
if (!slot)
|
if (!slot)
|
||||||
{
|
{
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Remove all memory of the poll setup */
|
/* Remove all memory of the poll setup */
|
||||||
|
|
||||||
*slot = NULL;
|
*slot = NULL;
|
||||||
fds->priv = NULL;
|
fds->priv = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
|
Loading…
Reference in New Issue
Block a user