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 b83393573326df7c3feb376394174758e17a4cb0
Author: p-szafonimateusz <[email protected]>
AuthorDate: Mon Nov 9 11:51:12 2026 +0100

    net/can: Make the CAN_RAW socket functions static.
    
    can_sendmsg(), can_recvmsg(), psock_can_cansend(), can_getsockopt()
    and can_setsockopt() are only used by the CAN_RAW socket interface, so
    make them static in can_raw.c and remove their prototypes from can.h.
    Rename them and the other socket interface functions to can_raw_*(),
    and g_can_sockif to g_can_raw_sockif, to show that they belong to
    CAN_RAW.  No functional change.
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: p-szafonimateusz <[email protected]>
---
 net/can/can.h           | 136 +----------------------------------
 net/can/can_raw.c       | 187 +++++++++++++++++++++++++-----------------------
 net/socket/net_sockif.c |   2 +-
 3 files changed, 101 insertions(+), 224 deletions(-)

diff --git a/net/can/can.h b/net/can/can.h
index 22b5d22f1bc..3ad7f49c426 100644
--- a/net/can/can.h
+++ b/net/can/can.h
@@ -144,7 +144,7 @@ extern "C"
 {
 #endif
 
-extern const struct sock_intf_s g_can_sockif;
+extern const struct sock_intf_s g_can_raw_sockif;
 
 /****************************************************************************
  * Public Function Prototypes
@@ -264,28 +264,6 @@ uint32_t can_callback(FAR struct net_driver_s *dev,
 int can_datahandler(FAR struct net_driver_s *dev,
                     FAR struct can_conn_s *conn);
 
-/****************************************************************************
- * Name: can_recvmsg
- *
- * Description:
- *   recvmsg() receives messages from a socket, and may be used to receive
- *   data on a socket whether or not it is connection-oriented.
- *
- *   If from is not NULL, and the underlying protocol provides the source
- *   address, this source address is filled in. The argument 'msg_namelen'
- *   initialized to the size of the buffer associated with from, and modified
- *   on return to indicate the actual size of the address stored there.
- *
- * Input Parameters:
- *   psock    A pointer to a NuttX-specific, internal socket structure
- *   msg      Buffer to receive the message
- *   flags    Receive flags (ignored)
- *
- ****************************************************************************/
-
-ssize_t can_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg,
-                    int flags);
-
 /****************************************************************************
  * Name: can_poll
  *
@@ -306,54 +284,6 @@ ssize_t can_recvmsg(FAR struct socket *psock, FAR struct 
msghdr *msg,
 
 void can_poll(FAR struct net_driver_s *dev, FAR struct can_conn_s *conn);
 
-/****************************************************************************
- * Name: psock_can_cansend
- *
- * Description:
- *   psock_can_cansend() returns a value indicating if a write to the socket
- *   would block.  It is still possible that the write may block if another
- *   write occurs first.
- *
- * Input Parameters:
- *   psock    An instance of the internal socket structure.
- *
- * Returned Value:
- *   OK
- *     At least one byte of data could be successfully written.
- *   -EWOULDBLOCK
- *     There is no room in the output buffer.
- *   -EBADF
- *     An invalid descriptor was specified.
- *
- * Assumptions:
- *   None
- *
- ****************************************************************************/
-
-int psock_can_cansend(FAR struct socket *psock);
-
-/****************************************************************************
- * Name: can_sendmsg
- *
- * Description:
- *   The can_sendmsg() call may be used only when the packet socket is
- *   in a connected state (so that the intended recipient is known).
- *
- * Input Parameters:
- *   psock    An instance of the internal socket structure.
- *   msg      CAN frame and optional CMSG
- *   flags    Send flags (ignored)
- *
- * Returned Value:
- *   On success, returns the number of characters sent.  On  error,
- *   a negated errno value is retruend.  See sendmsg() for the complete list
- *   of return values.
- *
- ****************************************************************************/
-
-ssize_t can_sendmsg(FAR struct socket *psock, FAR const struct msghdr *msg,
-                    int flags);
-
 /****************************************************************************
  * Name: can_readahead_signal
  *
@@ -397,70 +327,6 @@ void can_readahead_signal(FAR struct can_conn_s *conn);
 void can_sendbuffer_notify(FAR struct can_conn_s *conn);
 #endif /* CONFIG_NET_SEND_BUFSIZE */
 
