summaryrefslogtreecommitdiff
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-07-01 19:28:24 +0200
committerMarcel Holtmann <marcel@holtmann.org>2014-07-03 17:42:54 +0200
commitc83ed19d23909db10a4402d4c6c0164bab9a9cf0 (patch)
tree136f0c83780a62c53e8360c3ddf233ce6884b01a /net/bluetooth/mgmt.c
parentb8221770c984bcd185c93cb3a31acab27b67c94a (diff)
downloadlwn-c83ed19d23909db10a4402d4c6c0164bab9a9cf0.tar.gz
lwn-c83ed19d23909db10a4402d4c6c0164bab9a9cf0.zip
Bluetooth: Ensure that background scanning gets enabled on power on
The background scanning normally gets enabled during power on by adding devices to the pending connection list. However devices might be already on that list and the list of devices is empty, then it is better to trigger the background manually. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 336a2311bdca..408468c07a8a 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -5283,11 +5283,27 @@ void mgmt_index_removed(struct hci_dev *hdev)
static void restart_le_auto_conns(struct hci_dev *hdev)
{
struct hci_conn_params *p;
+ bool added = false;
list_for_each_entry(p, &hdev->le_conn_params, list) {
- if (p->auto_connect == HCI_AUTO_CONN_ALWAYS)
+ if (p->auto_connect == HCI_AUTO_CONN_ALWAYS) {
hci_pend_le_conn_add(hdev, &p->addr, p->addr_type);
+ added = true;
+ }
}
+
+ /* Calling hci_pend_le_conn_add will actually already trigger
+ * background scanning when needed. So no need to trigger it
+ * just another time.
+ *
+ * This check is here to avoid an unneeded restart of the
+ * passive scanning. Since this is during the controller
+ * power up phase the duplicate filtering is not an issue.
+ */
+ if (added)
+ return;
+
+ hci_update_background_scan(hdev);
}
static void powered_complete(struct hci_dev *hdev, u8 status)