net: Remove the unnecessary initialization code
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
4d0fcc2526
commit
7598070508
12 changed files with 9 additions and 92 deletions
|
@ -90,14 +90,7 @@ void bluetooth_conn_initialize(void)
|
|||
{
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
int i;
|
||||
#endif
|
||||
|
||||
/* Initialize the queues */
|
||||
|
||||
dq_init(&g_free_bluetooth_connections);
|
||||
dq_init(&g_active_bluetooth_connections);
|
||||
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
for (i = 0; i < CONFIG_NET_BLUETOOTH_NCONNS; i++)
|
||||
{
|
||||
/* Link each pre-allocated connection structure into the free list. */
|
||||
|
|
|
@ -56,7 +56,7 @@ static struct can_conn_s g_can_connections[CONFIG_CAN_CONNS];
|
|||
/* A list of all free NetLink connections */
|
||||
|
||||
static dq_queue_t g_free_can_connections;
|
||||
static sem_t g_free_sem;
|
||||
static sem_t g_free_sem = SEM_INITIALIZER(1);
|
||||
|
||||
/* A list of all allocated NetLink connections */
|
||||
|
||||
|
@ -101,15 +101,7 @@ void can_initialize(void)
|
|||
{
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
int i;
|
||||
#endif
|
||||
|
||||
/* Initialize the queues */
|
||||
|
||||
dq_init(&g_free_can_connections);
|
||||
dq_init(&g_active_can_connections);
|
||||
nxsem_init(&g_free_sem, 0, 1);
|
||||
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
for (i = 0; i < CONFIG_CAN_CONNS; i++)
|
||||
{
|
||||
/* Mark the connection closed and move it to the free list */
|
||||
|
|
|
@ -55,7 +55,7 @@ static struct icmp_conn_s g_icmp_connections[CONFIG_NET_ICMP_NCONNS];
|
|||
/* A list of all free IPPROTO_ICMP socket connections */
|
||||
|
||||
static dq_queue_t g_free_icmp_connections;
|
||||
static sem_t g_free_sem;
|
||||
static sem_t g_free_sem = SEM_INITIALIZER(1);
|
||||
|
||||
/* A list of all allocated IPPROTO_ICMP socket connections */
|
||||
|
||||
|
@ -78,15 +78,7 @@ void icmp_sock_initialize(void)
|
|||
{
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
int i;
|
||||
#endif
|
||||
|
||||
/* Initialize the queues */
|
||||
|
||||
dq_init(&g_free_icmp_connections);
|
||||
dq_init(&g_active_icmp_connections);
|
||||
nxsem_init(&g_free_sem, 0, 1);
|
||||
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
for (i = 0; i < CONFIG_NET_ICMP_NCONNS; i++)
|
||||
{
|
||||
/* Move the connection structure to the free list */
|
||||
|
|
|
@ -55,7 +55,7 @@ static struct icmpv6_conn_s g_icmpv6_connections[CONFIG_NET_ICMPv6_NCONNS];
|
|||
/* A list of all free IPPROTO_ICMP socket connections */
|
||||
|
||||
static dq_queue_t g_free_icmpv6_connections;
|
||||
static sem_t g_free_sem;
|
||||
static sem_t g_free_sem = SEM_INITIALIZER(1);
|
||||
|
||||
/* A list of all allocated IPPROTO_ICMP socket connections */
|
||||
|
||||
|
@ -78,15 +78,7 @@ void icmpv6_sock_initialize(void)
|
|||
{
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
int i;
|
||||
#endif
|
||||
|
||||
/* Initialize the queues */
|
||||
|
||||
dq_init(&g_free_icmpv6_connections);
|
||||
dq_init(&g_active_icmpv6_connections);
|
||||
nxsem_init(&g_free_sem, 0, 1);
|
||||
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
for (i = 0; i < CONFIG_NET_ICMPv6_NCONNS; i++)
|
||||
{
|
||||
/* Move the connection structure to the free list */
|
||||
|
|
|
@ -84,14 +84,7 @@ void ieee802154_conn_initialize(void)
|
|||
{
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
int i;
|
||||
#endif
|
||||
|
||||
/* Initialize the queues */
|
||||
|
||||
dq_init(&g_free_ieee802154_connections);
|
||||
dq_init(&g_active_ieee802154_connections);
|
||||
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
for (i = 0; i < CONFIG_NET_IEEE802154_NCONNS; i++)
|
||||
{
|
||||
/* Link each pre-allocated connection structure into the free list. */
|
||||
|
|
|
@ -57,7 +57,7 @@ static struct netlink_conn_s g_netlink_connections[CONFIG_NETLINK_CONNS];
|
|||
/* A list of all free NetLink connections */
|
||||
|
||||
static dq_queue_t g_free_netlink_connections;
|
||||
static sem_t g_free_sem;
|
||||
static sem_t g_free_sem = SEM_INITIALIZER(1);
|
||||
|
||||
/* A list of all allocated NetLink connections */
|
||||
|
||||
|
@ -125,15 +125,7 @@ void netlink_initialize(void)
|
|||
{
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
int i;
|
||||
#endif
|
||||
|
||||
/* Initialize the queues */
|
||||
|
||||
dq_init(&g_free_netlink_connections);
|
||||
dq_init(&g_active_netlink_connections);
|
||||
nxsem_init(&g_free_sem, 0, 1);
|
||||
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
for (i = 0; i < CONFIG_NETLINK_CONNS; i++)
|
||||
{
|
||||
/* Mark the connection closed and move it to the free list */
|
||||
|
|
|
@ -63,7 +63,7 @@ static struct pkt_conn_s g_pkt_connections[CONFIG_NET_PKT_CONNS];
|
|||
/* A list of all free packet socket connections */
|
||||
|
||||
static dq_queue_t g_free_pkt_connections;
|
||||
static sem_t g_free_sem;
|
||||
static sem_t g_free_sem = SEM_INITIALIZER(1);
|
||||
|
||||
/* A list of all allocated packet socket connections */
|
||||
|
||||
|
@ -105,15 +105,7 @@ void pkt_initialize(void)
|
|||
{
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
int i;
|
||||
#endif
|
||||
|
||||
/* Initialize the queues */
|
||||
|
||||
dq_init(&g_free_pkt_connections);
|
||||
dq_init(&g_active_pkt_connections);
|
||||
nxsem_init(&g_free_sem, 0, 1);
|
||||
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
for (i = 0; i < CONFIG_NET_PKT_CONNS; i++)
|
||||
{
|
||||
dq_addlast(&g_pkt_connections[i].sconn.node, &g_free_pkt_connections);
|
||||
|
|
|
@ -122,7 +122,7 @@ static struct net_cache_ipv4_entry_s
|
|||
|
||||
/* Serializes access to the routing table cache */
|
||||
|
||||
static sem_t g_ipv4_cachelock;
|
||||
static sem_t g_ipv4_cachelock = SEM_INITIALIZER(1);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ROUTE_IPv6_CACHEROUTE)
|
||||
|
@ -141,7 +141,7 @@ static struct net_cache_ipv6_entry_s
|
|||
|
||||
/* Serializes access to the routing table cache */
|
||||
|
||||
static sem_t g_ipv6_cachelock;
|
||||
static sem_t g_ipv6_cachelock = SEM_INITIALIZER(1);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -481,12 +481,10 @@ void net_init_cacheroute(void)
|
|||
/* Initialize the routing table cash and the free list */
|
||||
|
||||
#ifdef CONFIG_ROUTE_IPv4_CACHEROUTE
|
||||
nxsem_init(&g_ipv4_cachelock, 0, 1);
|
||||
net_reset_ipv4_cache();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ROUTE_IPv6_CACHEROUTE
|
||||
nxsem_init(&g_ipv6_cachelock, 0, 1);
|
||||
net_reset_ipv6_cache();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -580,16 +580,7 @@ void tcp_initialize(void)
|
|||
{
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
int i;
|
||||
#endif
|
||||
|
||||
/* Initialize the queues */
|
||||
|
||||
dq_init(&g_free_tcp_connections);
|
||||
dq_init(&g_active_tcp_connections);
|
||||
|
||||
/* Now initialize each connection structure */
|
||||
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
for (i = 0; i < CONFIG_NET_TCP_CONNS; i++)
|
||||
{
|
||||
/* Mark the connection closed and move it to the free list */
|
||||
|
|
|
@ -94,8 +94,6 @@ void tcp_wrbuffer_initialize(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
sq_init(&g_wrbuffer.freebuffers);
|
||||
|
||||
for (i = 0; i < CONFIG_NET_TCP_NWRBCHAINS; i++)
|
||||
{
|
||||
sq_addfirst(&g_wrbuffer.buffers[i].wb_node, &g_wrbuffer.freebuffers);
|
||||
|
|
|
@ -88,7 +88,7 @@ struct udp_conn_s g_udp_connections[CONFIG_NET_UDP_CONNS];
|
|||
/* A list of all free UDP connections */
|
||||
|
||||
static dq_queue_t g_free_udp_connections;
|
||||
static sem_t g_free_sem;
|
||||
static sem_t g_free_sem = SEM_INITIALIZER(1);
|
||||
|
||||
/* A list of all allocated UDP connections */
|
||||
|
||||
|
@ -580,15 +580,7 @@ void udp_initialize(void)
|
|||
{
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
int i;
|
||||
#endif
|
||||
|
||||
/* Initialize the queues */
|
||||
|
||||
dq_init(&g_free_udp_connections);
|
||||
dq_init(&g_active_udp_connections);
|
||||
nxsem_init(&g_free_sem, 0, 1);
|
||||
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
for (i = 0; i < CONFIG_NET_UDP_CONNS; i++)
|
||||
{
|
||||
/* Mark the connection closed and move it to the free list */
|
||||
|
|
|
@ -53,7 +53,7 @@ static struct usrsock_conn_s g_usrsock_connections[CONFIG_NET_USRSOCK_CONNS];
|
|||
/* A list of all free usrsock connections */
|
||||
|
||||
static dq_queue_t g_free_usrsock_connections;
|
||||
static sem_t g_free_sem;
|
||||
static sem_t g_free_sem = SEM_INITIALIZER(1);
|
||||
|
||||
/* A list of all allocated usrsock connections */
|
||||
|
||||
|
@ -333,15 +333,7 @@ void usrsock_initialize(void)
|
|||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
FAR struct usrsock_conn_s *conn;
|
||||
int i;
|
||||
#endif
|
||||
|
||||
/* Initialize the queues */
|
||||
|
||||
dq_init(&g_free_usrsock_connections);
|
||||
dq_init(&g_active_usrsock_connections);
|
||||
nxsem_init(&g_free_sem, 0, 1);
|
||||
|
||||
#ifndef CONFIG_NET_ALLOC_CONNS
|
||||
for (i = 0; i < CONFIG_NET_USRSOCK_CONNS; i++)
|
||||
{
|
||||
conn = &g_usrsock_connections[i];
|
||||
|
|
Loading…
Reference in a new issue