Bluetooth: Add convenience function for getting total connection count
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 24 Feb 2014 12:52:16 +0000 (14:52 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 24 Feb 2014 19:10:35 +0000 (11:10 -0800)
This patch adds a convenience function to return the number of
connections in the conn_hash list. This will be useful once we update
the power off procedure to disconnect any open connections.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/hci_core.h

index fb3b677ff8a62277abba510d0c29430699752ff8..d2d75675371442eaf56d3ecbee5f5f1e7a85d0fc 100644 (file)
@@ -561,6 +561,13 @@ static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type)
        }
 }
 
+static inline unsigned int hci_conn_count(struct hci_dev *hdev)
+{
+       struct hci_conn_hash *c = &hdev->conn_hash;
+
+       return c->acl_num + c->amp_num + c->sco_num + c->le_num;
+}
+
 static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
                                                                __u16 handle)
 {