b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Antonio Quartulli <a@unstable.cc>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
	Antonio Quartulli <a@unstable.cc>,
	Marek Lindner <mareklindner@neomailbox.ch>,
	Geliang Tang <geliangtang@163.com>
Subject: [B.A.T.M.A.N.] [PATCH 05/15] batman-adv: use list_for_each_entry_safe
Date: Wed,  4 May 2016 06:23:40 +0800	[thread overview]
Message-ID: <1462314230-16257-6-git-send-email-a@unstable.cc> (raw)
In-Reply-To: <1462314230-16257-1-git-send-email-a@unstable.cc>

From: Geliang Tang <geliangtang@163.com>

Use list_for_each_entry_safe() instead of list_for_each_safe() to
simplify the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: Antonio Quartulli <a@unstable.cc>
Reviewed-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 net/batman-adv/icmp_socket.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c
index 14d0013b387e..8a5889d134bc 100644
--- a/net/batman-adv/icmp_socket.c
+++ b/net/batman-adv/icmp_socket.c
@@ -104,25 +104,21 @@ static int batadv_socket_open(struct inode *inode, struct file *file)
 
 static int batadv_socket_release(struct inode *inode, struct file *file)
 {
-	struct batadv_socket_client *socket_client = file->private_data;
-	struct batadv_socket_packet *socket_packet;
-	struct list_head *list_pos, *list_pos_tmp;
+	struct batadv_socket_client *client = file->private_data;
+	struct batadv_socket_packet *packet, *tmp;
 
-	spin_lock_bh(&socket_client->lock);
+	spin_lock_bh(&client->lock);
 
 	/* for all packets in the queue ... */
-	list_for_each_safe(list_pos, list_pos_tmp, &socket_client->queue_list) {
-		socket_packet = list_entry(list_pos,
-					   struct batadv_socket_packet, list);
-
-		list_del(list_pos);
-		kfree(socket_packet);
+	list_for_each_entry_safe(packet, tmp, &client->queue_list, list) {
+		list_del(&packet->list);
+		kfree(packet);
 	}
 
-	batadv_socket_client_hash[socket_client->index] = NULL;
-	spin_unlock_bh(&socket_client->lock);
+	batadv_socket_client_hash[client->index] = NULL;
+	spin_unlock_bh(&client->lock);
 
-	kfree(socket_client);
+	kfree(client);
 	module_put(THIS_MODULE);
 
 	return 0;
-- 
2.8.2


  parent reply	other threads:[~2016-05-03 22:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-03 22:23 [B.A.T.M.A.N.] pull request: batman-adv 20160504 Antonio Quartulli
2016-05-03 22:23 ` [B.A.T.M.A.N.] [PATCH 01/15] MAINTAINERS: Mark BATMAN ADVANCED mailing list as moderated Antonio Quartulli
2016-05-03 22:23 ` [B.A.T.M.A.N.] [PATCH 02/15] MAINTAINERS: Add BATMAN ADVANCED documentation files Antonio Quartulli
2016-05-03 22:23 ` [B.A.T.M.A.N.] [PATCH 03/15] batman-adv: Start new development cycle Antonio Quartulli
2016-05-03 22:23 ` [B.A.T.M.A.N.] [PATCH 04/15] batman-adv: use static string for table headers Antonio Quartulli
2016-05-03 22:23 ` Antonio Quartulli [this message]
2016-05-03 22:23 ` [B.A.T.M.A.N.] [PATCH 06/15] batman-adv: use to_delayed_work Antonio Quartulli
2016-05-03 22:23 ` [B.A.T.M.A.N.] [PATCH 07/15] batman-adv: fix wrong names in kerneldoc Antonio Quartulli
2016-05-03 22:23 ` [B.A.T.M.A.N.] [PATCH 08/15] batman-adv: Fix checkpatch warning about 'unsigned' type Antonio Quartulli
2016-05-03 22:23 ` [B.A.T.M.A.N.] [PATCH 09/15] batman-adv: Fix kerneldoc for batadv_compare_claim Antonio Quartulli
2016-05-03 22:23 ` [B.A.T.M.A.N.] [PATCH 10/15] batman-adv: Add kernel-doc for batadv_interface_rx Antonio Quartulli
2016-05-03 22:23 ` [B.A.T.M.A.N.] [PATCH 11/15] batman-adv: Fix function names on new line starting with '*' Antonio Quartulli
2016-05-03 22:23 ` [B.A.T.M.A.N.] [PATCH 12/15] batman-adv: fix debuginfo macro style issue Antonio Quartulli
2016-05-03 22:23 ` [B.A.T.M.A.N.] [PATCH 13/15] batman-adv: move and restructure batadv_v_ogm_forward Antonio Quartulli
2016-05-03 22:23 ` [B.A.T.M.A.N.] [PATCH 14/15] batman-adv: Merge batadv_v_ogm_orig_update into batadv_v_ogm_route_update Antonio Quartulli
2016-05-03 22:23 ` [B.A.T.M.A.N.] [PATCH 15/15] batman-adv: Split batadv_iv_ogm_orig_del_if function Antonio Quartulli
2016-05-04 20:30 ` [B.A.T.M.A.N.] pull request: batman-adv 20160504 David Miller

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=1462314230-16257-6-git-send-email-a@unstable.cc \
    --to=a@unstable.cc \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=geliangtang@163.com \
    --cc=mareklindner@neomailbox.ch \
    --cc=netdev@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).