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>
This commit is contained in:
Johan Hedberg
2014-07-04 12:37:21 +03:00
committed by Marcel Holtmann
parent 42ce26de67
commit 95305baa77
3 changed files with 17 additions and 23 deletions

View File

@@ -5225,12 +5225,10 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev,
goto unlock;
}
if (params->auto_connect == HCI_AUTO_CONN_REPORT)
list_del_init(&params->action);
hci_pend_le_conn_del(hdev, params);
list_del_init(&params->action);
list_del(&params->list);
kfree(params);
hci_update_background_scan(hdev);
device_removed(sk, hdev, &cp->addr.bdaddr, cp->addr.type);
} else {