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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user