Skip to content

Commit 3d91dfe

Browse files
Jinjie Ruanrleon
authored andcommitted
RDMA/hfi1: Use list_for_each_entry() helper
Convert list_for_each() to list_for_each_entry() so that the pos list_head pointer and list_entry() call are no longer needed, which can reduce a few lines of code. No functional changed. Signed-off-by: Jinjie Ruan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Dennis Dalessandro <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent d3c2245 commit 3d91dfe

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/infiniband/hw/hfi1/affinity.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,9 @@ static void node_affinity_add_tail(struct hfi1_affinity_node *entry)
230230
/* It must be called with node_affinity.lock held */
231231
static struct hfi1_affinity_node *node_affinity_lookup(int node)
232232
{
233-
struct list_head *pos;
234233
struct hfi1_affinity_node *entry;
235234

236-
list_for_each(pos, &node_affinity.list) {
237-
entry = list_entry(pos, struct hfi1_affinity_node, list);
235+
list_for_each_entry(entry, &node_affinity.list, list) {
238236
if (entry->node == node)
239237
return entry;
240238
}

0 commit comments

Comments
 (0)