aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/bluetooth/hci_core.h1
-rw-r--r--net/bluetooth/hci_core.c17
2 files changed, 16 insertions, 2 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 92f1bad6e22d..b5f4405b41c2 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -312,6 +312,7 @@ struct hci_dev {
312 struct list_head le_white_list; 312 struct list_head le_white_list;
313 struct list_head le_conn_params; 313 struct list_head le_conn_params;
314 struct list_head pend_le_conns; 314 struct list_head pend_le_conns;
315 unsigned int pend_le_reports;
315 316
316 struct hci_dev_stats stat; 317 struct hci_dev_stats stat;
317 318
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 }