linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gustavo Padovan <gustavo@padovan.org>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 2/3] Bluetooth: use list_for_each_entry_safe()
Date: Wed, 16 May 2012 12:17:11 -0300	[thread overview]
Message-ID: <1337181432-979-2-git-send-email-gustavo@padovan.org> (raw)
In-Reply-To: <1337181432-979-1-git-send-email-gustavo@padovan.org>

Use of list_for_each_entry_safe is cleaner, then replace the
list_for_each_safe() + list_entry().

Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
---
 net/bluetooth/af_bluetooth.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index 46e7f86..c5f34cc 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -404,11 +404,9 @@ EXPORT_SYMBOL(bt_sock_stream_recvmsg);
 
 static inline unsigned int bt_accept_poll(struct sock *parent)
 {
-	struct list_head *p, *n;
-	struct sock *sk;
+	struct sock *sk, *n;
 
-	list_for_each_safe(p, n, &bt_sk(parent)->accept_q) {
-		sk = (struct sock *) list_entry(p, struct bt_sock, accept_q);
+	list_for_each_entry_safe(sk, n, &bt_sk(parent), accept_q) {
 		if (sk->sk_state == BT_CONNECTED ||
 		    (test_bit(BT_SK_DEFER_SETUP, &bt_sk(parent)->flags) &&
 		     sk->sk_state == BT_CONNECT2))
-- 
1.7.10.1


  reply	other threads:[~2012-05-16 15:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-16 15:17 [PATCH 1/3] Bluetooth: Create flags for bt_sk() Gustavo Padovan
2012-05-16 15:17 ` Gustavo Padovan [this message]
2012-05-16 15:17   ` [PATCH 3/3] Bluetooth: Report proper error number in disconnection Gustavo Padovan
2012-05-16 15:45 ` [PATCH 1/3] Bluetooth: Create flags for bt_sk() Johan Hedberg

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=1337181432-979-2-git-send-email-gustavo@padovan.org \
    --to=gustavo@padovan.org \
    --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).