Bluetooth: Simplify UUIDs clearing code
authorJohan Hedberg <johan.hedberg@intel.com>
Sat, 26 Jan 2013 22:31:28 +0000 (00:31 +0200)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Fri, 1 Feb 2013 17:50:16 +0000 (15:50 -0200)
The code for clearing the UUIDs list can be simplified by using
list_for_each_entry_safe instead of list_for_each_safe.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
net/bluetooth/hci_core.c

index d13ce99b410aabc5018942b1ffe26d8a10bd4b95..22e77a7865458d550346ab708a270d4be40e891b 100644 (file)
@@ -1183,14 +1183,10 @@ static void hci_discov_off(struct work_struct *work)
 
 int hci_uuids_clear(struct hci_dev *hdev)
 {
-       struct list_head *p, *n;
-
-       list_for_each_safe(p, n, &hdev->uuids) {
-               struct bt_uuid *uuid;
+       struct bt_uuid *uuid, *tmp;
 
-               uuid = list_entry(p, struct bt_uuid, list);
-
-               list_del(p);
+       list_for_each_entry_safe(uuid, tmp, &hdev->uuids, list) {
+               list_del(&uuid->list);
                kfree(uuid);
        }