diff options
author | Robert P. J. Day <rpjday@crashcourse.ca> | 2008-04-17 00:09:26 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-04-17 00:09:26 -0400 |
commit | 4e96a774407b98c8095cfbd6c7202cb7fdf0d7be (patch) | |
tree | 99aa2117761765b96ad921f73558f2d594eab333 /drivers | |
parent | 157de229468b2a63bbc8f9a7d37c70a2c9731ac8 (diff) |
RDMA/nes: Use more concise list_for_each_entry()
In list iteration code, you normally wouldn't be calling
"container_of()" directly anyway, you'd be invoking "list_entry()".
But you don't even need that here, "list_for_each_entry()" is fine.
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Acked-by: Glenn Streiff <gstreiff@neteffect.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/hw/nes/nes_cm.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index 24d266459d14..d0738623bcf3 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c | |||
@@ -843,7 +843,6 @@ static struct nes_cm_node *find_node(struct nes_cm_core *cm_core, | |||
843 | { | 843 | { |
844 | unsigned long flags; | 844 | unsigned long flags; |
845 | u32 hashkey; | 845 | u32 hashkey; |
846 | struct list_head *list_pos; | ||
847 | struct list_head *hte; | 846 | struct list_head *hte; |
848 | struct nes_cm_node *cm_node; | 847 | struct nes_cm_node *cm_node; |
849 | 848 | ||
@@ -858,8 +857,7 @@ static struct nes_cm_node *find_node(struct nes_cm_core *cm_core, | |||
858 | 857 | ||
859 | /* walk list and find cm_node associated with this session ID */ | 858 | /* walk list and find cm_node associated with this session ID */ |
860 | spin_lock_irqsave(&cm_core->ht_lock, flags); | 859 | spin_lock_irqsave(&cm_core->ht_lock, flags); |
861 | list_for_each(list_pos, hte) { | 860 | list_for_each_entry(cm_node, hte, list) { |
862 | cm_node = container_of(list_pos, struct nes_cm_node, list); | ||
863 | /* compare quad, return node handle if a match */ | 861 | /* compare quad, return node handle if a match */ |
864 | nes_debug(NES_DBG_CM, "finding node %x:%x =? %x:%x ^ %x:%x =? %x:%x\n", | 862 | nes_debug(NES_DBG_CM, "finding node %x:%x =? %x:%x ^ %x:%x =? %x:%x\n", |
865 | cm_node->loc_addr, cm_node->loc_port, | 863 | cm_node->loc_addr, cm_node->loc_port, |
@@ -887,13 +885,11 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core, | |||
887 | nes_addr_t dst_addr, u16 dst_port, enum nes_cm_listener_state listener_state) | 885 | nes_addr_t dst_addr, u16 dst_port, enum nes_cm_listener_state listener_state) |
888 | { | 886 | { |
889 | unsigned long flags; | 887 | unsigned long flags; |
890 | struct list_head *listen_list; | ||
891 | struct nes_cm_listener *listen_node; | 888 | struct nes_cm_listener *listen_node; |
892 | 889 | ||
893 | /* walk list and find cm_node associated with this session ID */ | 890 | /* walk list and find cm_node associated with this session ID */ |
894 | spin_lock_irqsave(&cm_core->listen_list_lock, flags); | 891 | spin_lock_irqsave(&cm_core->listen_list_lock, flags); |
895 | list_for_each(listen_list, &cm_core->listen_list.list) { | 892 | list_for_each_entry(listen_node, &cm_core->listen_list.list, list) { |
896 | listen_node = container_of(listen_list, struct nes_cm_listener, list); | ||
897 | /* compare node pair, return node handle if a match */ | 893 | /* compare node pair, return node handle if a match */ |
898 | if (((listen_node->loc_addr == dst_addr) || | 894 | if (((listen_node->loc_addr == dst_addr) || |
899 | listen_node->loc_addr == 0x00000000) && | 895 | listen_node->loc_addr == 0x00000000) && |