* [B.A.T.M.A.N.] [PATCH 07/14] batman-adv: use list_for_each_entry_safe
[not found] <ab66a344512e064000357c6d3c2a6f3d0e948ddb.1450451516.git.geliangtang@163.com>
@ 2015-12-18 15:33 ` Geliang Tang
2015-12-21 14:42 ` Antonio Quartulli
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Geliang Tang @ 2015-12-18 15:33 UTC (permalink / raw)
To: Marek Lindner, Simon Wunderlich, Antonio Quartulli, David S. Miller
Cc: Geliang Tang, b.a.t.m.a.n, linux-kernel, netdev
Use list_for_each_entry_safe() instead of list_for_each_safe() to
simplify the code.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
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 bcabb5e..841239c 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.5.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH 07/14] batman-adv: use list_for_each_entry_safe
2015-12-18 15:33 ` [B.A.T.M.A.N.] [PATCH 07/14] batman-adv: use list_for_each_entry_safe Geliang Tang
@ 2015-12-21 14:42 ` Antonio Quartulli
2016-03-10 19:37 ` Sven Eckelmann
2016-03-28 15:02 ` Marek Lindner
2 siblings, 0 replies; 4+ messages in thread
From: Antonio Quartulli @ 2015-12-21 14:42 UTC (permalink / raw)
To: Geliang Tang
Cc: Marek Lindner, netdev, b.a.t.m.a.n, linux-kernel, David S. Miller
[-- Attachment #1: Type: text/plain, Size: 682 bytes --]
Hi Geliang,
> 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;
>
[...]
> + list_for_each_entry_safe(packet, tmp, &client->queue_list, list) {
I guess you renamed those variables to make sure that the statement
above would fit in 80 chars.. in that case the patch looks good.
Acked-by: Antonio Quartulli <a@unstable.cc>
--
Antonio Quartulli
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH 07/14] batman-adv: use list_for_each_entry_safe
2015-12-18 15:33 ` [B.A.T.M.A.N.] [PATCH 07/14] batman-adv: use list_for_each_entry_safe Geliang Tang
2015-12-21 14:42 ` Antonio Quartulli
@ 2016-03-10 19:37 ` Sven Eckelmann
2016-03-28 15:02 ` Marek Lindner
2 siblings, 0 replies; 4+ messages in thread
From: Sven Eckelmann @ 2016-03-10 19:37 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Geliang Tang, Antonio Quartulli, Marek Lindner
[-- Attachment #1: Type: text/plain, Size: 1792 bytes --]
On Friday 18 December 2015 23:33:31 Geliang Tang wrote:
> Use list_for_each_entry_safe() instead of list_for_each_safe() to
> simplify the code.
>
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
> net/batman-adv/icmp_socket.c | 22 +++++++++-------------
> 1 file changed, 9 insertions(+), 13 deletions(-)
Reviewed-by: Sven Eckelmann <sven@narfation.org>
Kind regards,
Sven
>
> diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c
> index bcabb5e..841239c 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;
>
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH 07/14] batman-adv: use list_for_each_entry_safe
2015-12-18 15:33 ` [B.A.T.M.A.N.] [PATCH 07/14] batman-adv: use list_for_each_entry_safe Geliang Tang
2015-12-21 14:42 ` Antonio Quartulli
2016-03-10 19:37 ` Sven Eckelmann
@ 2016-03-28 15:02 ` Marek Lindner
2 siblings, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2016-03-28 15:02 UTC (permalink / raw)
To: b.a.t.m.a.n
Cc: netdev, Antonio Quartulli, linux-kernel, Geliang Tang, David S. Miller
[-- Attachment #1: Type: text/plain, Size: 383 bytes --]
On Friday, December 18, 2015 23:33:31 Geliang Tang wrote:
> Use list_for_each_entry_safe() instead of list_for_each_safe() to
> simplify the code.
>
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
> net/batman-adv/icmp_socket.c | 22 +++++++++-------------
> 1 file changed, 9 insertions(+), 13 deletions(-)
Applied in the batman tree (revision 1557404).
Thanks,
Marek
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-28 15:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <ab66a344512e064000357c6d3c2a6f3d0e948ddb.1450451516.git.geliangtang@163.com>
2015-12-18 15:33 ` [B.A.T.M.A.N.] [PATCH 07/14] batman-adv: use list_for_each_entry_safe Geliang Tang
2015-12-21 14:42 ` Antonio Quartulli
2016-03-10 19:37 ` Sven Eckelmann
2016-03-28 15:02 ` Marek Lindner
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).