summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-07-04 12:37:21 +0300
committerMarcel Holtmann <marcel@holtmann.org>2014-07-04 11:58:09 +0200
commit95305baa779223060c7129100424da6c0d01045b (patch)
treeb9ce90eb4ed888ee95f88a234c6f4432994f16cb /net/bluetooth/hci_core.c
parent42ce26de67e13c50885e7856ff91aaeedf07a81b (diff)
downloadop-kernel-dev-95305baa779223060c7129100424da6c0d01045b.zip
op-kernel-dev-95305baa779223060c7129100424da6c0d01045b.tar.gz
Bluetooth: Simplify hci_conn_params->action list usage
Since params->action is used for both the pend_le_conns and pend_le_reports lists we can simplify the adding and deleting of the lists considerably. For example, when deleting entries in most situations we no-longer need to check the auto_connect value but can directly proceed with calling list_del_init on param->action (which is safe even if the entry is not part of any list). 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.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 0601fcb..3b0da6e 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3528,26 +3528,22 @@ int hci_conn_params_set(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
if (params->auto_connect == auto_connect)
return 0;
- if (params->auto_connect == HCI_AUTO_CONN_REPORT &&
- auto_connect != HCI_AUTO_CONN_REPORT)
- list_del_init(&params->action);
+ list_del_init(&params->action);
switch (auto_connect) {
case HCI_AUTO_CONN_DISABLED:
case HCI_AUTO_CONN_LINK_LOSS:
- hci_pend_le_conn_del(hdev, params);
+ hci_update_background_scan(hdev);
break;
case HCI_AUTO_CONN_REPORT:
- 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);
+ list_add(&params->action, &hdev->pend_le_reports);
+ hci_update_background_scan(hdev);
break;
case HCI_AUTO_CONN_ALWAYS:
- if (!is_connected(hdev, addr, addr_type))
- hci_pend_le_conn_add(hdev, params);
+ if (!is_connected(hdev, addr, addr_type)) {
+ list_add(&params->action, &hdev->pend_le_conns);
+ hci_update_background_scan(hdev);
+ }
break;
}
@@ -3568,14 +3564,12 @@ void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type)
if (!params)
return;
- if (params->auto_connect == HCI_AUTO_CONN_REPORT)
- list_del_init(&params->action);
-
- hci_pend_le_conn_del(hdev, params);
-
+ list_del(&params->action);
list_del(&params->list);
kfree(params);
+ hci_update_background_scan(hdev);
+
BT_DBG("addr %pMR (type %u)", addr, addr_type);
}
OpenPOWER on IntegriCloud