aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/bluetooth/hci_core.h
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-11-03 05:16:08 +0100
committerJohan Hedberg <johan.hedberg@intel.com>2014-11-03 10:13:43 +0200
commit845472e8d50c898c73b4f69f4edad5249b13d6a9 (patch)
tree7df3c2c65552aa09aab6d8d314dc94136fa847b6 /include/net/bluetooth/hci_core.h
parentBluetooth: btusb: Add internal callback for USB bulk rx data (diff)
downloadlinux-dev-845472e8d50c898c73b4f69f4edad5249b13d6a9.tar.xz
linux-dev-845472e8d50c898c73b4f69f4edad5249b13d6a9.zip
Bluetooth: Add hci_conn_lookup_type() helper function
Some drivers require knowledge of what connection handle is assigned to what connection link type (ACL or SCO/eSCO). Instead of having each driver implement connection tracking, provide a simple helper function for lookup of the link type. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'include/net/bluetooth/hci_core.h')
-rw-r--r--include/net/bluetooth/hci_core.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 27ddb905b351..4e39a5adfcab 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -646,6 +646,26 @@ static inline unsigned int hci_conn_count(struct hci_dev *hdev)
return c->acl_num + c->amp_num + c->sco_num + c->le_num;
}
+static inline __u8 hci_conn_lookup_type(struct hci_dev *hdev, __u16 handle)
+{
+ struct hci_conn_hash *h = &hdev->conn_hash;
+ struct hci_conn *c;
+ __u8 type = INVALID_LINK;
+
+ rcu_read_lock();
+
+ list_for_each_entry_rcu(c, &h->list, list) {
+ if (c->handle == handle) {
+ type = c->type;
+ break;
+ }
+ }
+
+ rcu_read_unlock();
+
+ return type;
+}
+
static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
__u16 handle)
{