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 2026/10/14 06:00:33 UTC
(nuttx) branch master updated (5a90d299eca -> cb26015ee17)
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
from 5a90d299eca drivers/i3c/master.c: fix dynamic address slot leak on reattach
new f5ac4046f63 drivers/can/can.c: Fix nxstyle issues.
new cb26015ee17 drivers/can/can.c: Fix FIONREAD result type and FIFO wrap.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
drivers/can/can.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
(nuttx) 02/02: drivers/can/can.c: Fix FIONREAD result type and FIFO wrap.
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit cb26015ee179f4ca4e65f8df78ebb57e67e94e90
Author: raiden00pl <ra...@railab.me>
AuthorDate: Sat Oct 10 15:40:07 2026 +0200
drivers/can/can.c: Fix FIONREAD result type and FIFO wrap.
FIONREAD wrote the count through a uint8_t pointer, but
include/nuttx/fs/ioctl.h defines its argument as int *. The count
was also negative once the RX FIFO had wrapped.
Write an int and handle the wrap. Callers that passed a uint8_t
must pass an int now. The result is still the number of queued
messages, not bytes.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: raiden00pl <ra...@railab.me>
---
drivers/can/can.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/can/can.c b/drivers/can/can.c
index 445e2c83282..d01647dcac0 100644
--- a/drivers/can/can.c
+++ b/drivers/can/can.c
@@ -1044,11 +1044,18 @@ static int can_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
case FIONREAD:
{
- *(FAR uint8_t *)arg =
+ int count = reader->fifo.rx_tail - reader->fifo.rx_head;
+
+ if (count < 0)
+ {
+ count += CONFIG_CAN_RXFIFOSIZE;
+ }
+
#ifdef CONFIG_CAN_ERRORS
- (reader->fifo.rx_error != 0) +
+ count += (reader->fifo.rx_error != 0);
#endif
- reader->fifo.rx_tail - reader->fifo.rx_head;
+
+ *(FAR int *)arg = count;
}
break;
(nuttx) 01/02: drivers/can/can.c: Fix nxstyle issues.
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit f5ac4046f631539effde75ead57ae422fd5d00da
Author: raiden00pl <ra...@railab.me>
AuthorDate: Sat Oct 10 15:21:05 2026 +0200
drivers/can/can.c: Fix nxstyle issues.
Add the missing blank lines after declarations that
tools/checkpatch.sh -f reports. No functional change.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: raiden00pl <ra...@railab.me>
---
drivers/can/can.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/can/can.c b/drivers/can/can.c
index 624852c1a1e..445e2c83282 100644
--- a/drivers/can/can.c
+++ b/drivers/can/can.c
@@ -198,6 +198,7 @@ static void can_txready_work(FAR void *arg)
static FAR struct can_reader_s *init_can_reader(FAR struct file *filep)
{
FAR struct can_reader_s *reader = kmm_zalloc(sizeof(struct can_reader_s));
+
DEBUGASSERT(reader != NULL);
nxsem_init(&reader->fifo.rx_sem, 0, 0);
@@ -1064,6 +1065,7 @@ static int can_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
FAR const struct can_transv_ops_s *ct_ops =
dev->cd_transv->ct_ops;
+
ret = ct_ops->ct_setstate(dev->cd_transv, arg);
}
else
@@ -1088,6 +1090,7 @@ static int can_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
int *state = (FAR int *)arg;
FAR const struct can_transv_ops_s *ct_ops =
dev->cd_transv->ct_ops;
+
ret = ct_ops->ct_getstate(dev->cd_transv, state);
}
else
@@ -1387,6 +1390,7 @@ int can_receive(FAR struct can_dev_s *dev, FAR struct can_hdr_s *hdr,
list_for_every(&dev->cd_readers, node)
{
FAR struct can_reader_s *reader = (FAR struct can_reader_s *)node;
+
fifo = &reader->fifo;
was_empty = fifo->rx_head == fifo->rx_tail;
@@ -1565,6 +1569,7 @@ int can_txdone(FAR struct can_dev_s *dev)
list_for_every(&dev->cd_readers, node)
{
FAR struct can_reader_s *reader = (FAR struct can_reader_s *)node;
+
poll_notify(&reader->cd_fds, 1, POLLOUT);
}