-/****************************************************************************
- * Name: can_setsockopt
- *
- * Description:
- *   can_setsockopt() sets the CAN-protocol option specified by the
- *   'option' argument to the value pointed to by the 'value' argument for
- *   the socket specified by the 'psock' argument.
- *
- *   See <nuttx/can.h> for the a complete list of values of CAN protocol
- *   options.
- *
- * Input Parameters:
- *   psock     Socket structure of socket to operate on
- *   level     Protocol level to set the option
- *   option    identifies the option to set
- *   value     Points to the argument value
- *   value_len The length of the argument value
- *
- * Returned Value:
- *   Returns zero (OK) on success.  On failure, it returns a negated errno
- *   value to indicate the nature of the error.  See psock_setcockopt() for
- *   the list of possible error values.
- *
- ****************************************************************************/
-
-#ifdef CONFIG_NET_CANPROTO_OPTIONS
-int can_setsockopt(FAR struct socket *psock, int level, int option,
-                   FAR const void *value, socklen_t value_len);
-#endif
-
-/****************************************************************************
- * Name: can_getsockopt
- *
- * Description:
- *   can_getsockopt() retrieves the value for the option specified by the
- *   'option' argument for the socket specified by the 'psock' argument.  If
- *   the size of the option value is greater than 'value_len', the value
- *   stored in the object pointed to by the 'value' argument will be silently
- *   truncated. Otherwise, the length pointed to by the 'value_len' argument
- *   will be modified to indicate the actual length of the 'value'.
- *
- *   See <sys/socket.h> a complete list of values for the socket-level
- *   'option' argument.  Protocol-specific options are are protocol specific
- *   header files (such as nuttx/can.h for the case of the CAN protocol).
- *
- * Input Parameters:
- *   psock     Socket structure of the socket to query
- *   level     Protocol level to set the option
- *   option    identifies the option to get
- *   value     Points to the argument value
- *   value_len The length of the argument value
- *
- * Returned Value:
- *   Returns zero (OK) on success.  On failure, it returns a negated errno
- *   value to indicate the nature of the error.  See psock_getsockopt() for
- *   the complete list of appropriate return error codes.
- *
- ****************************************************************************/
-
-#ifdef CONFIG_NET_CANPROTO_OPTIONS
-int can_getsockopt(FAR struct socket *psock, int level, int option,
-                   FAR void *value, FAR socklen_t *value_len);
-#endif
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/net/can/can_raw.c b/net/can/can_raw.c
index c51889064da..a88aa360f99 100644
--- a/net/can/can_raw.c
+++ b/net/can/can_raw.c
@@ -96,43 +96,55 @@ struct can_recvfrom_s
  * Private Function Prototypes
  ****************************************************************************/
 
-static int  can_setup(FAR struct socket *psock);
-static sockcaps_t can_sockcaps(FAR struct socket *psock);
-static void can_addref(FAR struct socket *psock);
-static int  can_bind(FAR struct socket *psock,
-                     FAR const struct sockaddr *addr, socklen_t addrlen);
-static int  can_getsockname(FAR struct socket *psock,
-                            FAR struct sockaddr *addr,
-                            FAR socklen_t *addrlen);
-static int can_poll_local(FAR struct socket *psock, FAR struct pollfd_s *fds,
-                          bool setup);
-static int can_close(FAR struct socket *psock);
+static int can_raw_setup(FAR struct socket *psock);
+static sockcaps_t can_raw_sockcaps(FAR struct socket *psock);
+static void can_raw_addref(FAR struct socket *psock);
+static int can_raw_bind(FAR struct socket *psock,
+                        FAR const struct sockaddr *addr, socklen_t addrlen);
+static int can_raw_getsockname(FAR struct socket *psock,
+                               FAR struct sockaddr *addr,
+                               FAR socklen_t *addrlen);
+static int can_raw_poll(FAR struct socket *psock,
+                        FAR struct pollfd_s *fds, bool setup);
+static ssize_t can_raw_sendmsg(FAR struct socket *psock,
+                               FAR const struct msghdr *msg, int flags);
+static ssize_t can_raw_recvmsg(FAR struct socket *psock,
+                               FAR struct msghdr *msg, int flags);
+static int can_raw_close(FAR struct socket *psock);
+#if defined(CONFIG_NET_SOCKOPTS) && defined(CONFIG_NET_CANPROTO_OPTIONS)
+static int can_raw_getsockopt(FAR struct socket *psock, int level,
+                              int option, FAR void *value,
+                              FAR socklen_t *value_len);
+static int can_raw_setsockopt(FAR struct socket *psock, int level,
+                              int option, FAR const void *value,
+                              socklen_t value_len);
+#endif
 
 /****************************************************************************
  * Public Data
  ****************************************************************************/
 
