Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e96a774 authored by Robert P. J. Day's avatar Robert P. J. Day Committed by Roland Dreier
Browse files

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: default avatarRobert P. J. Day <rpjday@crashcourse.ca>
Acked-by: default avatarGlenn Streiff <gstreiff@neteffect.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 157de229
Loading
Loading
Loading
Loading
+2 −6
Original line number Original line Diff line number Diff line
@@ -843,7 +843,6 @@ static struct nes_cm_node *find_node(struct nes_cm_core *cm_core,
{
{
	unsigned long flags;
	unsigned long flags;
	u32 hashkey;
	u32 hashkey;
	struct list_head *list_pos;
	struct list_head *hte;
	struct list_head *hte;
	struct nes_cm_node *cm_node;
	struct nes_cm_node *cm_node;


@@ -858,8 +857,7 @@ static struct nes_cm_node *find_node(struct nes_cm_core *cm_core,


	/* walk list and find cm_node associated with this session ID */
	/* walk list and find cm_node associated with this session ID */
	spin_lock_irqsave(&cm_core->ht_lock, flags);
	spin_lock_irqsave(&cm_core->ht_lock, flags);
	list_for_each(list_pos, hte) {
	list_for_each_entry(cm_node, hte, list) {
		cm_node = container_of(list_pos, struct nes_cm_node, list);
		/* compare quad, return node handle if a match */
		/* compare quad, return node handle if a match */
		nes_debug(NES_DBG_CM, "finding node %x:%x =? %x:%x ^ %x:%x =? %x:%x\n",
		nes_debug(NES_DBG_CM, "finding node %x:%x =? %x:%x ^ %x:%x =? %x:%x\n",
				cm_node->loc_addr, cm_node->loc_port,
				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,
		nes_addr_t dst_addr, u16 dst_port, enum nes_cm_listener_state listener_state)
		nes_addr_t dst_addr, u16 dst_port, enum nes_cm_listener_state listener_state)
{
{
	unsigned long flags;
	unsigned long flags;
	struct list_head *listen_list;
	struct nes_cm_listener *listen_node;
	struct nes_cm_listener *listen_node;


	/* walk list and find cm_node associated with this session ID */
	/* walk list and find cm_node associated with this session ID */
	spin_lock_irqsave(&cm_core->listen_list_lock, flags);
	spin_lock_irqsave(&cm_core->listen_list_lock, flags);
	list_for_each(listen_list, &cm_core->listen_list.list) {
	list_for_each_entry(listen_node, &cm_core->listen_list.list, list) {
		listen_node = container_of(listen_list, struct nes_cm_listener, list);
		/* compare node pair, return node handle if a match */
		/* compare node pair, return node handle if a match */
		if (((listen_node->loc_addr == dst_addr) ||
		if (((listen_node->loc_addr == dst_addr) ||
				listen_node->loc_addr == 0x00000000) &&
				listen_node->loc_addr == 0x00000000) &&