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/nuttx.git

commit 8d7ce77247e9898506a09290f4c9c13d6e7efcbb
Author: zhanghongyu <[email protected]>
AuthorDate: Tue Apr 29 21:37:44 2025 +0800

    net/pkt: fix build error when NET_PKT_WRITE_BUFFERS disable
    
    fix build error.
    
    Signed-off-by: zhanghongyu <[email protected]>
---
 net/pkt/pkt.h                  | 3 +--
 net/pkt/pkt_conn.c             | 2 +-
 net/pkt/pkt_sendmsg_buffered.c | 4 ----
 net/pkt/pkt_sockif.c           | 4 +++-
 4 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/net/pkt/pkt.h b/net/pkt/pkt.h
index 999358b067b..1fa27860e22 100644
--- a/net/pkt/pkt.h
+++ b/net/pkt/pkt.h
@@ -90,9 +90,8 @@ struct pkt_conn_s
   FAR struct devif_callback_s *sndcb;
 #  if CONFIG_NET_SEND_BUFSIZE > 0
   int32_t  sndbufs;               /* Maximum amount of bytes queued in send */
-  sem_t    sndsem;                /* Semaphore signals send completion */
 #  endif
-
+  sem_t    sndsem;                /* Semaphore signals send completion */
 #endif
 
   /* Read-ahead buffering.
diff --git a/net/pkt/pkt_conn.c b/net/pkt/pkt_conn.c
index 168080cfdc1..2acda198926 100644
--- a/net/pkt/pkt_conn.c
+++ b/net/pkt/pkt_conn.c
@@ -139,7 +139,7 @@ void pkt_free(FAR struct pkt_conn_s *conn)
 
   dq_rem(&conn->sconn.node, &g_active_pkt_connections);
 
-#ifdef CONFIG_NET_CAN_WRITE_BUFFERS
+#ifdef CONFIG_NET_PKT_WRITE_BUFFERS
   /* Free the write queue */
 
   iob_free_queue(&conn->write_q);
diff --git a/net/pkt/pkt_sendmsg_buffered.c b/net/pkt/pkt_sendmsg_buffered.c
index 4a84d6feee3..1fe6402fdcf 100644
--- a/net/pkt/pkt_sendmsg_buffered.c
+++ b/net/pkt/pkt_sendmsg_buffered.c
@@ -66,7 +66,6 @@
  *
  ****************************************************************************/
 
-#if CONFIG_NET_SEND_BUFSIZE > 0
 static void pkt_sendbuffer_notify(FAR struct pkt_conn_s *conn)
 {
   int val = 0;
@@ -77,7 +76,6 @@ static void pkt_sendbuffer_notify(FAR struct pkt_conn_s *conn)
       nxsem_post(&conn->sndsem);
     }
 }
-#endif
 
 /****************************************************************************
  * Name: psock_send_eventhandler
@@ -175,9 +173,7 @@ static uint16_t psock_send_eventhandler(FAR struct 
net_driver_s *dev,
 
       flags &= ~PKT_POLL;
 
-#if CONFIG_NET_SEND_BUFSIZE > 0
       pkt_sendbuffer_notify(conn);
-#endif
     }
 
   return flags;
diff --git a/net/pkt/pkt_sockif.c b/net/pkt/pkt_sockif.c
index fef6470296d..eabd02218d1 100644
--- a/net/pkt/pkt_sockif.c
+++ b/net/pkt/pkt_sockif.c
@@ -125,8 +125,10 @@ static int pkt_sockif_alloc(FAR struct socket *psock)
 
   conn->type = psock->s_proto;
 
-#if defined(CONFIG_NET_PKT_WRITE_BUFFERS) && CONFIG_NET_SEND_BUFSIZE > 0
+#ifdef CONFIG_NET_PKT_WRITE_BUFFERS
+#  if CONFIG_NET_SEND_BUFSIZE > 0
   conn->sndbufs = CONFIG_NET_SEND_BUFSIZE;
+#  endif
   nxsem_init(&conn->sndsem, 0, 0);
 #endif
 

Reply via email to