Bluetooth: L2CAP: Fix build with unified kernel
Use helper for accesing nano_sem count. This fix build error on unified kernel where nano_sem is wrapped by k_sem. Change-Id: Iad840e3c635a0fbc3b5eeee2e61479fa3d39ca30 Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
parent
15c473e290
commit
8c118f8673
1 changed files with 5 additions and 6 deletions
|
@ -541,9 +541,7 @@ static void l2cap_chan_destroy(struct bt_l2cap_chan *chan)
|
||||||
/* There could be a writer waiting for credits so return a dummy credit
|
/* There could be a writer waiting for credits so return a dummy credit
|
||||||
* to wake it up.
|
* to wake it up.
|
||||||
*/
|
*/
|
||||||
if (!ch->tx.credits.nsig) {
|
l2cap_chan_tx_give_credits(ch, 1);
|
||||||
l2cap_chan_tx_give_credits(ch, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Destroy segmented SDU if it exists */
|
/* Destroy segmented SDU if it exists */
|
||||||
if (ch->_sdu) {
|
if (ch->_sdu) {
|
||||||
|
@ -851,7 +849,7 @@ static void le_credits(struct bt_l2cap *l2cap, uint8_t ident,
|
||||||
|
|
||||||
ch = BT_L2CAP_LE_CHAN(chan);
|
ch = BT_L2CAP_LE_CHAN(chan);
|
||||||
|
|
||||||
if (ch->tx.credits.nsig + credits > UINT16_MAX) {
|
if (nano_sem_count_get(&ch->tx.credits) + credits > UINT16_MAX) {
|
||||||
BT_ERR("Credits overflow");
|
BT_ERR("Credits overflow");
|
||||||
bt_l2cap_chan_disconnect(chan);
|
bt_l2cap_chan_disconnect(chan);
|
||||||
return;
|
return;
|
||||||
|
@ -955,12 +953,13 @@ static void l2cap_chan_update_credits(struct bt_l2cap_le_chan *chan)
|
||||||
uint16_t credits;
|
uint16_t credits;
|
||||||
|
|
||||||
/* Only give more credits if it went bellow the defined threshold */
|
/* Only give more credits if it went bellow the defined threshold */
|
||||||
if (chan->rx.credits.nsig > L2CAP_LE_CREDITS_THRESHOLD) {
|
if (nano_sem_count_get(&chan->tx.credits) >
|
||||||
|
L2CAP_LE_CREDITS_THRESHOLD) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore credits */
|
/* Restore credits */
|
||||||
credits = L2CAP_LE_MAX_CREDITS - chan->rx.credits.nsig;
|
credits = L2CAP_LE_MAX_CREDITS - nano_sem_count_get(&chan->tx.credits);
|
||||||
l2cap_chan_rx_give_credits(chan, credits);
|
l2cap_chan_rx_give_credits(chan, credits);
|
||||||
|
|
||||||
buf = bt_l2cap_create_pdu(&le_sig, 0);
|
buf = bt_l2cap_create_pdu(&le_sig, 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue