return 0;
}
-/* This function requires the caller holds hdev->lock */
-void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type)
+static void hci_conn_params_free(struct hci_conn_params *params)
{
- struct hci_conn_params *params;
-
- params = hci_conn_params_lookup(hdev, addr, addr_type);
- if (!params)
- return;
-
if (params->conn) {
hci_conn_drop(params->conn);
hci_conn_put(params->conn);
list_del(¶ms->action);
list_del(¶ms->list);
kfree(params);
+}
+
+/* This function requires the caller holds hdev->lock */
+void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type)
+{
+ struct hci_conn_params *params;
+
+ params = hci_conn_params_lookup(hdev, addr, addr_type);
+ if (!params)
+ return;
+
+ hci_conn_params_free(params);
hci_update_background_scan(hdev);
{
struct hci_conn_params *params, *tmp;
- list_for_each_entry_safe(params, tmp, &hdev->le_conn_params, list) {
- if (params->conn) {
- hci_conn_drop(params->conn);
- hci_conn_put(params->conn);
- }
- list_del(¶ms->action);
- list_del(¶ms->list);
- kfree(params);
- }
+ list_for_each_entry_safe(params, tmp, &hdev->le_conn_params, list)
+ hci_conn_params_free(params);
hci_update_background_scan(hdev);