Bluetooth: Simplify UUID removal code
authorJohan Hedberg <johan.hedberg@intel.com>
Sat, 26 Jan 2013 22:31:30 +0000 (00:31 +0200)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Fri, 1 Feb 2013 17:50:17 +0000 (15:50 -0200)
The UUID removal code 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/mgmt.c

index 8de6d576dc7098ef6807f76508d8f85d6555bfb4..1e906d8d86ac3e5782464d785901d66a666a6402 100644 (file)
@@ -1372,7 +1372,7 @@ static int remove_uuid(struct sock *sk, struct hci_dev *hdev, void *data,
 {
        struct mgmt_cp_remove_uuid *cp = data;
        struct pending_cmd *cmd;
-       struct list_head *p, *n;
+       struct bt_uuid *match, *tmp;
        u8 bt_uuid_any[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
        int err, found;
 
@@ -1400,9 +1400,7 @@ static int remove_uuid(struct sock *sk, struct hci_dev *hdev, void *data,
 
        found = 0;
 
-       list_for_each_safe(p, n, &hdev->uuids) {
-               struct bt_uuid *match = list_entry(p, struct bt_uuid, list);
-
+       list_for_each_entry_safe(match, tmp, &hdev->uuids, list) {
                if (memcmp(match->uuid, cp->uuid, 16) != 0)
                        continue;