summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorJohan Hedberg2014-07-04 11:37:18 +0200
committerMarcel Holtmann2014-07-04 11:58:08 +0200
commit66f8455aeac3427110d451534567eb1b9aea6929 (patch)
tree23116c8f24bcf1ee2488ac71b1d615b13cf3f16f /net/bluetooth/hci_core.c
parentBluetooth: Convert pend_le_conn list to a generic action list (diff)
downloadkernel-qcow2-linux-66f8455aeac3427110d451534567eb1b9aea6929.tar.gz
kernel-qcow2-linux-66f8455aeac3427110d451534567eb1b9aea6929.tar.xz
kernel-qcow2-linux-66f8455aeac3427110d451534567eb1b9aea6929.zip
Bluetooth: Convert pend_le_reports into a list
To simplify manipulation and lookup of hci_conn_params entries of the type HCI_AUTO_CONN_REPORT it makes sense to store them in their own list. The new action list_head in hci_conn_params is used for this purpose. 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, 11 insertions, 6 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index fed2a0648d3d..296f44748636 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3529,7 +3529,7 @@ int hci_conn_params_set(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
if (params->auto_connect == HCI_AUTO_CONN_REPORT &&
auto_connect != HCI_AUTO_CONN_REPORT)
- hdev->pend_le_reports--;
+ list_del_init(&params->action);
switch (auto_connect) {
case HCI_AUTO_CONN_DISABLED:
@@ -3537,8 +3537,11 @@ int hci_conn_params_set(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
hci_pend_le_conn_del(hdev, params);
break;
case HCI_AUTO_CONN_REPORT:
- if (params->auto_connect != HCI_AUTO_CONN_REPORT)
- hdev->pend_le_reports++;
+ if (params->auto_connect != HCI_AUTO_CONN_REPORT) {
+ list_del_init(&params->action);
+ list_add(&params->action,
+ &hdev->pend_le_reports);
+ }
hci_pend_le_conn_del(hdev, params);
break;
case HCI_AUTO_CONN_ALWAYS:
@@ -3565,7 +3568,7 @@ void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type)
return;
if (params->auto_connect == HCI_AUTO_CONN_REPORT)
- hdev->pend_le_reports--;
+ list_del_init(&params->action);
hci_pend_le_conn_del(hdev, params);
@@ -3599,7 +3602,7 @@ void hci_conn_params_clear_enabled(struct hci_dev *hdev)
if (params->auto_connect == HCI_AUTO_CONN_DISABLED)
continue;
if (params->auto_connect == HCI_AUTO_CONN_REPORT)
- hdev->pend_le_reports--;
+ list_del_init(&params->action);
list_del(&params->list);
kfree(params);
}
@@ -3859,6 +3862,7 @@ struct hci_dev *hci_alloc_dev(void)
INIT_LIST_HEAD(&hdev->le_white_list);
INIT_LIST_HEAD(&hdev->le_conn_params);
INIT_LIST_HEAD(&hdev->pend_le_conns);
+ INIT_LIST_HEAD(&hdev->pend_le_reports);
INIT_LIST_HEAD(&hdev->conn_hash.list);
INIT_WORK(&hdev->rx_work, hci_rx_work);
@@ -5362,7 +5366,8 @@ void hci_update_background_scan(struct hci_dev *hdev)
hci_req_init(&req, hdev);
- if (list_empty(&hdev->pend_le_conns) && !hdev->pend_le_reports) {
+ if (list_empty(&hdev->pend_le_conns) &&
+ list_empty(&hdev->pend_le_reports)) {
/* If there is no pending LE connections or devices
* to be scanned for, we should stop the background
* scanning.