mirror of
https://github.com/apache/nuttx.git
synced 2025-12-10 12:14:36 +08:00
bt_buf: use small lock to protect bt_bufferlist_s
reason: We would like to replace the big lock with a small lock. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -139,7 +139,7 @@ static void bt_enqueue_bufwork(FAR struct bt_bufferlist_s *list,
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
flags = spin_lock_irqsave(&list->lock);
|
||||
buf->flink = list->head;
|
||||
if (list->head == NULL)
|
||||
{
|
||||
@@ -147,7 +147,7 @@ static void bt_enqueue_bufwork(FAR struct bt_bufferlist_s *list,
|
||||
}
|
||||
|
||||
list->head = buf;
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&list->lock, flags);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -172,7 +172,7 @@ static FAR struct bt_buf_s *
|
||||
FAR struct bt_buf_s *buf;
|
||||
irqstate_t flags;
|
||||
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
flags = spin_lock_irqsave(&list->lock);
|
||||
buf = list->tail;
|
||||
if (buf != NULL)
|
||||
{
|
||||
@@ -201,7 +201,7 @@ static FAR struct bt_buf_s *
|
||||
buf->flink = NULL;
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&list->lock, flags);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -1653,6 +1653,9 @@ int bt_initialize(void)
|
||||
memset(&g_lp_rxlist, 0, sizeof(g_lp_rxlist));
|
||||
memset(&g_hp_rxlist, 0, sizeof(g_hp_rxlist));
|
||||
|
||||
spin_lock_init(&g_hp_rxlist.lock);
|
||||
spin_lock_init(&g_lp_rxlist.lock);
|
||||
|
||||
DEBUGASSERT(btdev != NULL);
|
||||
bt_buf_initialize();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user