Bluetooth: Remove unnecessary bt_dev_esco struct

This information should be part of the main BR/EDR context struct,
rather than there being a separate member in struct bt_dev. If/when
the needed ESCO information grows we can consider having a separate
struct, but even then it should be part of the main BR/EDR struct
instead of sitting directly in bt_dev.

Change-Id: I3edf120606ea6c6974f515bba90de2b25fc6fac6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2017-04-21 13:47:08 +03:00 committed by Anas Nashif
commit d1bb961bcf
3 changed files with 15 additions and 19 deletions

View file

@ -412,14 +412,14 @@ struct bt_conn *bt_conn_add_sco(const bt_addr_t *peer, int link_type)
if (link_type == BT_HCI_SCO) { if (link_type == BT_HCI_SCO) {
if (BT_FEAT_LMP_ESCO_CAPABLE(bt_dev.features)) { if (BT_FEAT_LMP_ESCO_CAPABLE(bt_dev.features)) {
sco_conn->sco.pkt_type = (bt_dev.esco.pkt_type & sco_conn->sco.pkt_type = (bt_dev.br.esco_pkt_type &
ESCO_PKT_MASK); ESCO_PKT_MASK);
} else { } else {
sco_conn->sco.pkt_type = (bt_dev.esco.pkt_type & sco_conn->sco.pkt_type = (bt_dev.br.esco_pkt_type &
SCO_PKT_MASK); SCO_PKT_MASK);
} }
} else if (link_type == BT_HCI_ESCO) { } else if (link_type == BT_HCI_ESCO) {
sco_conn->sco.pkt_type = (bt_dev.esco.pkt_type & sco_conn->sco.pkt_type = (bt_dev.br.esco_pkt_type &
~EDR_ESCO_PKT_MASK); ~EDR_ESCO_PKT_MASK);
} }

View file

@ -3145,35 +3145,35 @@ void device_supported_pkt_type(void)
{ {
/* Device supported features and sco packet types */ /* Device supported features and sco packet types */
if (BT_FEAT_HV2_PKT(bt_dev.features)) { if (BT_FEAT_HV2_PKT(bt_dev.features)) {
bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_HV2); bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_HV2);
} }
if (BT_FEAT_HV3_PKT(bt_dev.features)) { if (BT_FEAT_HV3_PKT(bt_dev.features)) {
bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_HV3); bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_HV3);
} }
if (BT_FEAT_LMP_ESCO_CAPABLE(bt_dev.features)) { if (BT_FEAT_LMP_ESCO_CAPABLE(bt_dev.features)) {
bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_EV3); bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_EV3);
} }
if (BT_FEAT_EV4_PKT(bt_dev.features)) { if (BT_FEAT_EV4_PKT(bt_dev.features)) {
bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_EV4); bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_EV4);
} }
if (BT_FEAT_EV5_PKT(bt_dev.features)) { if (BT_FEAT_EV5_PKT(bt_dev.features)) {
bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_EV5); bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_EV5);
} }
if (BT_FEAT_2EV3_PKT(bt_dev.features)) { if (BT_FEAT_2EV3_PKT(bt_dev.features)) {
bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_2EV3); bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_2EV3);
} }
if (BT_FEAT_3EV3_PKT(bt_dev.features)) { if (BT_FEAT_3EV3_PKT(bt_dev.features)) {
bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_3EV3); bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_3EV3);
} }
if (BT_FEAT_3SLOT_PKT(bt_dev.features)) { if (BT_FEAT_3SLOT_PKT(bt_dev.features)) {
bt_dev.esco.pkt_type |= (HCI_PKT_TYPE_ESCO_2EV5 | bt_dev.br.esco_pkt_type |= (HCI_PKT_TYPE_ESCO_2EV5 |
HCI_PKT_TYPE_ESCO_3EV5); HCI_PKT_TYPE_ESCO_3EV5);
} }
} }

View file

@ -66,14 +66,11 @@ struct bt_dev_le {
}; };
#if defined(CONFIG_BLUETOOTH_BREDR) #if defined(CONFIG_BLUETOOTH_BREDR)
struct bt_dev_esco {
u16_t pkt_type;
};
struct bt_dev_br { struct bt_dev_br {
/* Max controller's acceptable ACL packet length */ /* Max controller's acceptable ACL packet length */
u16_t mtu; u16_t mtu;
struct k_sem pkts; struct k_sem pkts;
u16_t esco_pkt_type;
}; };
#endif #endif
@ -108,7 +105,6 @@ struct bt_dev {
#if defined(CONFIG_BLUETOOTH_BREDR) #if defined(CONFIG_BLUETOOTH_BREDR)
/* BR/EDR controller specific features */ /* BR/EDR controller specific features */
struct bt_dev_br br; struct bt_dev_br br;
struct bt_dev_esco esco;
#endif #endif
/* Number of commands controller can accept */ /* Number of commands controller can accept */