Bluetooth: Host: Refactor bt_buf_get_evt
This is purely a syntactical refactor. Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
This commit is contained in:
parent
b6a10516b0
commit
9426309dbe
1 changed files with 13 additions and 21 deletions
|
@ -89,36 +89,28 @@ struct net_buf *bt_buf_get_rx(enum bt_buf_type type, k_timeout_t timeout)
|
|||
struct net_buf *bt_buf_get_evt(uint8_t evt, bool discardable,
|
||||
k_timeout_t timeout)
|
||||
{
|
||||
struct net_buf *buf;
|
||||
|
||||
switch (evt) {
|
||||
#if defined(CONFIG_BT_CONN) || defined(CONFIG_BT_ISO)
|
||||
case BT_HCI_EVT_NUM_COMPLETED_PACKETS:
|
||||
{
|
||||
struct net_buf *buf;
|
||||
|
||||
buf = net_buf_alloc(&num_complete_pool, timeout);
|
||||
if (buf) {
|
||||
net_buf_reserve(buf, BT_BUF_RESERVE);
|
||||
bt_buf_set_type(buf, BT_BUF_EVT);
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
buf = net_buf_alloc(&num_complete_pool, timeout);
|
||||
break;
|
||||
#endif /* CONFIG_BT_CONN || CONFIG_BT_ISO */
|
||||
default:
|
||||
if (discardable) {
|
||||
struct net_buf *buf;
|
||||
|
||||
buf = net_buf_alloc(&discardable_pool, timeout);
|
||||
if (buf) {
|
||||
net_buf_reserve(buf, BT_BUF_RESERVE);
|
||||
bt_buf_set_type(buf, BT_BUF_EVT);
|
||||
}
|
||||
|
||||
return buf;
|
||||
} else {
|
||||
return bt_buf_get_rx(BT_BUF_EVT, timeout);
|
||||
}
|
||||
|
||||
return bt_buf_get_rx(BT_BUF_EVT, timeout);
|
||||
}
|
||||
|
||||
if (buf) {
|
||||
net_buf_reserve(buf, BT_BUF_RESERVE);
|
||||
bt_buf_set_type(buf, BT_BUF_EVT);
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
#ifdef ZTEST_UNITTEST
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue