aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-07-02 15:42:00 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-07-03 11:42:58 -0400
commit851efca8387e10a25ca259f7efcc47819b19bff9 (patch)
tree91644ae618384fdec8b351be5b21998ed718ddaa /net/bluetooth/hci_core.c
parent82a30cfcb85538b677817815939306d20d5b8e61 (diff)
Bluetooth: Track number of added devices with HCI_AUTO_CONN_REPORT
To be able to make the right choice of whether to start passive scanning or to send out a mgmt_device_found event we need to know if there are any devices in the le_conn_params list with the auto_connect value set to HCI_AUTO_CONN_REPORT. This patch adds a counter for this kind of devices. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index df25a8329ecc..8e0061f72dd1 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3545,20 +3545,28 @@ int hci_conn_params_set(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
3545 if (!params) 3545 if (!params)
3546 return -EIO; 3546 return -EIO;
3547 3547
3548 params->auto_connect = auto_connect; 3548 if (params->auto_connect == HCI_AUTO_CONN_REPORT &&
3549 auto_connect != HCI_AUTO_CONN_REPORT)
3550 hdev->pend_le_reports--;
3549 3551
3550 switch (auto_connect) { 3552 switch (auto_connect) {
3551 case HCI_AUTO_CONN_DISABLED: 3553 case HCI_AUTO_CONN_DISABLED:
3552 case HCI_AUTO_CONN_REPORT:
3553 case HCI_AUTO_CONN_LINK_LOSS: 3554 case HCI_AUTO_CONN_LINK_LOSS:
3554 hci_pend_le_conn_del(hdev, addr, addr_type); 3555 hci_pend_le_conn_del(hdev, addr, addr_type);
3555 break; 3556 break;
3557 case HCI_AUTO_CONN_REPORT:
3558 if (params->auto_connect != HCI_AUTO_CONN_REPORT)
3559 hdev->pend_le_reports++;
3560 hci_pend_le_conn_del(hdev, addr, addr_type);
3561 break;
3556 case HCI_AUTO_CONN_ALWAYS: 3562 case HCI_AUTO_CONN_ALWAYS:
3557 if (!is_connected(hdev, addr, addr_type)) 3563 if (!is_connected(hdev, addr, addr_type))
3558 hci_pend_le_conn_add(hdev, addr, addr_type); 3564 hci_pend_le_conn_add(hdev, addr, addr_type);
3559 break; 3565 break;
3560 } 3566 }
3561 3567
3568 params->auto_connect = auto_connect;
3569
3562 BT_DBG("addr %pMR (type %u) auto_connect %u", addr, addr_type, 3570 BT_DBG("addr %pMR (type %u) auto_connect %u", addr, addr_type,
3563 auto_connect); 3571 auto_connect);
3564 3572
@@ -3574,6 +3582,9 @@ void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type)
3574 if (!params) 3582 if (!params)
3575 return; 3583 return;
3576 3584
3585 if (params->auto_connect == HCI_AUTO_CONN_REPORT)
3586 hdev->pend_le_reports--;
3587
3577 hci_pend_le_conn_del(hdev, addr, addr_type); 3588 hci_pend_le_conn_del(hdev, addr, addr_type);
3578 3589
3579 list_del(&params->list); 3590 list_del(&params->list);
@@ -3605,6 +3616,8 @@ void hci_conn_params_clear_enabled(struct hci_dev *hdev)
3605 list_for_each_entry_safe(params, tmp, &hdev->le_conn_params, list) { 3616 list_for_each_entry_safe(params, tmp, &hdev->le_conn_params, list) {
3606 if (params->auto_connect == HCI_AUTO_CONN_DISABLED) 3617 if (params->auto_connect == HCI_AUTO_CONN_DISABLED)
3607 continue; 3618 continue;
3619 if (params->auto_connect == HCI_AUTO_CONN_REPORT)
3620 hdev->pend_le_reports--;
3608 list_del(&params->list); 3621 list_del(&params->list);
3609 kfree(params); 3622 kfree(params);
3610 } 3623 }