From: Johan Hedberg <johan.hedberg@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 2/9 v4] Bluetooth: Simplify UUIDs clearing code
Date: Sun, 27 Jan 2013 00:31:28 +0200 [thread overview]
Message-ID: <1359239495-3444-3-git-send-email-johan.hedberg@gmail.com> (raw)
In-Reply-To: <1359239495-3444-1-git-send-email-johan.hedberg@gmail.com>
From: Johan Hedberg <johan.hedberg@intel.com>
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>
---
net/bluetooth/hci_core.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index e061b35..618ca1a 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -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);
}
--
1.7.10.4
next prev parent reply other threads:[~2013-01-26 22:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-26 22:31 [PATCH 0/9 v4] Bluetooth: Add 32 and 128 bit EIR UUID support Johan Hedberg
2013-01-26 22:31 ` [PATCH 1/9 v4] Bluetooth: Store UUIDs in the same order that they were added Johan Hedberg
2013-01-26 22:31 ` Johan Hedberg [this message]
2013-01-26 22:31 ` [PATCH 3/9 v4] Bluetooth: Keep track of UUID type upon addition Johan Hedberg
2013-01-27 3:14 ` Marcel Holtmann
2013-01-26 22:31 ` [PATCH 4/9 v4] Bluetooth: Simplify UUID removal code Johan Hedberg
2013-01-26 22:31 ` [PATCH 5/9 v4] Bluetooth: Simplify UUID16 list generation for EIR Johan Hedberg
2013-01-26 22:31 ` [PATCH 6/9 v4] Bluetooth: Remove useless eir_len variable from EIR creation Johan Hedberg
2013-01-26 22:31 ` [PATCH 7/9 v4] Bluetooth: Refactor UUID-16 list generation into its own function Johan Hedberg
2013-01-26 22:31 ` [PATCH 8/9 v4] Bluetooth: Add support for 32-bit UUIDs in EIR data Johan Hedberg
2013-01-26 22:31 ` [PATCH 9/9 v4] Bluetooth: Add support for 128-bit " Johan Hedberg
2013-01-28 18:28 ` Gustavo Padovan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1359239495-3444-3-git-send-email-johan.hedberg@gmail.com \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).