drivers/can: Fix can_poll() POLLOUT calculation

can_poll() would indicate that there is no space in the TX FIFO if there is
already one element in the FIFO.
This commit is contained in:
Kenneth Thompson 2021-10-20 19:55:54 -07:00 committed by Xiang Xiao
parent 7183009400
commit 0e2a3ecdf8

View File

@ -1129,13 +1129,13 @@ static int can_poll(FAR struct file *filep, FAR struct pollfd *fds,
while (ret < 0);
dev->cd_ntxwaiters--;
ndx = dev->cd_xmit.tx_head + 1;
ndx = dev->cd_xmit.tx_tail + 1;
if (ndx >= CONFIG_CAN_FIFOSIZE)
{
ndx = 0;
}
if (ndx != dev->cd_xmit.tx_tail)
if (ndx != dev->cd_xmit.tx_head)
{
eventset |= fds->events & POLLOUT;
}