ble_mesh: Remove useless parameters of lock/unlock

This commit is contained in:
lly
2019-12-14 16:28:22 +08:00
parent d2bc597e9f
commit e4223df60f
4 changed files with 23 additions and 35 deletions

View File

@@ -233,7 +233,6 @@ void net_buf_simple_reserve(struct net_buf_simple *buf, size_t reserve)
void net_buf_slist_put(sys_slist_t *list, struct net_buf *buf)
{
struct net_buf *tail;
unsigned int key;
NET_BUF_ASSERT(list);
NET_BUF_ASSERT(buf);
@@ -242,21 +241,20 @@ void net_buf_slist_put(sys_slist_t *list, struct net_buf *buf)
tail->flags |= NET_BUF_FRAGS;
}
key = bt_mesh_irq_lock();
bt_mesh_irq_lock();
sys_slist_append_list(list, &buf->node, &tail->node);
bt_mesh_irq_unlock(key);
bt_mesh_irq_unlock();
}
struct net_buf *net_buf_slist_get(sys_slist_t *list)
{
struct net_buf *buf, *frag;
unsigned int key;
NET_BUF_ASSERT(list);
key = bt_mesh_irq_lock();
bt_mesh_irq_lock();
buf = (void *)sys_slist_get(list);
bt_mesh_irq_unlock(key);
bt_mesh_irq_unlock();
if (!buf) {
return NULL;
@@ -264,9 +262,9 @@ struct net_buf *net_buf_slist_get(sys_slist_t *list)
/* Get any fragments belonging to this buffer */
for (frag = buf; (frag->flags & NET_BUF_FRAGS); frag = frag->frags) {
key = bt_mesh_irq_lock();
bt_mesh_irq_lock();
frag->frags = (void *)sys_slist_get(list);
bt_mesh_irq_unlock(key);
bt_mesh_irq_unlock();
NET_BUF_ASSERT(frag->frags);
@@ -373,7 +371,6 @@ struct net_buf *net_buf_alloc_len(struct net_buf_pool *pool, size_t size,
#endif
{
struct net_buf *buf = NULL;
unsigned int key;
int i;
NET_BUF_ASSERT(pool);
@@ -384,7 +381,7 @@ struct net_buf *net_buf_alloc_len(struct net_buf_pool *pool, size_t size,
/* We need to lock interrupts temporarily to prevent race conditions
* when accessing pool->uninit_count.
*/
key = bt_mesh_irq_lock();
bt_mesh_irq_lock();
/* If there are uninitialized buffers we're guaranteed to succeed
* with the allocation one way or another.
@@ -394,13 +391,13 @@ struct net_buf *net_buf_alloc_len(struct net_buf_pool *pool, size_t size,
for (i = pool->buf_count; i > 0; i--) {
buf = pool_get_uninit(pool, i);
if (!buf->ref) {
bt_mesh_irq_unlock(key);
bt_mesh_irq_unlock();
goto success;
}
}
}
bt_mesh_irq_unlock(key);
bt_mesh_irq_unlock();
NET_BUF_ERR("%s, Failed to get free buffer", __func__);
return NULL;