Bluetooth: Add specific connection parameter clear functions
authorJohan Hedberg <johan.hedberg@intel.com>
Wed, 2 Jul 2014 14:37:26 +0000 (17:37 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 3 Jul 2014 15:42:56 +0000 (17:42 +0200)
In some circumstances we'll need to either clear only the enabled
parameters or only the disabled ones. This patch adds convenience
functions for this purpose.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_core.c

index 091934bcfd84bf157a56f3e555044eb4ac29078f..2091e0013b8c946b45aaf10e913e0494a5225cc7 100644 (file)
@@ -862,6 +862,8 @@ int hci_conn_params_set(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
                        u8 auto_connect);
 void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
 void hci_conn_params_clear_all(struct hci_dev *hdev);
+void hci_conn_params_clear_disabled(struct hci_dev *hdev);
+void hci_conn_params_clear_enabled(struct hci_dev *hdev);
 
 struct bdaddr_list *hci_pend_le_conn_lookup(struct hci_dev *hdev,
                                            bdaddr_t *addr, u8 addr_type);
index e6e169007fd26d70140bb85241d1423b44c8039c..7e46a7c6092f2f488f6e6120c810f1dd41ab511f 100644 (file)
@@ -3579,6 +3579,38 @@ void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type)
        BT_DBG("addr %pMR (type %u)", addr, addr_type);
 }
 
+/* This function requires the caller holds hdev->lock */
+void hci_conn_params_clear_disabled(struct hci_dev *hdev)
+{
+       struct hci_conn_params *params, *tmp;
+
+       list_for_each_entry_safe(params, tmp, &hdev->le_conn_params, list) {
+               if (params->auto_connect != HCI_AUTO_CONN_DISABLED)
+                       continue;
+               list_del(&params->list);
+               kfree(params);
+       }
+
+       BT_DBG("All LE disabled connection parameters were removed");
+}
+
+/* This function requires the caller holds hdev->lock */
+void hci_conn_params_clear_enabled(struct hci_dev *hdev)
+{
+       struct hci_conn_params *params, *tmp;
+
+       list_for_each_entry_safe(params, tmp, &hdev->le_conn_params, list) {
+               if (params->auto_connect == HCI_AUTO_CONN_DISABLED)
+                       continue;
+               list_del(&params->list);
+               kfree(params);
+       }
+
+       hci_pend_le_conns_clear(hdev);
+
+       BT_DBG("All enabled LE connection parameters were removed");
+}
+
 /* This function requires the caller holds hdev->lock */
 void hci_conn_params_clear_all(struct hci_dev *hdev)
 {
This page took 0.035637 seconds and 5 git commands to generate.