Bluetooth: host: Rename acl context id to index
Rename the acl buf context id to index since to avoid confusing it with the conn object ID parameter. Especially the bt_conn_lookup_id function was creating confusion. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
8f740f9edf
commit
4e829eb544
3 changed files with 11 additions and 10 deletions
|
@ -2630,15 +2630,15 @@ u8_t bt_conn_index(struct bt_conn *conn)
|
|||
return index;
|
||||
}
|
||||
|
||||
struct bt_conn *bt_conn_lookup_id(u8_t id)
|
||||
struct bt_conn *bt_conn_lookup_index(u8_t index)
|
||||
{
|
||||
struct bt_conn *conn;
|
||||
|
||||
if (id >= ARRAY_SIZE(conns)) {
|
||||
if (index >= ARRAY_SIZE(conns)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
conn = &conns[id];
|
||||
conn = &conns[index];
|
||||
|
||||
if (!atomic_get(&conn->ref)) {
|
||||
return NULL;
|
||||
|
|
|
@ -208,8 +208,8 @@ int bt_conn_addr_le_cmp(const struct bt_conn *conn, const bt_addr_le_t *peer);
|
|||
* the connection list. This is useful for O(1) lookups, but can't be used
|
||||
* e.g. as the handle since that's assigned to us by the controller.
|
||||
*/
|
||||
#define BT_CONN_ID_INVALID 0xff
|
||||
struct bt_conn *bt_conn_lookup_id(u8_t id);
|
||||
#define BT_CONN_INDEX_INVALID 0xff
|
||||
struct bt_conn *bt_conn_lookup_index(u8_t index);
|
||||
|
||||
/* Look up a connection state. For BT_ADDR_LE_ANY, returns the first connection
|
||||
* with the specific state
|
||||
|
|
|
@ -138,7 +138,7 @@ struct acl_data {
|
|||
u8_t type;
|
||||
|
||||
/* Index into the bt_conn storage array */
|
||||
u8_t id;
|
||||
u8_t index;
|
||||
|
||||
/** ACL connection handle */
|
||||
u16_t handle;
|
||||
|
@ -234,9 +234,10 @@ static void report_completed_packet(struct net_buf *buf)
|
|||
return;
|
||||
}
|
||||
|
||||
conn = bt_conn_lookup_id(acl(buf)->id);
|
||||
conn = bt_conn_lookup_index(acl(buf)->index);
|
||||
if (!conn) {
|
||||
BT_WARN("Unable to look up conn with id 0x%02x", acl(buf)->id);
|
||||
BT_WARN("Unable to look up conn with index 0x%02x",
|
||||
acl(buf)->index);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -778,7 +779,7 @@ static void hci_acl(struct net_buf *buf)
|
|||
flags = bt_acl_flags(handle);
|
||||
|
||||
acl(buf)->handle = bt_acl_handle(handle);
|
||||
acl(buf)->id = BT_CONN_ID_INVALID;
|
||||
acl(buf)->index = BT_CONN_INDEX_INVALID;
|
||||
|
||||
BT_DBG("handle %u len %u flags %u", acl(buf)->handle, len, flags);
|
||||
|
||||
|
@ -795,7 +796,7 @@ static void hci_acl(struct net_buf *buf)
|
|||
return;
|
||||
}
|
||||
|
||||
acl(buf)->id = bt_conn_index(conn);
|
||||
acl(buf)->index = bt_conn_index(conn);
|
||||
|
||||
bt_conn_recv(conn, buf, flags);
|
||||
bt_conn_unref(conn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue