Initialize global mutext/sem by NXMUTEX_INITIALIZER and SEM_INITIALIZER

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
anjiahao
2022-09-06 14:18:45 +08:00
committed by Masayuki Ishikawa
parent 9f029194e1
commit d07792a343
225 changed files with 1930 additions and 2163 deletions
+2 -7
View File
@@ -353,8 +353,8 @@ static uint32_t g_devinuse;
/* The following are used to managed the class creation operation */
static mutex_t g_lock; /* For mutually exclusive thread creation */
static sem_t g_syncsem; /* Thread data passing interlock */
static mutex_t g_lock = NXMUTEX_INITIALIZER;
static sem_t g_syncsem = SEM_INITIALIZER(0);
static struct usbhost_state_s *g_priv; /* Data passed to thread */
/* The following tables map keyboard scan codes to printable ASIC
@@ -2443,11 +2443,6 @@ errout:
int usbhost_kbdinit(void)
{
/* Perform any one-time initialization of the class implementation */
nxmutex_init(&g_lock);
nxsem_init(&g_syncsem, 0, 0);
/* Advertise our availability to support (certain) devices */
return usbhost_registerclass(&g_hidkbd);
+2 -7
View File
@@ -403,8 +403,8 @@ static uint32_t g_devinuse;
/* The following are used to managed the class creation operation */
static mutex_t g_lock; /* For mutually exclusive thread creation */
static sem_t g_syncsem; /* Thread data passing interlock */
static mutex_t g_lock = NXMUTEX_INITIALIZER;
static sem_t g_syncsem = SEM_INITIALIZER(0);
static struct usbhost_state_s *g_priv; /* Data passed to thread */
/****************************************************************************
@@ -2436,11 +2436,6 @@ errout:
int usbhost_mouse_init(void)
{
/* Perform any one-time initialization of the class implementation */
nxmutex_init(&g_lock);
nxsem_init(&g_syncsem, 0, 0);
/* Advertise our availability to support (certain) mouse devices */
return usbhost_registerclass(&g_hidmouse);
+2 -7
View File
@@ -308,8 +308,8 @@ static uint32_t g_devinuse;
/* The following are used to managed the class creation operation */
static mutex_t g_lock; /* For mutually exclusive thread creation */
static sem_t g_syncsem; /* Thread data passing interlock */
static mutex_t g_lock = NXMUTEX_INITIALIZER;
static sem_t g_syncsem = SEM_INITIALIZER(0);
static struct usbhost_state_s *g_priv; /* Data passed to thread */
/****************************************************************************
@@ -2197,11 +2197,6 @@ errout:
int usbhost_xboxcontroller_init(void)
{
/* Perform any one-time initialization of the class implementation */
nxmutex_init(&g_lock);
nxsem_init(&g_syncsem, 0, 0);
/* Advertise our availability to support (certain) devices */
return usbhost_registerclass(&g_xboxcontroller);