You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/10/21 07:05:28 UTC

[incubator-nuttx] branch master updated: drivers/can: Fix can_poll() POLLOUT calculation

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang 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 0e2a3ec  drivers/can: Fix can_poll() POLLOUT calculation
0e2a3ec is described below

commit 0e2a3ecdf8d3522f8621a2a474ec166d1f2ea0fc
Author: Kenneth Thompson <ke...@flyvoly.com>
AuthorDate: Wed Oct 20 19:55:54 2021 -0700

    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.
---
 drivers/can/can.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/can/can.c b/drivers/can/can.c
index 5d3f7c7..b10154a 100644
--- a/drivers/can/can.c
+++ b/drivers/can/can.c
@@ -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;
         }