Bluetooth: hci_core: Make hci_is_le_conn_scanning public
[platform/kernel/linux-rpi.git] / include / net / bluetooth / hci_core.h
index d2a3a2a..f4462c3 100644 (file)
@@ -1372,6 +1372,27 @@ static inline struct hci_conn *hci_lookup_le_connect(struct hci_dev *hdev)
        return NULL;
 }
 
+/* Returns true if an le connection is in the scanning state */
+static inline bool hci_is_le_conn_scanning(struct hci_dev *hdev)
+{
+       struct hci_conn_hash *h = &hdev->conn_hash;
+       struct hci_conn  *c;
+
+       rcu_read_lock();
+
+       list_for_each_entry_rcu(c, &h->list, list) {
+               if (c->type == LE_LINK && c->state == BT_CONNECT &&
+                   test_bit(HCI_CONN_SCANNING, &c->flags)) {
+                       rcu_read_unlock();
+                       return true;
+               }
+       }
+
+       rcu_read_unlock();
+
+       return false;
+}
+
 int hci_disconnect(struct hci_conn *conn, __u8 reason);
 bool hci_setup_sync(struct hci_conn *conn, __u16 handle);
 void hci_sco_setup(struct hci_conn *conn, __u8 status);