From 9c1fc8da4e97cdb6e57cfeb3b5c9a664962d0040 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sat, 12 Mar 2022 12:14:11 +0800 Subject: [PATCH] net: Remove net_lockinitialize Signed-off-by: Xiang Xiao --- net/net_initialize.c | 5 ----- net/utils/net_lock.c | 19 +++---------------- net/utils/utils.h | 10 ---------- 3 files changed, 3 insertions(+), 31 deletions(-) diff --git a/net/net_initialize.c b/net/net_initialize.c index 6836989efb..fa1a3be360 100644 --- a/net/net_initialize.c +++ b/net/net_initialize.c @@ -47,7 +47,6 @@ #include "igmp/igmp.h" #include "route/route.h" #include "usrsock/usrsock.h" -#include "utils/utils.h" /**************************************************************************** * Public Functions @@ -78,10 +77,6 @@ void net_initialize(void) { - /* Initialize the locking facility */ - - net_lockinitialize(); - #ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_6LOWPAN /* Initialize 6LoWPAN data structures */ diff --git a/net/utils/net_lock.c b/net/utils/net_lock.c index 91666c59d8..db2af19a37 100644 --- a/net/utils/net_lock.c +++ b/net/utils/net_lock.c @@ -49,9 +49,9 @@ * Private Data ****************************************************************************/ -static sem_t g_netlock; -static pid_t g_holder = NO_HOLDER; -static unsigned int g_count = 0; +static sem_t g_netlock = SEM_INITIALIZER(1); +static pid_t g_holder = NO_HOLDER; +static unsigned int g_count; /**************************************************************************** * Private Functions @@ -149,19 +149,6 @@ _net_timedwait(sem_t *sem, bool interruptible, unsigned int timeout) * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: net_lockinitialize - * - * Description: - * Initialize the locking facility - * - ****************************************************************************/ - -void net_lockinitialize(void) -{ - nxsem_init(&g_netlock, 0, 1); -} - /**************************************************************************** * Name: net_lock * diff --git a/net/utils/utils.h b/net/utils/utils.h index 5004b5e481..06d6d3a44a 100644 --- a/net/utils/utils.h +++ b/net/utils/utils.h @@ -61,16 +61,6 @@ extern "C" struct net_driver_s; /* Forward reference */ struct timeval; /* Forward reference */ -/**************************************************************************** - * Name: net_lockinitialize - * - * Description: - * Initialize the locking facility - * - ****************************************************************************/ - -void net_lockinitialize(void); - /**************************************************************************** * Name: net_breaklock *