summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohan Hedberg2014-07-02 16:37:26 +0200
committerMarcel Holtmann2014-07-03 17:42:56 +0200
commit55af49a8fe85278ea244e72d2d264cf5e0941c61 (patch)
treee3bfd77100187acca4f8d872b28eaf43421b81fa /net
parentBluetooth: Rename hci_conn_params_clear to hci_conn_params_clear_all (diff)
downloadkernel-qcow2-linux-55af49a8fe85278ea244e72d2d264cf5e0941c61.tar.gz
kernel-qcow2-linux-55af49a8fe85278ea244e72d2d264cf5e0941c61.tar.xz
kernel-qcow2-linux-55af49a8fe85278ea244e72d2d264cf5e0941c61.zip
Bluetooth: Add specific connection parameter clear functions
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>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_core.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index e6e169007fd2..7e46a7c6092f 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3580,6 +3580,38 @@ void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 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)
{
struct hci_conn_params *params, *tmp;