From: Johan Hedberg Date: Mon, 24 Feb 2014 12:52:16 +0000 (+0200) Subject: Bluetooth: Add convenience function for getting total connection count X-Git-Tag: accepted/tizen/common/20141203.182822~316^2~18^2^2~46^2~74 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f4f07505005932ca5f6c8003323bd38dbd0c769c;p=platform%2Fkernel%2Flinux-arm64.git Bluetooth: Add convenience function for getting total connection count 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 Signed-off-by: Marcel Holtmann --- diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index fb3b677..d2d7567 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -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) {