net/can: Add FAR specifier and fix nxstyle issues

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko 2023-09-15 22:05:19 +03:00 committed by Xiang Xiao
parent 588a7241a8
commit 5bee23da07

View file

@ -119,7 +119,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
if (pstate->pr_msglen > 0) /* concat cmsg data after packet */
{
memcpy(dev->d_buf + pstate->snd_buflen, pstate->pr_msgbuf,
pstate->pr_msglen);
pstate->pr_msglen);
dev->d_sndlen = pstate->snd_buflen + pstate->pr_msglen;
}
}
@ -202,8 +202,8 @@ ssize_t can_sendmsg(FAR struct socket *psock, FAR struct msghdr *msg,
#if defined(CONFIG_NET_CANPROTO_OPTIONS) && defined(CONFIG_NET_CAN_CANFD)
if (conn->fd_frames)
{
if (msg->msg_iov->iov_len != CANFD_MTU
&& msg->msg_iov->iov_len != CAN_MTU)
if (msg->msg_iov->iov_len != CANFD_MTU &&
msg->msg_iov->iov_len != CAN_MTU)
{
return -EINVAL;
}
@ -233,10 +233,11 @@ ssize_t can_sendmsg(FAR struct socket *psock, FAR struct msghdr *msg,
#ifdef CONFIG_NET_CAN_RAW_TX_DEADLINE
if (msg->msg_controllen > sizeof(struct cmsghdr))
{
struct cmsghdr *cmsg = CMSG_FIRSTHDR(msg);
if (conn->tx_deadline && cmsg->cmsg_level == SOL_CAN_RAW
&& cmsg->cmsg_type == CAN_RAW_TX_DEADLINE
&& cmsg->cmsg_len == sizeof(struct timeval))
FAR struct cmsghdr *cmsg = CMSG_FIRSTHDR(msg);
if (conn->tx_deadline &&
cmsg->cmsg_level == SOL_CAN_RAW &&
cmsg->cmsg_type == CAN_RAW_TX_DEADLINE &&
cmsg->cmsg_len == sizeof(struct timeval))
{
state.pr_msgbuf = CMSG_DATA(cmsg); /* Buffer to cmsg data */
state.pr_msglen = cmsg->cmsg_len; /* len of cmsg data */