Bluetooth: L2CAP: Move bt_l2cap_br_fixed_chan_register() to l2cap_br.c

Moves, specific for BR/EDR transport, register fixed channel handler
to l2cap_br.c file and make it local. Then using it register BR/EDR
signal channel (CID 1) context during channel layer initialization
in 'bt_l2cap_br_init'.

Change-Id: I5e23fc5d43ae3d7838ecb44ad4fa631eccc8cb4c
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
Arkadiusz Lichwa 2016-05-10 17:52:47 +02:00 committed by Johan Hedberg
commit c071b3e770
3 changed files with 20 additions and 26 deletions

View file

@ -81,10 +81,6 @@ static NET_BUF_POOL(le_data_pool, CONFIG_BLUETOOTH_MAX_CONN,
BT_BUF_USER_DATA_MIN);
#endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */
#if defined(CONFIG_BLUETOOTH_BREDR)
static struct bt_l2cap_fixed_chan *br_channels;
#endif /* CONFIG_BLUETOOTH_BREDR */
/* L2CAP signalling channel specific context */
struct bt_l2cap {
/* The channel this context is associated with */
@ -1095,15 +1091,6 @@ void bt_l2cap_init(void)
.cid = BT_L2CAP_CID_LE_SIG,
.accept = l2cap_accept,
};
#if defined(CONFIG_BLUETOOTH_BREDR)
static struct bt_l2cap_fixed_chan chan_br = {
.cid = BT_L2CAP_CID_BR_SIG,
.mask = BT_L2CAP_MASK_BR_SIG,
.accept = l2cap_accept,
};
bt_l2cap_br_init();
bt_l2cap_br_fixed_chan_register(&chan_br);
#endif /* CONFIG_BLUETOOTH_BREDR */
net_buf_pool_init(le_sig_pool);
#if defined(CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL)
@ -1111,6 +1098,10 @@ void bt_l2cap_init(void)
#endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */
bt_l2cap_le_fixed_chan_register(&chan);
#if defined(CONFIG_BLUETOOTH_BREDR)
bt_l2cap_br_init();
#endif /* CONFIG_BLUETOOTH_BREDR */
}
struct bt_l2cap_chan *bt_l2cap_lookup_tx_cid(struct bt_conn *conn,
@ -1363,13 +1354,3 @@ int bt_l2cap_chan_send(struct bt_l2cap_chan *chan, struct net_buf *buf)
return err;
}
#endif /* CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL */
#if defined(CONFIG_BLUETOOTH_BREDR)
void bt_l2cap_br_fixed_chan_register(struct bt_l2cap_fixed_chan *chan)
{
BT_DBG("CID 0x%04x", chan->cid);
chan->_next = br_channels;
br_channels = chan;
}
#endif /* CONFIG_BLUETOOTH_BREDR */

View file

@ -46,6 +46,7 @@
#define L2CAP_BR_MIN_MTU 48
static struct bt_l2cap_server *br_servers;
static struct bt_l2cap_fixed_chan *br_channels;
/* Pool for outgoing BR/EDR signaling packets, min MTU is 48 */
static struct nano_fifo br_sig;
@ -96,7 +97,22 @@ int bt_l2cap_br_server_register(struct bt_l2cap_server *server)
return 0;
}
static void bt_l2cap_br_fixed_chan_register(struct bt_l2cap_fixed_chan *chan)
{
BT_DBG("CID 0x%04x", chan->cid);
chan->_next = br_channels;
br_channels = chan;
}
void bt_l2cap_br_init(void)
{
static struct bt_l2cap_fixed_chan chan_br = {
.cid = BT_L2CAP_CID_BR_SIG,
.mask = BT_L2CAP_MASK_BR_SIG,
.accept = NULL,
};
net_buf_pool_init(br_sig_pool);
bt_l2cap_br_fixed_chan_register(&chan_br);
}

View file

@ -169,9 +169,6 @@ struct bt_l2cap_chan *bt_l2cap_lookup_rx_cid(struct bt_conn *conn,
uint16_t cid);
#if defined(CONFIG_BLUETOOTH_BREDR)
/* Register a fixed L2CAP channel for BR/EDR connection transport */
void bt_l2cap_br_fixed_chan_register(struct bt_l2cap_fixed_chan *chan);
/* Initialize BR/EDR L2CAP signal layer */
void bt_l2cap_br_init(void);