-const struct sock_intf_s g_can_sockif =
+const struct sock_intf_s g_can_raw_sockif =
 {
-  can_setup,        /* si_setup */
-  can_sockcaps,     /* si_sockcaps */
-  can_addref,       /* si_addref */
-  can_bind,         /* si_bind */
-  can_getsockname,  /* si_getsockname */
-  NULL,             /* si_getpeername */
-  NULL,             /* si_listen */
-  NULL,             /* si_connect */
-  NULL,             /* si_accept */
-  can_poll_local,   /* si_poll */
-  can_sendmsg,      /* si_sendmsg */
-  can_recvmsg,      /* si_recvmsg */
-  can_close,        /* si_close */
-  NULL,             /* si_ioctl */
-  NULL,             /* si_socketpair */
-  NULL              /* si_shutdown */
+  can_raw_setup,        /* si_setup */
+  can_raw_sockcaps,     /* si_sockcaps */
+  can_raw_addref,       /* si_addref */
+  can_raw_bind,         /* si_bind */
+  can_raw_getsockname,  /* si_getsockname */
+  NULL,                 /* si_getpeername */
+  NULL,                 /* si_listen */
+  NULL,                 /* si_connect */
+  NULL,                 /* si_accept */
+  can_raw_poll,         /* si_poll */
+  can_raw_sendmsg,      /* si_sendmsg */
+  can_raw_recvmsg,      /* si_recvmsg */
+  can_raw_close,        /* si_close */
+  NULL,                 /* si_ioctl */
+  NULL,                 /* si_socketpair */
+  NULL                  /* si_shutdown */
 #if defined(CONFIG_NET_SOCKOPTS) && defined(CONFIG_NET_CANPROTO_OPTIONS)
-  , can_getsockopt  /* si_getsockopt */
-  , can_setsockopt  /* si_setsockopt */
+  , can_raw_getsockopt  /* si_getsockopt */
+  , can_raw_setsockopt  /* si_setsockopt */
 #endif
 };
 
@@ -478,7 +490,7 @@ static ssize_t can_recvfrom_result(int result,
 }
 
 /****************************************************************************
- * Name: can_recvmsg
+ * Name: can_raw_recvmsg
  *
  * Description:
  *   recvmsg() receives messages from a socket, and may be used to receive
@@ -496,8 +508,8 @@ static ssize_t can_recvfrom_result(int result,
  *
  ****************************************************************************/
 
-ssize_t can_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg,
-                    int flags)
+static ssize_t can_raw_recvmsg(FAR struct socket *psock,
+                               FAR struct msghdr *msg, int flags)
 {
   FAR struct can_conn_s *conn;
   FAR struct net_driver_s *dev = NULL;
@@ -684,10 +696,10 @@ end_wait:
 }
 
 /****************************************************************************
- * Name: can_sendmsg
+ * Name: can_raw_sendmsg
  *
  * Description:
- *   The can_sendmsg() call may be used only when the packet socket is
+ *   The can_raw_sendmsg() call may be used only when the packet socket is
  *   in a connected state (so that the intended recipient is known).
  *
  * Input Parameters:
@@ -702,8 +714,8 @@ end_wait:
  *
  ****************************************************************************/
 
-ssize_t can_sendmsg(FAR struct socket *psock, FAR const struct msghdr *msg,
-                    int flags)
+static ssize_t can_raw_sendmsg(FAR struct socket *psock,
+                               FAR const struct msghdr *msg, int flags)
 {
   FAR struct net_driver_s *dev;
   FAR struct can_conn_s *conn;
@@ -894,10 +906,10 @@ ssize_t can_sendmsg(FAR struct socket *psock, FAR const 
struct msghdr *msg,
 }
 
 /****************************************************************************
- * Name: psock_can_cansend
+ * Name: can_raw_cansend
  *
  * Description:
- *   psock_can_cansend() returns a value indicating if a write to the socket
+ *   can_raw_cansend() returns a value indicating if a write to the socket
  *   would block.  No space in the buffer is actually reserved, so it is
  *   possible that the write may still block if the buffer is filled by
  *   another means.
@@ -915,7 +927,7 @@ ssize_t can_sendmsg(FAR struct socket *psock, FAR const 
struct msghdr *msg,
  *
  ****************************************************************************/
 
-int psock_can_cansend(FAR struct socket *psock)
+static int can_raw_cansend(FAR struct socket *psock)
 {
   /* Verify that we received a valid socket */
 
@@ -1035,10 +1047,10 @@ static uint32_t psock_send_eventhandler(FAR struct 
net_driver_s *dev,
 }
 
 /****************************************************************************
- * Name: can_sendmsg
+ * Name: can_raw_sendmsg
  *
  * Description:
- *   The can_sendmsg() call may be used only when the packet socket is
+ *   The can_raw_sendmsg() call may be used only when the packet socket is
  *   in a connected state (so that the intended recipient is known).
  *
  * Input Parameters:
@@ -1053,8 +1065,8 @@ static uint32_t psock_send_eventhandler(FAR struct 
net_driver_s *dev,
  *
  ****************************************************************************/
 
-ssize_t can_sendmsg(FAR struct socket *psock, FAR const struct msghdr *msg,
-                    int flags)
+static ssize_t can_raw_sendmsg(FAR struct socket *psock,
+                               FAR const struct msghdr *msg, int flags)
 {
   FAR struct net_driver_s *dev;
   FAR struct can_conn_s *conn;
@@ -1296,10 +1308,10 @@ errout_with_lock:
 }
 
 /****************************************************************************
- * Name: psock_can_cansend
+ * Name: can_raw_cansend
  *
  * Description:
- *   psock_can_cansend() returns a value indicating if a write to the socket
+ *   can_raw_cansend() returns a value indicating if a write to the socket
  *   would block.  No space in the buffer is actually reserved, so it is
  *   possible that the write may still block if the buffer is filled by
  *   another means.
@@ -1317,7 +1329,7 @@ errout_with_lock:
  *
  ****************************************************************************/
 
-int psock_can_cansend(FAR struct socket *psock)
+static int can_raw_cansend(FAR struct socket *psock)
 {
 #if CONFIG_NET_SEND_BUFSIZE > 0
   FAR struct can_conn_s *conn;
@@ -1353,12 +1365,12 @@ int psock_can_cansend(FAR struct socket *psock)
 
 #endif
 
-#ifdef CONFIG_NET_CANPROTO_OPTIONS
+#if defined(CONFIG_NET_SOCKOPTS) && defined(CONFIG_NET_CANPROTO_OPTIONS)
 /****************************************************************************
- * Name: can_getsockopt
+ * Name: can_raw_getsockopt
  *
  * Description:
- *   can_getsockopt() retrieves the value for the option specified by the
+ *   can_raw_getsockopt() retrieves the value for the option specified by the
  *   'option' argument for the socket specified by the 'psock' argument.  If
  *   the size of the option value is greater than 'value_len', the value
  *   stored in the object pointed to by the 'value' argument will be silently
@@ -1383,8 +1395,9 @@ int psock_can_cansend(FAR struct socket *psock)
  *
  ****************************************************************************/
 
-int can_getsockopt(FAR struct socket *psock, int level, int option,
-                   FAR void *value, FAR socklen_t *value_len)
+static int can_raw_getsockopt(FAR struct socket *psock, int level,
+                              int option, FAR void *value,
+                              FAR socklen_t *value_len)
 {
   FAR struct can_conn_s *conn;
   int ret = OK;
@@ -1531,10 +1544,10 @@ int can_getsockopt(FAR struct socket *psock, int level, 
int option,
 }
 
 /****************************************************************************
- * Name: can_setsockopt
+ * Name: can_raw_setsockopt
  *
  * Description:
- *   can_setsockopt() sets the CAN-protocol option specified by the
+ *   can_raw_setsockopt() sets the CAN-protocol option specified by the
  *   'option' argument to the value pointed to by the 'value' argument for
  *   the socket specified by the 'psock' argument.
  *
@@ -1555,8 +1568,9 @@ int can_getsockopt(FAR struct socket *psock, int level, 
int option,
  *
  ****************************************************************************/
 
-int can_setsockopt(FAR struct socket *psock, int level, int option,
-                   FAR const void *value, socklen_t value_len)
+static int can_raw_setsockopt(FAR struct socket *psock, int level,
+                              int option, FAR const void *value,
+                              socklen_t value_len)
 {
   FAR struct can_conn_s *conn;
   int ret = OK;
@@ -1742,7 +1756,7 @@ int can_setsockopt(FAR struct socket *psock, int level, 
int option,
 #endif
 
 /****************************************************************************
- * Name: can_poll_eventhandler
+ * Name: can_raw_poll_eventhandler
  *
  * Description:
  *   This function is called to perform the actual CAN receive operation
@@ -1761,8 +1775,8 @@ int can_setsockopt(FAR struct socket *psock, int level, 
int option,
  *
  ****************************************************************************/
 
-static uint32_t can_poll_eventhandler(FAR struct net_driver_s *dev,
-                                      FAR void *pvpriv, uint32_t flags)
+static uint32_t can_raw_poll_eventhandler(FAR struct net_driver_s *dev,
+                                          FAR void *pvpriv, uint32_t flags)
 {
   FAR struct can_poll_s *info = pvpriv;
 
@@ -1791,7 +1805,7 @@ static uint32_t can_poll_eventhandler(FAR struct 
net_driver_s *dev,
       /* A poll is a sign that we are free to send data. */
 
       else if ((flags & CAN_POLL) != 0 &&
-                 psock_can_cansend(info->psock) >= 0)
+                 can_raw_cansend(info->psock) >= 0)
         {
           eventset |= POLLOUT;
         }
@@ -1805,7 +1819,7 @@ static uint32_t can_poll_eventhandler(FAR struct 
net_driver_s *dev,
 }
 
 /****************************************************************************
- * Name: can_setup
+ * Name: can_raw_setup
  *
  * Description:
  *   Called for socket() to verify that the provided socket type and
@@ -1822,7 +1836,7 @@ static uint32_t can_poll_eventhandler(FAR struct 
net_driver_s *dev,
  *
  ****************************************************************************/
 
-static int can_setup(FAR struct socket *psock)
+static int can_raw_setup(FAR struct socket *psock)
 {
   int domain = psock->s_domain;
   int type = psock->s_type;
@@ -1899,7 +1913,7 @@ static int can_setup(FAR struct socket *psock)
 }
 
 /****************************************************************************
- * Name: can_sockcaps
+ * Name: can_raw_sockcaps
  *
  * Description:
  *   Return the bit encoded capabilities of this socket.
@@ -1913,7 +1927,7 @@ static int can_setup(FAR struct socket *psock)
  *
  ****************************************************************************/
 
-static sockcaps_t can_sockcaps(FAR struct socket *psock)
+static sockcaps_t can_raw_sockcaps(FAR struct socket *psock)
 {
   /* Permit vfcntl to set socket to non-blocking */
 
@@ -1921,7 +1935,7 @@ static sockcaps_t can_sockcaps(FAR struct socket *psock)
 }
 
 /****************************************************************************
- * Name: can_addref
+ * Name: can_raw_addref
  *
  * Description:
  *   Increment the reference count on the underlying connection structure.
@@ -1935,7 +1949,7 @@ static sockcaps_t can_sockcaps(FAR struct socket *psock)
  *
  ****************************************************************************/
 
-static void can_addref(FAR struct socket *psock)
+static void can_raw_addref(FAR struct socket *psock)
 {
   FAR struct can_conn_s *conn;
 
@@ -1945,10 +1959,10 @@ static void can_addref(FAR struct socket *psock)
 }
 
 /****************************************************************************
- * Name: can_bind
+ * Name: can_raw_bind
  *
  * Description:
- *   can_bind() gives the socket 'conn' the local address 'addr'. 'addr'
+ *   can_raw_bind() gives the socket 'conn' the local address 'addr'. 'addr'
  *   is 'addrlen' bytes long. Traditionally, this is called "assigning a name
  *   to a socket." When a socket is created with socket, it exists in a name
  *   space (address family) but has no name assigned.
@@ -1974,8 +1988,8 @@ static void can_addref(FAR struct socket *psock)
  *
  ****************************************************************************/
 
-static int can_bind(FAR struct socket *psock,
-                    FAR const struct sockaddr *addr, socklen_t addrlen)
+static int can_raw_bind(FAR struct socket *psock,
+                        FAR const struct sockaddr *addr, socklen_t addrlen)
 {
   FAR struct sockaddr_can *canaddr;
   FAR struct can_conn_s *conn;
@@ -2003,11 +2017,11 @@ static int can_bind(FAR struct socket *psock,
 }
 
 /****************************************************************************
- * Name: can_getsockname
+ * Name: can_raw_getsockname
  *
  * Description:
- *   The can_getsockname() function retrieves the locally-bound name of the
- *   specified CAN socket, stores this address in the sockaddr structure
+ *   The can_raw_getsockname() function retrieves the locally-bound name of
+ *   the specified CAN socket, stores this address in the sockaddr structure
  *   pointed to by the 'addr' argument, and stores the length of this
  *   address in the object pointed to by the 'addrlen' argument.
  *
@@ -2022,9 +2036,9 @@ static int can_bind(FAR struct socket *psock,
  *
  ****************************************************************************/
 
-static int can_getsockname(FAR struct socket *psock,
-                           FAR struct sockaddr *addr,
-                           FAR socklen_t *addrlen)
+static int can_raw_getsockname(FAR struct socket *psock,
+                               FAR struct sockaddr *addr,
+                               FAR socklen_t *addrlen)
 {
   FAR struct sockaddr_can *canaddr;
   FAR struct can_conn_s *conn;
@@ -2072,7 +2086,7 @@ static int can_getsockname(FAR struct socket *psock,
 }
 
 /****************************************************************************
- * Name: can_poll_local
+ * Name: can_raw_poll
  *
  * Description:
  *   The standard poll() operation redirects operations on socket descriptors
@@ -2094,8 +2108,8 @@ static int can_getsockname(FAR struct socket *psock,
  *
  ****************************************************************************/
 
-static int can_poll_local(FAR struct socket *psock, FAR struct pollfd_s *fds,
-                          bool setup)
+static int can_raw_poll(FAR struct socket *psock,
+                        FAR struct pollfd_s *fds, bool setup)
 {
   FAR struct can_conn_s *conn;
   FAR struct can_poll_s *info = NULL;
@@ -2152,7 +2166,7 @@ static int can_poll_local(FAR struct socket *psock, FAR 
struct pollfd_s *fds,
 
       cb->flags = NETDEV_DOWN;
       cb->priv  = info;
-      cb->event = can_poll_eventhandler;
+      cb->event = can_raw_poll_eventhandler;
 
       if ((fds->events & POLLOUT) != 0)
         {
@@ -2179,7 +2193,7 @@ static int can_poll_local(FAR struct socket *psock, FAR 
struct pollfd_s *fds,
           eventset |= POLLRDNORM;
         }
 
-      if (psock_can_cansend(psock) >= 0)
+      if (can_raw_cansend(psock) >= 0)
         {
           /* A CAN frame may be sent without blocking. */
 
@@ -2220,7 +2234,7 @@ errout_with_lock:
 }
 
 /****************************************************************************
- * Name: can_close
+ * Name: can_raw_close
  *
  * Description:
  *   Performs the close operation on a CAN socket instance
@@ -2235,7 +2249,7 @@ errout_with_lock:
  *
  ****************************************************************************/
 
-static int can_close(FAR struct socket *psock)
+static int can_raw_close(FAR struct socket *psock)
 {
   FAR struct can_conn_s *conn = psock->s_conn;
   int ret = OK;
@@ -2269,7 +2283,7 @@ static int can_close(FAR struct socket *psock)
         {
           /* Return with error code, but free resources. */
 
-          nerr("ERROR: can_close failed: %d\n", ret);
+          nerr("ERROR: can_raw_close failed: %d\n", ret);
           return ret;
         }
     }
@@ -2287,7 +2301,7 @@ static int can_close(FAR struct socket *psock)
  * Public Functions
  ****************************************************************************/
 
-#ifdef CONFIG_NET_CAN_WRITE_BUFFERS
+#if defined(CONFIG_NET_CAN_WRITE_BUFFERS) && CONFIG_NET_SEND_BUFSIZE > 0
 /****************************************************************************
  * Name: can_sendbuffer_notify
  *
@@ -2302,7 +2316,6 @@ static int can_close(FAR struct socket *psock)
  *
  ****************************************************************************/
 
-#if CONFIG_NET_SEND_BUFSIZE > 0
 void can_sendbuffer_notify(FAR struct can_conn_s *conn)
 {
   int val = 0;
@@ -2314,8 +2327,6 @@ void can_sendbuffer_notify(FAR struct can_conn_s *conn)
     }
 }
 
-#endif /* CONFIG_NET_SEND_BUFSIZE */
-
 #endif
 
 #endif /* CONFIG_NET_CAN */
diff --git a/net/socket/net_sockif.c b/net/socket/net_sockif.c
index 055bc696d9b..84e04f3bf25 100644
--- a/net/socket/net_sockif.c
+++ b/net/socket/net_sockif.c
@@ -232,7 +232,7 @@ net_sockif(sa_family_t family, int type, int protocol)
 
 #ifdef CONFIG_NET_CAN
       case PF_CAN:
-        sockif = &g_can_sockif;
+        sockif = &g_can_raw_sockif;
         break;
 #endif
 

Reply via email to