mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
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:
committed by
Masayuki Ishikawa
parent
9f029194e1
commit
d07792a343
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user